Refine search
@Override public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { if (dstPt == null) dstPt = new Point2D.Double(); dstPt.setLocation(srcPt.getX(), srcPt.getY()); return dstPt; }
/** * Transforms the specified (<var>x</var>,<var>y</var>) coordinates and stores the result in * {@code ptDst}. */ protected Point2D inverseTransformNormalized(double x, double y, final Point2D ptDst) throws ProjectionException { x /= cosStandardParallel; if (ptDst != null) { ptDst.setLocation(x, y); return ptDst; } return new Point2D.Double(x, y); }
public void move(double deltax, double deltay) { position.setLocation(position.getX() + deltax, position.getY() + deltay); } }
/** * Transforms the specified (<var>x</var>,<var>y</var>) coordinates and stores the result in * {@code ptDst}. */ @Override protected Point2D inverseTransformNormalized(double x, double y, final Point2D ptDst) throws ProjectionException { if (ptDst != null) { ptDst.setLocation(x, y); return ptDst; } return new Point2D.Double(x, y); }
@Override public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { if (dstPt == null) { dstPt = new Point2D.Double(); } dstPt.setLocation(srcPt.getX(), srcPt.getY()); return dstPt; }
/** * Transforms the specified (<var>λ</var>,<var>φ</var>) coordinates (units in * radians) and stores the result in {@code ptDst} (linear distance on a unit sphere). */ @Override protected Point2D transformNormalized(double x, double y, final Point2D ptDst) throws ProjectionException { if (ptDst != null) { ptDst.setLocation(x, y); return ptDst; } return new Point2D.Double(x, y); }
public void moveSvek(double deltaX, double deltaY) { this.pos.setLocation(pos.getX() + deltaX, pos.getY() + deltaY); }
/** * Transforms the specified (<var>λ</var>,<var>φ</var>) coordinates (units in * radians) and stores the result in {@code ptDst} (linear distance on a unit sphere). * * @param x The longitude of the coordinate, in <strong>radians</strong>. * @param y The latitude of the coordinate, in <strong>radians</strong>. */ protected Point2D transformNormalized(double x, double y, final Point2D ptDst) throws ProjectionException { x *= cosStandardParallel; if (ptDst != null) { ptDst.setLocation(x, y); return ptDst; } return new Point2D.Double(x, y); }
public UMotif(String s) { final Point2D last = new Point2D.Double(); for (int i = 0; i < s.length(); i++) { final Point2D read = convertPoint(s.charAt(i)); last.setLocation(last.getX() + read.getX(), last.getY() + read.getY()); points.add(new Point2D.Double(last.getX(), last.getY())); } }
/** {@inheritDoc} */ protected Point2D transformNormalized(double x, double y, Point2D ptDst) throws ProjectionException { double x1 = Math.asin(Math.cos(y) * Math.sin(x)); double y1 = Math.atan2(Math.tan(y), Math.cos(x)) - latitudeOfOrigin; if (ptDst != null) { ptDst.setLocation(x1, y1); return ptDst; } return new Point2D.Double(x1, y1); }
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { if (dstPt == null) { dstPt = new Point2D.Float(); } dstPt.setLocation(srcPt.getX(), srcPt.getY()); return dstPt; }
/** {@inheritDoc} */ protected Point2D inverseTransformNormalized(double x, double y, Point2D ptDst) throws ProjectionException { double dd = y + latitudeOfOrigin; double phi = Math.asin(Math.sin(dd) * Math.cos(x)); double lam = Math.atan2(Math.tan(x), Math.cos(dd)); if (ptDst != null) { ptDst.setLocation(lam, phi); return ptDst; } return new Point2D.Double(lam, phi); } }
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { if (dstPt == null) { dstPt = new Point2D.Float(); } dstPt.setLocation(srcPt.getX(), srcPt.getY()); return dstPt; }
public static Point2D nearestPointOnLine(double ax, double ay, double bx, double by, double px, double py, boolean clampToSegment, Point2D dest) { // Thanks StackOverflow! // http://stackoverflow.com/questions/1459368/snap-point-to-a-line-java if (dest == null) { dest = new Point2D.Double(); } double apx = px - ax; double apy = py - ay; double abx = bx - ax; double aby = by - ay; double ab2 = abx * abx + aby * aby; double ap_ab = apx * abx + apy * aby; double t = ap_ab / ab2; if (clampToSegment) { if (t < 0) { t = 0; } else if (t > 1) { t = 1; } } dest.setLocation(ax + abx * t, ay + aby * t); return dest; }
public void drawU(UGraphic ug) { final int xWing = 8; final int yAperture = 8; final AffineTransform rotate = AffineTransform.getRotateInstance(this.angle); Point2D middle = new Point2D.Double(0, 0); Point2D left = new Point2D.Double(0, -yAperture); Point2D base = new Point2D.Double(-xWing, 0); Point2D right = new Point2D.Double(0, yAperture); rotate.transform(left, left); rotate.transform(base, base); rotate.transform(right, right); if (side == Side.WEST || side == Side.EAST) { left.setLocation(middle.getX(), left.getY()); right.setLocation(middle.getX(), right.getY()); } if (side == Side.SOUTH || side == Side.NORTH) { left.setLocation(left.getX(), middle.getY()); right.setLocation(right.getX(), middle.getY()); } drawLine(ug, contact.getX(), contact.getY(), base, left); drawLine(ug, contact.getX(), contact.getY(), base, right); drawLine(ug, contact.getX(), contact.getY(), base, middle); }
@Override protected Point2D transformNormalized(double lpLambda, double lpPhi, Point2D ptDst) throws ProjectionException { double phi = asin(M * sin(lpPhi)); double phi2 = phi * phi; double phi6 = phi2 * phi2 * phi2; double x = lpLambda * cos(phi) / (M * (A1 + 3 * A2 * phi2 + phi6 * (7 * A3 + 9 * A4 * phi2))); double y = phi * (A1 + A2 * phi2 + phi6 * (A3 + A4 * phi2)); if (ptDst != null) { ptDst.setLocation(x, y); return ptDst; } return new Point2D.Double(x, y); }
private Point2D drawDiamond(UGraphic ug, double x, double y, double theta) { // final double theta = Math.atan2(-pathPoint.getX() + x, // pathPoint.getY() - y); final UPolygon triangle = new UPolygon(); triangle.addPoint(0, 0); final double width = 10; final double height = 14; triangle.addPoint(-width / 2, height / 2); triangle.addPoint(0, height); triangle.addPoint(width / 2, height / 2); triangle.rotate(theta); ug.apply(new UTranslate(x, y)).draw(triangle); final Point2D middle = triangle.getPoints().get(2); middle.setLocation(middle.getX() + x, middle.getY() + y); return middle; }
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { if (dstPt == null) { if (srcPt instanceof Point2D.Double) { dstPt = new Point2D.Double(); } else { dstPt = new Point2D.Float(); } } dstPt.setLocation(srcPt); return dstPt; }
private Point2D drawArrow(UGraphic ug, double x, double y, double theta) { // final double theta = Math.atan2(-pathPoint.getX() + x, // pathPoint.getY() - y); final UPolygon triangle = new UPolygon(); triangle.addPoint(0, 0); final double width = 12; final double height = 10; triangle.addPoint(-width / 2, height); final double height2 = 4; triangle.addPoint(0, height2); triangle.addPoint(width / 2, height); triangle.rotate(theta); ug.apply(new UTranslate(x, y)).draw(triangle); final Point2D middle = triangle.getPoints().get(2); middle.setLocation(middle.getX() + x, middle.getY() + y); return middle; }
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { // TODO: This is wrong! if (dstPt == null) { if (srcPt instanceof Point2D.Double) { dstPt = new Point2D.Double(); } else { dstPt = new Point2D.Float(); } } dstPt.setLocation(srcPt); return dstPt; }