public DragonCurve() { this.startOfDragon = new Point2dImpl(1/3f,0.5f); endOfDragon = new Point2dImpl(2/3f,0.5f); this.currentCurve = new PointList(startOfDragon,endOfDragon); }
/** * Returns the current mouse position in the coordinates of the image * and is determined by the scaling factors and the position of the * image within the viewport. If the mouse is no longer in the viewport, * the last known mouse position will be returned. * * @return The position in image coordinates. */ public Point2d getCurrentMouseImagePosition() { return new Point2dImpl(this.pixelX, this.pixelY); }
/** * Rotate the {@link PointList} about (0,0) with the given angle (in * radians) * * @param angle * the angle in radians */ public void rotate(double angle) { this.rotate(new Point2dImpl(0, 0), angle); }
/** * @return The x-ordinate of the centre */ public float getX() { return centre.getX(); }
@Override public Point3d minus(Point3d a) { return new Point3dImpl(this.x - a.getX(), this.y - a.getY(), this.z - a.getZ()); }
@Override public void translate(float x, float y) { for (final Point2d v : vertices) v.translate(x, y); }
@Override public SpatialLocation clone() { final SpatialLocation c = (SpatialLocation) super.clone(); return c; } }
@Override public void copyFrom(Point2d p) { setOrdinate(0, p.getOrdinate(0)); setOrdinate(1, p.getOrdinate(1)); }
/** * Construct with coordinate and payload. * * @param coord * The coordinate. * @param payload * The payload. */ public PayloadCoordinate(T coord, O payload) { this.coord = coord; this.setPayload(payload); }
@Override public void setOrdinate(int dimension, Number value) { coord.setOrdinate(dimension, value); } }
@Override public Point2d calculateCentroid() { float xSum = begin.getX() + end.getX(); float ySum = begin.getY() + end.getY(); xSum /= 2; ySum /= 2; return new Point2dImpl(xSum, ySum); }
public DragonCurve() { this.startOfDragon = new Point2dImpl(1/3f,0.5f); endOfDragon = new Point2dImpl(2/3f,0.5f); this.currentCurve = new PointList(startOfDragon,endOfDragon); }
private static Point2dImpl[] getPowerPoints() { return new Point2dImpl[] { new Point2dImpl(1 / 3f, 1 / 3f), new Point2dImpl(2 / 3f, 1 / 3f), new Point2dImpl(1 / 3f, 2 / 3f), new Point2dImpl(2 / 3f, 2 / 3f) }; } }
@Override public Point2d minus(Point2d a) { return new Point2dImpl(this.x - a.getX(), this.y - a.getY()); }
/** * Returns the current mouse position in the coordinates of the image * and is determined by the scaling factors and the position of the * image within the viewport. If the mouse is no longer in the viewport, * the last known mouse position will be returned. * * @return The position in image coordinates. */ public Point2d getCurrentMouseImagePosition() { return new Point2dImpl(this.pixelX, this.pixelY); }