p.set(p.x, p.y + offset);
/** * 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; }
/** * Returns the squared Euclidean distance between the given point and the nearest point inside * the bounds of the given rectangle. If the supplied point is inside the rectangle, the * distance will be zero. */ public static float pointRectDistanceSq (IRectangle r, IPoint p) { Point p2 = closestInteriorPoint(r, p); return Points.distanceSq(p.x(), p.y(), p2.x, p2.y); }
@Override // from Transform public Transform preConcatenate (Transform other) { if (generality() < other.generality()) { return other.concatenate(this); } if (other instanceof AffineTransform) { return Transforms.multiply((AffineTransform)other, this, new AffineTransform()); } else { AffineTransform oaff = new AffineTransform(other); return Transforms.multiply(oaff, this, oaff); } }
@Override // from Transform public Transform concatenate (Transform other) { if (generality() < other.generality()) { return other.preConcatenate(this); } if (other instanceof AffineTransform) { return Transforms.multiply(this, (AffineTransform)other, new AffineTransform()); } else { AffineTransform oaff = new AffineTransform(other); return Transforms.multiply(this, oaff, oaff); } }
/** * Sets this to a rotation matrix that rotates one vector onto another. * * @return a reference to this matrix, for chaining. */ public Matrix3 setToRotation (IVector3 from, IVector3 to) { float angle = from.angle(to); return (angle < 0.0001f) ? setToIdentity() : setToRotation(angle, from.cross(to).normalizeLocal()); }
/** * Returns how many times a ray from point (x,y) crosses a shape. */ public static int crossShape (IShape s, float x, float y) { if (!s.bounds().contains(x, y)) { return 0; } return crossPath(s.pathIterator(null), x, y); }
@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); }
@Override // from interface IVector public Vector rotateScaleAndAdd (float angle, float scale, IVector add, Vector result) { float x = x(), y = y(); float sina = FloatMath.sin(angle), cosa = FloatMath.cos(angle); return result.set((x*cosa - y*sina)*scale + add.x(), (x*sina + y*cosa)*scale + add.y()); }
Point mappoint = googleMap.getProjection().toScreenLocation(new LatLng(latitude, longitude)); mappoint.set(mappoint.x, mappoint.y-30); googleMap.animateCamera(CameraUpdateFactory.newLatLng(googleMap.getProjection().fromScreenLocation(mappoint)));
@Override // from interface IVector public Vector rotateScaleAndAdd (float angle, float scale, IVector add, Vector result) { float x = x(), y = y(); float sina = FloatMath.sin(angle), cosa = FloatMath.cos(angle); return result.set((x*cosa - y*sina)*scale + add.x(), (x*sina + y*cosa)*scale + add.y()); }