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

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

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

Point介绍

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

代码示例

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

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

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

  1. public void onEmit (Keyboard.Event event) {
  2. if (event instanceof Keyboard.KeyEvent) {
  3. Keyboard.KeyEvent kevent = (Keyboard.KeyEvent)event;
  4. if (kevent.key == pivotKey && kevent.down) {
  5. pivot = new Point(x, y);
  6. }
  7. }
  8. }
  9. });

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

  1. protected float axisDistance (Point start, Point end) {
  2. if (start == null || end == null) return 0;
  3. float value;
  4. if (_direction == Direction.UP || _direction == Direction.DOWN)
  5. value = end.y() - start.y();
  6. else
  7. value = end.x() - start.x();
  8. return _axisSwipe ? Math.abs(value) : value * _directionModifier;
  9. }

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

  1. @Override public void onEnd (Pointer.Interaction iact) {
  2. // just dispatch a click if the pointer didn't move very far
  3. if (_maxDeltaSq < maxClickDeltaSq()) {
  4. clicked.emit(iact.event);
  5. return;
  6. }
  7. // if not, maybe impart some velocity
  8. float dragTime = (float)(iact.event.time - _prevStamp);
  9. if (dragTime > 0) {
  10. Point delta = new Point(_cur.x - _prev.x, _cur.y - _prev.y);
  11. Point dragVel = delta.mult(1 / dragTime);
  12. float dragSpeed = dragVel.distance(0, 0);
  13. if (dragSpeed > maxFlickSpeed) {
  14. dragVel.multLocal(maxFlickSpeed / dragSpeed);
  15. dragSpeed = maxFlickSpeed;
  16. }
  17. _vel.set(dragVel);
  18. _vel.multLocal(flickXfer);
  19. float sx = Math.signum(_vel.x), sy = Math.signum(_vel.y);
  20. _accel.x = -sx * friction;
  21. _accel.y = -sy * friction;
  22. }
  23. }

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

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

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

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

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

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

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

  1. public void onEmit (Keyboard.Event event) {
  2. if (event instanceof Keyboard.KeyEvent) {
  3. Keyboard.KeyEvent kevent = (Keyboard.KeyEvent)event;
  4. if (kevent.key == pivotKey && kevent.down) {
  5. pivot = new Point(x, y);
  6. }
  7. }
  8. }
  9. });

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

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

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

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

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

  1. @Override // from IPoint
  2. public Point clone () {
  3. return new Point(this);
  4. }

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

  1. public double distanceFrom(Point other){
  2. double distance = 0.0;
  3. double dx = Math.abs(other.x() - this.x());
  4. double dy = Math.abs(other.y() - this.y());
  5. if (dx > dy) {
  6. double ratio = dy/dx;
  7. distance = dx*Math.sqrt(1.0+ratio*ratio);
  8. } else {
  9. double ratio = dx/dy;
  10. distance = dy*Math.sqrt(1.+ratio*ratio);
  11. }
  12. return distance;
  13. }

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

  1. @Override
  2. public void onProvideShadowMetrics(Point shadowSize,
  3. Point shadowTouchPoint) {
  4. super.onProvideShadowMetrics(shadowSize, shadowTouchPoint);
  5. shadowTouchPoint.set(touchPointXCoord, touchPointYCoord);
  6. }

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

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

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

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

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

  1. /**
  2. * Constructs a point at the specified coordinates.
  3. */
  4. public Point (float x, float y) {
  5. set(x, y);
  6. }

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

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

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

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

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

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

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

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

相关文章