pythagoras.f.Point.set()方法的使用及代码示例

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

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

Point.set介绍

[英]Sets the coordinates of this point to the supplied values.
[中]将该点的坐标设置为提供的值。

代码示例

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

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

代码示例来源: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: stackoverflow.com

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

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

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

  super.onProvideShadowMetrics(shadowSize, shadowTouchPoint);

  shadowTouchPoint.set(touchPointXCoord, touchPointYCoord);    
}

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

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

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

public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint) {
  final View view = mView.get();
  if (view != null) {
    shadowSize.set(view.getWidth(), view.getHeight());
    shadowTouchPoint.set(shadowSize.x / 2, shadowSize.y / 2);
  } else {
    Log.e(View.VIEW_LOG_TAG, "Asked for drag thumb metrics but no view");
  }
}

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

public static Point localPos (Position ev, Point dest) {
  dest.set(ev.localX(),  ev.localY());
  return dest;
 }
}

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

private Point queryCursorPosition () {
 xpos.rewind(); ypos.rewind();
 glfwGetCursorPos(window, xpos, ypos);
 cpos.set((float)xpos.get(), (float)ypos.get());
 return cpos;
}

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

/** Inverse transforms a point as specified, storing the result in the point provided.
 * @return a reference to the result point, for chaining. */
public static Point inverseTransform (float x, float y, float sx, float sy, float rotation,
                   float tx, float ty, Point result) {
  x -= tx; y -= ty; // untranslate
  float sinnega = FloatMath.sin(-rotation), cosnega = FloatMath.cos(-rotation);
  float nx = (x * cosnega - y * sinnega); // unrotate
  float ny = (x * sinnega + y * cosnega);
  return result.set(nx / sx, ny / sy); // unscale
}

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

/**
 * Constructs a point with coordinates equal to the supplied point.
 */
public Point (XY p) {
  set(p.x(), p.y());
}

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

private void dispatchSolo (Event event) {
  Layer hitLayer = LayerUtil.getHitLayer(root, scratch.set(event.x, event.y));
  if (hitLayer != null) new Interaction(hitLayer, bubble, true).dispatch(event);
 }
}

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

@Override public void onEmit (Event event) {
  // start a new interaction on START, if we don't already have one
  if (currentIact == null && event.kind.isStart) {
   Layer hitLayer = LayerUtil.getHitLayer(root, scratch.set(event.x, event.y));
   if (hitLayer != null) currentIact = new Interaction(hitLayer, bubble);
  }
  // dispatch the event to the interaction
  if (currentIact != null) currentIact.dispatch(event);
  // if this is END or CANCEL, clear out the current interaction
  if (event.kind.isEnd) currentIact = null;
 }
}

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

@Override // from Transform
public Point inverseTransform (IPoint p, Point into) {
  float x = p.x() - tx, y = p.y() - ty;
  float det = m00 * m11 - m01 * m10;
  if (Math.abs(det) == 0f) {
    // determinant is zero; matrix is not invertible
    throw new NoninvertibleTransformException(this.toString());
  }
  float rdet = 1 / det;
  return into.set((x * m11 - y * m10) * rdet,
          (y * m00 - x * m01) * rdet);
}

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

/**
 * Converts the supplied point from coordinates relative to its parent
 * to coordinates relative to the specified layer. The results are stored
 * into {@code into}, which is returned for convenience.
 */
public static Point parentToLayer(Layer layer, XY point, Point into) {
 layer.transform().inverseTransform(into.set(point), into);
 into.x += layer.originX();
 into.y += layer.originY();
 return into;
}

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

@Override // from IPoint
public Point rotate (float angle, Point result) {
  float x = x(), y = y();
  float sina = FloatMath.sin(angle), cosa = FloatMath.cos(angle);
  return result.set(x*cosa - y*sina, x*sina + y*cosa);
}

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

@Override
public Point inverseTransform(IPoint p, Point into) {
 float m00 = m00(), m01 = m01(), m10 = m10(), m11 = m11();
 float x = p.x() - tx(), y = p.y() - ty();
 float det = m00 * m11 - m01 * m10;
 if (Math.abs(det) == 0f) {
  // determinant is zero; matrix is not invertible
  throw new NoninvertibleTransformException(this.toString());
 }
 float rdet = 1 / det;
 return into.set((x * m11 - y * m10) * rdet, (y * m00 - x * m01) * rdet);
}

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

@Override
public Point transform(IPoint p, Point into) {
 float x = p.x(), y = p.y();
 return into.set(m00() * x + m10() * y + tx(), m01() * x + m11() * y + ty());
}

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

@Override // from interface IArc
public Point startPoint (Point target) {
  float a = FloatMath.toRadians(angleStart());
  return target.set(x() + (1f + FloatMath.cos(a)) * width() / 2f,
           y() + (1f - FloatMath.sin(a)) * height() / 2f);
}

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

/**
 * Computes the point inside the bounds of the rectangle that's closest to the given point,
 * writing the result into {@code out}.
 * @return {@code out} for call chaining convenience.
 */
public static Point closestInteriorPoint (IRectangle r, IPoint p, Point out) {
  out.set(MathUtil.clamp(p.x(), r.minX(), r.maxX()),
      MathUtil.clamp(p.y(), r.minY(), r.maxY()));
  return out;
}

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

@Override // from interface IArc
public Point endPoint (Point target) {
  float a = FloatMath.toRadians(angleStart() + angleExtent());
  return target.set(x() + (1f + FloatMath.cos(a)) * width() / 2f,
           y() + (1f - FloatMath.sin(a)) * height() / 2f);
}

相关文章