pythagoras.f.Point类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中pythagoras.f.Point类的一些代码示例,展示了Point类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point类的具体详情如下:
包路径:pythagoras.f.Point
类名称:Point

Point介绍

[英]Represents a point on a plane.
[中]表示平面上的点。

代码示例

代码示例来源:origin: stackoverflow.com

p.set(p.x, p.y + offset);

代码示例来源:origin: playn/playn

public void onEmit (Keyboard.Event event) {
  if (event instanceof Keyboard.KeyEvent) {
   Keyboard.KeyEvent kevent = (Keyboard.KeyEvent)event;
   if (kevent.key == pivotKey && kevent.down) {
    pivot = new Point(x, y);
   }
  }
 }
});

代码示例来源:origin: threerings/tripleplay

protected float axisDistance (Point start, Point end) {
  if (start == null || end == null) return 0;
  float value;
  if (_direction == Direction.UP || _direction == Direction.DOWN)
    value = end.y() - start.y();
  else
    value = end.x() - start.x();
  return _axisSwipe ? Math.abs(value) : value * _directionModifier;
}

代码示例来源:origin: threerings/tripleplay

@Override public void onEnd (Pointer.Interaction iact) {
  // just dispatch a click if the pointer didn't move very far
  if (_maxDeltaSq < maxClickDeltaSq()) {
    clicked.emit(iact.event);
    return;
  }
  // if not, maybe impart some velocity
  float dragTime = (float)(iact.event.time - _prevStamp);
  if (dragTime > 0) {
    Point delta = new Point(_cur.x - _prev.x, _cur.y - _prev.y);
    Point dragVel = delta.mult(1 / dragTime);
    float dragSpeed = dragVel.distance(0, 0);
    if (dragSpeed > maxFlickSpeed) {
      dragVel.multLocal(maxFlickSpeed / dragSpeed);
      dragSpeed = maxFlickSpeed;
    }
    _vel.set(dragVel);
    _vel.multLocal(flickXfer);
    float sx = Math.signum(_vel.x), sy = Math.signum(_vel.y);
    _accel.x = -sx * friction;
    _accel.y = -sy * friction;
  }
}

代码示例来源:origin: com.samskivert/pythagoras

/** Multiplies this point by a scale factor.
 * @return a a reference to this point, for chaining. */
public Point multLocal (float s) {
  return mult(s, this);
}

代码示例来源:origin: samskivert/pythagoras

/** Multiplies this point by a scale factor.
 * @return a a reference to this point, for chaining. */
public Point multLocal (float s) {
  return mult(s, this);
}

代码示例来源:origin: stackoverflow.com

Point mappoint = googleMap.getProjection().toScreenLocation(new LatLng(latitude, longitude));
   mappoint.set(mappoint.x, mappoint.y-30);
   googleMap.animateCamera(CameraUpdateFactory.newLatLng(googleMap.getProjection().fromScreenLocation(mappoint)));

代码示例来源:origin: io.playn/playn-java-base

public void onEmit (Keyboard.Event event) {
  if (event instanceof Keyboard.KeyEvent) {
   Keyboard.KeyEvent kevent = (Keyboard.KeyEvent)event;
   if (kevent.key == pivotKey && kevent.down) {
    pivot = new Point(x, y);
   }
  }
 }
});

代码示例来源:origin: stackoverflow.com

public double distanceFrom(Point other){
  double dx = (other.x() - x());
  double dy = (other.y() - y());
  return Math.sqrt(dx*dx + dy*dy);
}

代码示例来源:origin: stackoverflow.com

size.set(width, height);
touch.set(width / 2, height / 2);

代码示例来源:origin: com.samskivert/pythagoras

@Override // from IPoint
public Point clone () {
  return new Point(this);
}

代码示例来源:origin: stackoverflow.com

public double distanceFrom(Point other){
  double distance = 0.0;
  double dx = Math.abs(other.x() - this.x());
  double dy = Math.abs(other.y() - this.y());
  if (dx > dy) {
    double ratio = dy/dx;
    distance = dx*Math.sqrt(1.0+ratio*ratio);
  } else {
    double ratio = dx/dy;
    distance = dy*Math.sqrt(1.+ratio*ratio);
  }
  return distance;
}

代码示例来源:origin: stackoverflow.com

@Override
public void onProvideShadowMetrics(Point shadowSize,
  Point shadowTouchPoint) {

  super.onProvideShadowMetrics(shadowSize, shadowTouchPoint);

  shadowTouchPoint.set(touchPointXCoord, touchPointYCoord);    
}

代码示例来源:origin: threerings/tripleplay

/**
 * Sets the left and top of the view area relative to that of the content the next time the
 * container is laid out. This is needed if the caller invalidates the content and needs
 * to then set a scroll position which may be out of range for the old size.
 */
public void queueScroll (float x, float y) {
  _queuedScroll = new Point(x, y);
}

代码示例来源:origin: stackoverflow.com

public Rectangle setLocation(Point p) {
  return setLocation(p.x(), p.y());
}

代码示例来源:origin: com.samskivert/pythagoras

/**
 * Constructs a point at the specified coordinates.
 */
public Point (float x, float y) {
  set(x, y);
}

代码示例来源:origin: threerings/tripleplay

/** Creates a new event and initializes {@link #trigger} and {@link #menu}. */
public Pop (Element<?> trigger, Menu menu, Event.XY pointer) {
  if (menu == null) throw new IllegalArgumentException();
  this.menu = menu;
  this.trigger = trigger;
  this.pointer = pointer == null ? null : new Point(pointer);
}

代码示例来源:origin: threerings/playn

/**
 * Returns true if a coordinate on the screen touches a {@link Layer.HasSize}.
 */
public static boolean hitTest(Layer.HasSize layer, float x, float y) {
 Point point = screenToLayer(layer, x, y);
 return (
   point.x() >= 0 &&  point.y() >= 0 &&
   point.x() <= layer.width() && point.y() <= layer.height());
}

代码示例来源:origin: threerings/tripleplay

/**
 * Converts an event to coordinates consumed by {@link #onTrack}. By default, simply uses
 * the local x, y.
 */
protected void toPoint (Pointer.Interaction iact, Point dest) {
  dest.set(iact.local.x, iact.local.y);
}

代码示例来源:origin: threerings/tripleplay

public TextureData (DataInputStream istream) throws IOException {
  symbol = istream.readUTF();
  origin = new Point(istream.readFloat(), istream.readFloat());
  rect = new float[] { istream.readFloat(), istream.readFloat(), istream.readFloat(),
    istream.readFloat() };
}

相关文章