List of usage examples for org.apache.commons.math3.geometry.euclidean.twod Vector2D getX
public double getX()
From source file:nova.core.util.math.Vector2DUtil.java
public static Vector2D reciprocal(Vector2D vec) { return new Vector2D(1 / vec.getX(), 1 / vec.getY()); }
From source file:nova.core.util.math.Vector2DUtil.java
public static Vector2D round(Vector2D vec) { return new Vector2D(FastMath.round(vec.getX()), FastMath.round(vec.getY())); }
From source file:nova.core.util.math.Vector2DUtil.java
public static Vector2D ceil(Vector2D vec) { return new Vector2D(FastMath.ceil(vec.getX()), FastMath.ceil(vec.getY())); }
From source file:nova.core.util.math.Vector2DUtil.java
public static Vector2D floor(Vector2D vec) { return new Vector2D(FastMath.floor(vec.getX()), FastMath.floor(vec.getY())); }
From source file:org.evors.rs.ui.sandpit.SandPitCamera.java
/** * Get the value of transform/*from w w w . j a v a2 s . c om*/ * * @return the value of transform */ public AffineTransform getTransform() { AffineTransform returnTransform = new AffineTransform(); Vector2D currentPosScreenCoord = new Vector2D(getScale(), getCurrentPosWorldCoord()); Vector2D halfWindow = getHalfWindowSize(); returnTransform.translate(currentPosScreenCoord.getX() + halfWindow.getX(), currentPosScreenCoord.getY() + halfWindow.getY()); returnTransform.scale(getScale(), -getScale()); return returnTransform; }
From source file:org.evors.rs.ui.sandpit.SandPitCamera.java
public Rectangle2D getViewPortInWorldCoords() { Vector2D screenZeroZeroInWorldCoords = convertScreenToWorldCoords(Vector2D.ZERO); Vector2D screenWidthHeightInWorldCoords = convertScreenToWorldCoords(new Vector2D(2, getWindowSize())); Rectangle2D rect = new Rectangle2D.Double(); rect.setFrame(screenZeroZeroInWorldCoords.getX(), screenZeroZeroInWorldCoords.getY(), screenWidthHeightInWorldCoords.getX(), screenWidthHeightInWorldCoords.getY()); return rect;/*from w w w . j a va 2 s .co m*/ }
From source file:org.kalypso.model.wspm.ewawi.utils.profiles.EwawiProfilePoint.java
/** * This function returns the point as shape. * /*from w ww .ja va2s. c om*/ * @return The point as shape. */ public SHPPoint getShape() { /* g Rechtswert (Projektion auf Abszisse) von links nach rechts aufsteigend */ /* h Hochwert (Abweichung von der Achse) rechts positiv, links negativer Wert. */ final double rechtswert = m_proLine.getRechtswert().doubleValue(); final double hochwert = m_proLine.getHochwert().doubleValue(); /* Get the normalized vector of the fix points (length 1). */ final Vector2D normalizedProfileAxis = getNormalizedProfileAxis(); /* Get the projection vector. */ final Vector2D projectionVector = normalizedProfileAxis.scalarMultiply(rechtswert); /* Create the start point. */ final double xLeft = m_left.getRechtswert().doubleValue(); final double yLeft = m_left.getHochwert().doubleValue(); final Vector2D startPoint = new Vector2D(xLeft, yLeft); /* Create the projection point. */ final Vector2D projectionPoint = startPoint.add(projectionVector); /* Create the orthogonal vector from the normalized profile axis (has then also length 1). */ final Vector2D orthVector = new Vector2D(normalizedProfileAxis.getY(), -normalizedProfileAxis.getX()); /* Add hochwert * orthVector to the projection point. */ final Vector2D targetPoint = projectionPoint.add(hochwert, orthVector); return new SHPPoint(targetPoint.getX(), targetPoint.getY()); }
From source file:org.kalypso.model.wspm.ewawi.utils.profiles.EwawiProfilePoint.java
/** * This function returns the point as shape. * It ignores the hochwert, so that the point will be the projected point on the idealized line (left fixpoint to right fixpoint). * //from w w w . ja v a2s. c om * @return The point as shape. */ public SHPPoint getShapeIdealized() { /* g Rechtswert (Projektion auf Abszisse) von links nach rechts aufsteigend */ final double rechtswert = m_proLine.getRechtswert().doubleValue(); /* Get the normalized vector of the fix points (length 1). */ final Vector2D normalizedProfileAxis = getNormalizedProfileAxis(); /* Get the projection vector. */ final Vector2D projectionVector = normalizedProfileAxis.scalarMultiply(rechtswert); /* Create the start point. */ final double xLeft = m_left.getRechtswert().doubleValue(); final double yLeft = m_left.getHochwert().doubleValue(); final Vector2D startPoint = new Vector2D(xLeft, yLeft); /* Create the projection point. */ final Vector2D projectionPoint = startPoint.add(projectionVector); return new SHPPoint(projectionPoint.getX(), projectionPoint.getY()); }
From source file:org.micromanager.plugins.magellan.imagedisplay.DisplayOverlayer.java
private void addConvexHull(Overlay overlay) throws InterruptedException { //draw convex hull Vector2D[] hullPoints = display_.getCurrentSurface().getConvexHullPoints(); LongPoint lastPoint = null, firstPoint = null; for (Vector2D v : hullPoints) { if (Thread.interrupted()) { throw new InterruptedException(); }//from w w w . ja v a 2 s.c o m //convert to image coords LongPoint p = display_.imageCoordsFromStageCoords(v.getX(), v.getY()); if (lastPoint != null) { Line l = new Line(p.x_, p.y_, lastPoint.x_, lastPoint.y_); l.setStrokeColor(CONVEX_HULL_COLOR); overlay.add(l); } else { firstPoint = p; } lastPoint = p; } //draw last connection Line l = new Line(firstPoint.x_, firstPoint.y_, lastPoint.x_, lastPoint.y_); l.setStrokeColor(CONVEX_HULL_COLOR); overlay.add(l); }
From source file:org.micromanager.plugins.magellan.surfacesandregions.SingleResolutionInterpolation.java
public SingleResolutionInterpolation(int pixPerPoint, boolean[][] defined, float[][] interp, float[][] normals, double boundXMin, double boundXMax, double boundYMin, double boundYMax, Region<Euclidean2D> ch, Vector2D[] convexHullVertices, Point3d[] allPoints) { pixPerInterpPoint_ = pixPerPoint;/* w w w. j ava 2s .c o m*/ interpDefined_ = defined; interpolation_ = interp; normals_ = normals; boundXMax_ = boundXMax; boundYMax_ = boundYMax; boundXMin_ = boundXMin; boundYMin_ = boundYMin; convexHullRegion_ = ch; //keep them sorted for fast searching convexHullVertices_ = new TreeSet<Vector2D>(new Comparator<Vector2D>() { @Override public int compare(Vector2D o1, Vector2D o2) { if (o1.getX() != o2.getX()) { return o1.getX() < o2.getX() ? -1 : 1; } if (o1.getY() == o2.getY()) { return 0; } return o1.getY() < o2.getY() ? -1 : 1; } }); convexHullVertices_.addAll(Arrays.asList(convexHullVertices)); allPoints_ = allPoints; }