public void setDollyY(double cameraDollyY) { this.dollyPosition.setY(cameraDollyY); }
public void setTrackingY(double cameraTrackingY) { this.trackingPosition.setY(cameraTrackingY); }
public void getScanPoint(int index, Point3d scanPointToPack) { index *= 3; scanPointToPack.setX(scan[index++]); scanPointToPack.setY(scan[index++]); scanPointToPack.setZ(scan[index++]); }
public static void main(String[] args) { Point3d frst = new Point3d(); frst.setX(0); frst.setY(0); frst.setZ(0); System.out.println("(" + frst.getxCoord() + "," + frst.getyCoord() + "," + frst.getzCoord() + ")"); Point3d secnd = new Point3d(); secnd.setX(2); secnd.setY(12); secnd.setZ(24); System.out.println("(" + secnd.getxCoord() + "," + secnd.getyCoord() + "," + secnd.getzCoord() + ")"); }
public void getBasePosition(Point3d point3d) { point3d.setX(this.baseX.getDoubleValue()); point3d.setY(this.baseY.getDoubleValue()); point3d.setZ(this.baseZ.getDoubleValue()); }
public void getBasePosition(Point3d point3d) { point3d.setX(this.baseX.getDoubleValue()); point3d.setY(this.baseY.getDoubleValue()); point3d.setZ(this.baseZ.getDoubleValue()); }
pointsOnSphere[planeIndex] = new Point3d(); pointsOnSphere[planeIndex].setX(rSinTheta * Math.cos(phi)); pointsOnSphere[planeIndex].setY(rSinTheta * Math.sin(phi)); pointsOnSphere[planeIndex].setZ(sphereRadius * Math.cos(theta)); pointsOnSphere[planeIndex].add(sphereOrigin);
public void getPosition(Point3d point3d) { point3d.setX(this.getX()); point3d.setY(this.getY()); if (this.z != null) point3d.setZ(this.getZ()); else point3d.setZ(0.0); }
pointToAdd.setY(startPoint.getY() + deltaTimesI * sinAngle); pointToAdd.setZ(coefficientsOfParabola[2] * deltaTimesI * deltaTimesI + coefficientsOfParabola[1] * deltaTimesI + coefficientsOfParabola[0]); pointsOnPath.add(new Point3d(pointToAdd));
/** * Computes if the point is in the region projected onto the world xy-plane. * @param x x-coordinate of the query. * @param y y-coordinate of the query. * @return true if the point is inside this region, false otherwise. */ public boolean isPointInsideByProjectionOntoXYPlane(double x, double y) { Point3d localPoint = new Point3d(); localPoint.setX(x); localPoint.setY(y); localPoint.setZ(getPlaneZGivenXY(x, y)); fromWorldToLocalTransform.transform(localPoint); return isPointInside(localPoint.getX(), localPoint.getY()); }
@Override protected void orthogonalProjectionShapeFrame(Point3d pointToCheckAndPack) { if (pointToCheckAndPack.getZ() < 0.0) pointToCheckAndPack.setZ(0.0); if (pointToCheckAndPack.getZ() > height) pointToCheckAndPack.setZ(height); double xyLengthSquared = pointToCheckAndPack.getX() * pointToCheckAndPack.getX() + pointToCheckAndPack.getY() * pointToCheckAndPack.getY(); if (xyLengthSquared > radius * radius) { double xyLength = Math.sqrt(xyLengthSquared); double scale = radius / xyLength; pointToCheckAndPack.setX(pointToCheckAndPack.getX() * scale); pointToCheckAndPack.setY(pointToCheckAndPack.getY() * scale); } }
/** * Transform the Point3d point by this transform and place result back in * point. * * @param point */ public final void transform(Point3d point) { double x = mat00 * point.getX() + mat01 * point.getY() + mat02 * point.getZ() + mat03; double y = mat10 * point.getX() + mat11 * point.getY() + mat12 * point.getZ() + mat13; point.setZ(mat20 * point.getX() + mat21 * point.getY() + mat22 * point.getZ() + mat23); point.setX(x); point.setY(y); }
/** * Multiply a 3x3 matrix by a 3x1 vector. Since result is stored in vector, the matrix must be 3x3. * @param matrix * @param point */ public static void mult(DenseMatrix64F matrix, Point3d point) { if (matrix.numCols != 3 || matrix.numRows != 3) { throw new RuntimeException("Improperly sized matrices."); } double x = point.getX(); double y = point.getY(); double z = point.getZ(); point.setX(matrix.get(0, 0) * x + matrix.get(0, 1) * y + matrix.get(0, 2) * z); point.setY(matrix.get(1, 0) * x + matrix.get(1, 1) * y + matrix.get(1, 2) * z); point.setZ(matrix.get(2, 0) * x + matrix.get(2, 1) * y + matrix.get(2, 2) * z); }
/** * Transform the Point3d pointIn by this transform and place result in * pointOut. * * @param point */ public final void transform(Point3d pointIn, Point3d pointOut) { if (pointIn != pointOut) { pointOut.setX(mat00 * pointIn.getX() + mat01 * pointIn.getY() + mat02 * pointIn.getZ() + mat03); pointOut.setY(mat10 * pointIn.getX() + mat11 * pointIn.getY() + mat12 * pointIn.getZ() + mat13); pointOut.setZ(mat20 * pointIn.getX() + mat21 * pointIn.getY() + mat22 * pointIn.getZ() + mat23); } else { transform(pointIn); } }
topVertexBToPack.setY(topVertexBToPack.getY() + perpendicularBisectorY); topVertexBToPack.setZ(topVertexBToPack.getZ() + perpendicularBisectorZ);
/** * Projects the input LineSegment2d to the plane defined by this PlanarRegion by translating each vertex in world z. * Then puts each vertex in local frame. In doing so, the length of the rotated lineSegment will actually increase on tilted PlanarRegions. * @param lineSegmentInWorld LineSegment2d to project * @return new projected LineSegment2d */ private LineSegment2d projectLineSegmentVerticallyToRegion(LineSegment2d lineSegmentInWorld) { Point2d[] snappedEndpoints = new Point2d[2]; Point2d originalVertex = lineSegmentInWorld.getFirstEndpoint(); Point3d snappedVertex3d = new Point3d(); // Find the vertex 3d that is snapped to the plane following z-world. snappedVertex3d.setX(originalVertex.getX()); snappedVertex3d.setY(originalVertex.getY()); snappedVertex3d.setZ(getPlaneZGivenXY(originalVertex.getX(), originalVertex.getY())); // Transform to local coordinates fromWorldToLocalTransform.transform(snappedVertex3d); snappedEndpoints[0] = new Point2d(snappedVertex3d.getX(), snappedVertex3d.getY()); originalVertex = lineSegmentInWorld.getSecondEndpoint(); // Find the vertex 3d that is snapped to the plane following z-world. snappedVertex3d.setX(originalVertex.getX()); snappedVertex3d.setY(originalVertex.getY()); snappedVertex3d.setZ(getPlaneZGivenXY(originalVertex.getX(), originalVertex.getY())); // Transform to local coordinates fromWorldToLocalTransform.transform(snappedVertex3d); snappedEndpoints[1] = new Point2d(snappedVertex3d.getX(), snappedVertex3d.getY()); LineSegment2d projectedLineSegment = new LineSegment2d(snappedEndpoints); return projectedLineSegment; }
/** * Projects the input ConvexPolygon2d to the plane defined by this PlanarRegion by translating each vertex in world z. * Then puts each vertex in local frame. In doing so, the area of the rotated polygon will actually increase on tilted PlanarRegions. * @param convexPolygonInWorld Polygon to project * @return new projected ConvexPolygon2d */ private ConvexPolygon2d projectPolygonVerticallyToRegion(ConvexPolygon2d convexPolygonInWorld) { ConvexPolygon2d projectedPolygon = new ConvexPolygon2d(); Point3d snappedVertex3d = new Point3d(); for (int i = 0; i < convexPolygonInWorld.getNumberOfVertices(); i++) { Point2d originalVertex = convexPolygonInWorld.getVertex(i); // Find the vertex 3d that is snapped to the plane following z-world. snappedVertex3d.setX(originalVertex.getX()); snappedVertex3d.setY(originalVertex.getY()); snappedVertex3d.setZ(getPlaneZGivenXY(originalVertex.getX(), originalVertex.getY())); // Transform to local coordinates fromWorldToLocalTransform.transform(snappedVertex3d); // Add the snapped vertex to the snapped polygon projectedPolygon.addVertex(snappedVertex3d.getX(), snappedVertex3d.getY()); } projectedPolygon.update(); return projectedPolygon; }
/** * Computes the orthogonal projection of a 3D point on a given 3D plane defined by a 3D point and 3D normal. * <p> * Edge cases: * <ul> * <li> if the length of the plane normal is too small, i.e. less than {@link Epsilons#ONE_TRILLIONTH}, * this method fails and returns {@code false}. * </ul> * </p> * * @param pointToProject the point to compute the projection of. Not modified. * @param pointOnPlane a point on the plane. Not modified. * @param planeNormal the normal of the plane. Not modified. * @param projectionToPack point in which the projection of the point onto the plane is stored. Modified. * @return whether the method succeeded or not. */ public static boolean getOrthogonalProjectionOnPlane(Point3d pointToProject, Point3d pointOnPlane, Vector3d planeNormal, Point3d projectionToPack) { double normalMagnitude = planeNormal.length(); if (normalMagnitude < Epsilons.ONE_TRILLIONTH) return false; projectionToPack.sub(pointToProject, pointOnPlane); double signedDistance = projectionToPack.getX() * planeNormal.getX() + projectionToPack.getY() * planeNormal.getY() + projectionToPack.getZ() * planeNormal.getZ(); signedDistance /= (normalMagnitude * normalMagnitude); projectionToPack.setX(pointToProject.getX() - signedDistance * planeNormal.getX()); projectionToPack.setY(pointToProject.getY() - signedDistance * planeNormal.getY()); projectionToPack.setZ(pointToProject.getZ() - signedDistance * planeNormal.getZ()); return true; }
mean.setY(mean.getY() + devY * nInv); mean.setZ(mean.getZ() + devZ * nInv);