|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectus.ihmc.utilities.math.geometry.GeometryTools
public class GeometryTools
Constructor Summary | |
---|---|
GeometryTools()
|
Method Summary | |
---|---|
static boolean |
arePointsInOrderAndColinear(javax.vecmath.Point2d startPoint,
javax.vecmath.Point2d middlePoint,
javax.vecmath.Point2d endPoint,
double epsilon)
arePointsInOrderColinear: This returns true if: middle point is epsilon close to start or end Otherwise: if the start is epsilon close to the end, return false if |(start to middle unit vector) dot with (start to end unit vector) - 1| > epsilon return false else return true |
static boolean |
arePointsInOrderAndColinear(javax.vecmath.Point3d startPoint,
javax.vecmath.Point3d middlePoint,
javax.vecmath.Point3d endPoint,
double epsilon)
arePointsInOrderColinear: This returns true if: middle point is epsilon close to start or end Otherwise: if the start is epsilon close to the end, return false if |(start to middle unit vector) dot with (start to end unit vector) - 1| > epsilon return false else return true |
static javax.vecmath.Point2d |
averagePoint2ds(java.util.ArrayList<javax.vecmath.Point2d> points)
Averages the 2D points in a given Array |
static javax.vecmath.Point3d |
averagePoint3ds(java.util.ArrayList<javax.vecmath.Point3d> points)
Averages the 3D points in an Array |
static javax.vecmath.Point3d |
averagePoints(javax.vecmath.Point3d a,
javax.vecmath.Point3d b)
Returns the average of two 3D points |
static java.util.ArrayList<FramePoint2d> |
changeFrameToZUpAndProjectToXYPlane(ReferenceFrame zUpFrame,
java.util.List<FramePoint> points)
|
static javax.vecmath.Point2d[] |
computeMinimumDistancePoints(ConvexPolygon2d polygon1,
ConvexPolygon2d polygon2)
|
static javax.vecmath.Point2d[] |
computeMinimumDistancePoints(ConvexPolygon2d polygon1,
ConvexPolygon2d polygon2,
double epsilon)
Finds the minimum distance between two convex polygons Taken from http://cygnus-x1.cs.duke.edu/~edels/Papers/1985-J-02-ComputingExtremeDistances.pdf |
static javax.media.j3d.Transform3D |
createTranslationTransform(javax.vecmath.Vector3d translation)
|
static double |
distanceBetweenPoints(double[] a,
double[] b)
Calculates distance between two Double points, a and b. |
static double |
distanceFromPointToLine(javax.vecmath.Point2d point,
javax.vecmath.Point2d lineStart,
javax.vecmath.Point2d lineEnd)
Returns the minimum distance between a 2D point and an infinitely long 2D line defined by a given line segment. |
static double |
distanceFromPointToLine(javax.vecmath.Point3d point,
javax.vecmath.Point3d lineStart,
javax.vecmath.Point3d lineEnd)
Compute the distance from a point to a line (defined by two 3D points). |
static double |
distanceFromPointToLineSegment(javax.vecmath.Point2d point,
javax.vecmath.Point2d lineStart,
javax.vecmath.Point2d lineEnd)
Returns the minimum distance between a point and a given line segment. |
static boolean |
doLineSegmentsIntersect(javax.vecmath.Point2d lineStart1,
javax.vecmath.Point2d lineEnd1,
javax.vecmath.Point2d lineStart2,
javax.vecmath.Point2d lineEnd2)
|
static javax.vecmath.Point3d |
generateRandomPoint3d(java.util.Random random,
double[] range1,
double[] range2)
Returns an evenly distributed random point3d. |
static double |
getAngleFromFirstToSecondVector(javax.vecmath.Vector2d firstVector,
javax.vecmath.Vector2d secondVector)
|
static void |
getClosestPointsForTwoLines(FramePoint point1,
FrameVector vector1,
FramePoint point2,
FrameVector vector2,
FramePoint pointOnLine1,
FramePoint pointOnLine2)
|
static javax.vecmath.Point2d |
getClosestPointToLineSegment(javax.vecmath.Point2d testPoint,
javax.vecmath.Point2d lineStart,
javax.vecmath.Point2d lineEnd)
Let the test point be C (Cx,Cy) and the line be AB (Ax,Ay) to (Bx,By). |
static FramePoint |
getIntersectionBetweenLineAndPlane(FramePoint pointOnPlane,
FrameVector planeNormal,
FramePoint lineStart,
FramePoint lineEnd)
Locates and returns the intersection between the given line and plane |
static javax.vecmath.Point2d |
getIntersectionBetweenTwoLines(javax.vecmath.Point2d lineStart1,
javax.vecmath.Point2d lineEnd1,
javax.vecmath.Point2d lineStart2,
javax.vecmath.Point2d lineEnd2)
|
static javax.vecmath.Point2d |
getIntersectionBetweenTwoLines(javax.vecmath.Point2d point1,
javax.vecmath.Vector2d vector1,
javax.vecmath.Point2d point2,
javax.vecmath.Vector2d vector2)
Finds the intersection between two 2D lines. |
static double[] |
getLineSegmentPercentagesIfIntersecting(javax.vecmath.Point2d lineStart1,
javax.vecmath.Point2d lineEnd1,
javax.vecmath.Point2d lineStart2,
javax.vecmath.Point2d lineEnd2)
Returns the line segment percentages of the intersection point between two lines if the lines are intersecting and not colinear. |
static javax.vecmath.Vector3d |
getNormalToPlane(javax.vecmath.Point3d a,
javax.vecmath.Point3d b,
javax.vecmath.Point3d c)
Returns the normal of a Plane specified by three points If 2 or more points are the same, returns NaN |
static javax.vecmath.Point2d |
getOrthogonalProjectionOnLine(javax.vecmath.Point2d testPoint,
javax.vecmath.Point2d lineStart,
javax.vecmath.Point2d lineEnd)
|
static void |
getPerpendicularBisector(javax.vecmath.Point2d lineStart,
javax.vecmath.Point2d lineEnd,
javax.vecmath.Point2d bisectorStart,
javax.vecmath.Vector2d bisectorDirection)
|
static javax.vecmath.Vector2d |
getPerpendicularVector(javax.vecmath.Vector2d vector)
|
static FrameVector |
getPerpendicularVectorFromLineToPoint(FramePoint point,
FramePoint lineStart,
FramePoint lineEnd,
FramePoint intersectionPoint)
Returns the Perpendicular Vector that is formed between a given Line (defined by two points) and a given point Returns zeros if point is located on the line |
static FrameVector |
getPlaneNormalGivenThreePoints(FramePoint point1,
FramePoint point2,
FramePoint point3)
Returns the Normal of a plane that is defined by three points Returns a null if three points are linear, colinear, or equal Returns a null if two points are the same |
static javax.vecmath.Vector3d |
getPlaneNormalGivenThreePoints(javax.vecmath.Point3d point1,
javax.vecmath.Point3d point2,
javax.vecmath.Point3d point3)
Converts three 3D points into 3 framePoints (defines a plane) Calls getPlaneNormalGivenThreePoints Returns normal to plane Returns null if three points are: linear colinear equal if 2 points are equal |
static javax.vecmath.Vector3d |
getProjectionOntoPlane(javax.vecmath.Vector3d p1,
javax.vecmath.Vector3d p2,
javax.vecmath.Vector3d p3,
javax.vecmath.Vector3d p)
|
static javax.vecmath.AxisAngle4d |
getRotationBasedOnNormal(javax.vecmath.Vector3d normalVector3d)
|
static FrameOrientation |
getTransform(FramePoint point,
FrameVector normal)
|
static javax.vecmath.Point2d |
getTriangleBisector(javax.vecmath.Point2d A,
javax.vecmath.Point2d B,
javax.vecmath.Point2d C)
This method returns the point representing where the bisector of an angle of a triangle intersects the opposite side. |
static double |
getUnknownTriangleAngleByLawOfCosine(double lengthNeighbourSideA,
double lengthNeighbourSideB,
double lengthOppositeSideC)
Calculate an unknown angle of a fully defined 2D Triangle by the law of Cosine |
static double |
getUnknownTriangleSideLengthByLawOfCosine(double lengthSideA,
double lengthSideB,
double angleBetweenAAndB)
Calculate an unknown side length of a fully defined 2D Triangle by the law of Cosine |
static java.util.ArrayList<javax.vecmath.Point3d> |
getVerticalSpansOfPoints(double xMin,
double yMin,
double zMin,
double xMax,
double yMax,
double zMax,
double xResolution,
double yResolution,
double zResolution)
|
static double |
getXYDistance(FramePoint point1,
FramePoint point2)
|
static double |
getXYDistance(javax.vecmath.Point3d point1,
javax.vecmath.Point3d point2)
|
static void |
getZPlanePerpendicularBisector(FramePoint lineStart,
FramePoint lineEnd,
FramePoint bisectorStart,
FrameVector bisectorDirection)
|
static double[] |
intersection(double firstPointX,
double firstPointY,
double firstVectorX,
double firstVectorY,
double secondPointX,
double secondPointY,
double secondVectorX,
double secondVectorY)
Finds the intersection parameters between two lines. |
static boolean |
isFormingTriangle(double lengthNeighbourSideA,
double lengthNeighbourSideB,
double lengthOppositeSideC)
|
static boolean |
isInsidePolygon(javax.vecmath.Point2d p,
java.util.ArrayList<javax.vecmath.Point2d> polygon)
|
static boolean |
isInsidePolygon(javax.vecmath.Point2d point,
javax.vecmath.Point2d[] orderedPolygonPoints)
Checks to make sure a point lies on the same side of the line for all lines going around a polygon; if true, then the point is inside the polygon. |
static boolean |
isInsidePolygon2(javax.vecmath.Point2d p,
javax.vecmath.Point2d[] polygon)
|
static boolean |
isPointOnLeftSideOfLine(FramePoint point,
FramePoint lineStart,
FramePoint lineEnd)
Returns a Boolean value stating whether a point is on the left side of a given line |
static boolean |
isPointOnLeftSideOfLine(javax.vecmath.Point2d point,
javax.vecmath.Point2d lineStart,
javax.vecmath.Point2d lineEnd)
Returns a boolean value, stating whether a 2D point is on the left side of a given line "Left side" is determined based on order of lineStart and lineEnd returns false if point is on line |
static double |
minimumDistance(FramePoint testPoint,
java.util.List<FramePoint> points)
|
static void |
movePointInsidePolygonAlongLine(FramePoint2d point,
FrameConvexPolygon2d polygon,
FrameLine2d line)
Deprecated. |
static void |
movePointInsidePolygonAlongLine(FramePoint2d point,
FrameConvexPolygon2d polygon,
FrameLine2d line,
double amountToBeInside)
Deprecated. |
static void |
movePointInsidePolygonAlongVector(FramePoint2d pointToMove,
FrameVector2d vector,
FrameConvexPolygon2d polygon,
double distanceToBeInside)
|
static void |
projectOntoPolygonAndCheckDistance(FramePoint2d point,
FrameConvexPolygon2d polygon,
double epsilon)
|
static java.util.ArrayList<FramePoint2d> |
projectToXYPlane(java.util.List<FramePoint> points)
|
static double |
pythagorasGetCathetus(double hypothenuseC,
double cathetusA)
Get a unknown cathetus (90-deg triangle one of the two shorter triangle sides, neighbouring the 90-degree angle) by Pythagoras law, a^2+b^2=c^2 |
static double |
pythagorasGetHypothenuse(double cathetusA,
double cathetusB)
Get the hypothenuse c (90-degree triangle longest triangle length, opposite to the 90-degree angle) by Pythagoras law, a^2+b^2=c^2 |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GeometryTools()
Method Detail |
---|
public static double distanceFromPointToLine(javax.vecmath.Point3d point, javax.vecmath.Point3d lineStart, javax.vecmath.Point3d lineEnd)
point
- Point3dlineStart
- Point3dlineEnd
- Point3d
public static double distanceFromPointToLine(javax.vecmath.Point2d point, javax.vecmath.Point2d lineStart, javax.vecmath.Point2d lineEnd)
point
- Point2dlineStart
- Point2dlineEnd
- Point2d
public static double distanceFromPointToLineSegment(javax.vecmath.Point2d point, javax.vecmath.Point2d lineStart, javax.vecmath.Point2d lineEnd)
point
- Point2dlineStart
- Point2dlineEnd
- Point2d
public static boolean isPointOnLeftSideOfLine(javax.vecmath.Point2d point, javax.vecmath.Point2d lineStart, javax.vecmath.Point2d lineEnd)
point
- Point2dlineStart
- Point2dlineEnd
- Point2d
public static boolean isPointOnLeftSideOfLine(FramePoint point, FramePoint lineStart, FramePoint lineEnd)
point
- FramePointlineStart
- FramePointlineEnd
- FramePoint
public static javax.vecmath.Point2d averagePoint2ds(java.util.ArrayList<javax.vecmath.Point2d> points)
points
- ArrayList
public static javax.vecmath.Point3d averagePoint3ds(java.util.ArrayList<javax.vecmath.Point3d> points)
points
- ArrayList
public static javax.vecmath.Point3d averagePoints(javax.vecmath.Point3d a, javax.vecmath.Point3d b)
a
- Point3db
- Point3d
public static boolean isInsidePolygon(javax.vecmath.Point2d point, javax.vecmath.Point2d[] orderedPolygonPoints)
point
- Point2dorderedPolygonPoints
- Point2d[]
public static boolean isInsidePolygon2(javax.vecmath.Point2d p, javax.vecmath.Point2d[] polygon)
p
- Point2dpolygon
- Point2d[]
public static boolean isInsidePolygon(javax.vecmath.Point2d p, java.util.ArrayList<javax.vecmath.Point2d> polygon)
public static javax.vecmath.Point2d getOrthogonalProjectionOnLine(javax.vecmath.Point2d testPoint, javax.vecmath.Point2d lineStart, javax.vecmath.Point2d lineEnd)
public static void getClosestPointsForTwoLines(FramePoint point1, FrameVector vector1, FramePoint point2, FrameVector vector2, FramePoint pointOnLine1, FramePoint pointOnLine2)
point1
- FramePointvector1
- FrameVectorpoint2
- FramePointvector2
- FrameVectorpointOnLine1
- FramePointpointOnLine2
- FramePointpublic static FramePoint getIntersectionBetweenLineAndPlane(FramePoint pointOnPlane, FrameVector planeNormal, FramePoint lineStart, FramePoint lineEnd)
pointOnPlane
- FramePointplaneNormal
- FrameVectorlineStart
- FramePointlineEnd
- FramePoint
public static boolean doLineSegmentsIntersect(javax.vecmath.Point2d lineStart1, javax.vecmath.Point2d lineEnd1, javax.vecmath.Point2d lineStart2, javax.vecmath.Point2d lineEnd2)
public static javax.vecmath.Point2d getIntersectionBetweenTwoLines(javax.vecmath.Point2d lineStart1, javax.vecmath.Point2d lineEnd1, javax.vecmath.Point2d lineStart2, javax.vecmath.Point2d lineEnd2)
public static javax.vecmath.Point2d getIntersectionBetweenTwoLines(javax.vecmath.Point2d point1, javax.vecmath.Vector2d vector1, javax.vecmath.Point2d point2, javax.vecmath.Vector2d vector2)
point1
- Start Point of first line.vector1
- Direction Vector of first line.point2
- Start Point of second line.vector2
- Direction Vector of second line.
public static double[] getLineSegmentPercentagesIfIntersecting(javax.vecmath.Point2d lineStart1, javax.vecmath.Point2d lineEnd1, javax.vecmath.Point2d lineStart2, javax.vecmath.Point2d lineEnd2)
lineStart1
- Point2dlineEnd1
- Point2dlineStart2
- Point2dlineEnd2
- Point2d
public static FrameVector getPlaneNormalGivenThreePoints(FramePoint point1, FramePoint point2, FramePoint point3)
point1
- FramePointpoint2
- FramePointpoint3
- FramePoint
public static FrameVector getPerpendicularVectorFromLineToPoint(FramePoint point, FramePoint lineStart, FramePoint lineEnd, FramePoint intersectionPoint)
point
- FramePointlineStart
- FramePointlineEnd
- FramePointintersectionPoint
- FramePoint
public static javax.vecmath.Vector2d getPerpendicularVector(javax.vecmath.Vector2d vector)
public static javax.vecmath.Vector3d getPlaneNormalGivenThreePoints(javax.vecmath.Point3d point1, javax.vecmath.Point3d point2, javax.vecmath.Point3d point3)
point1
- Point3dpoint2
- Point3dpoint3
- Point3d
public static void getZPlanePerpendicularBisector(FramePoint lineStart, FramePoint lineEnd, FramePoint bisectorStart, FrameVector bisectorDirection)
public static void getPerpendicularBisector(javax.vecmath.Point2d lineStart, javax.vecmath.Point2d lineEnd, javax.vecmath.Point2d bisectorStart, javax.vecmath.Vector2d bisectorDirection)
lineStart
- Point2dlineEnd
- Point2dbisectorStart
- Point2dbisectorDirection
- Vector2dpublic static javax.vecmath.AxisAngle4d getRotationBasedOnNormal(javax.vecmath.Vector3d normalVector3d)
public static FrameOrientation getTransform(FramePoint point, FrameVector normal)
public static javax.vecmath.Point2d getTriangleBisector(javax.vecmath.Point2d A, javax.vecmath.Point2d B, javax.vecmath.Point2d C)
A
- Point2dB
- Point2dC
- Point2d
public static double getAngleFromFirstToSecondVector(javax.vecmath.Vector2d firstVector, javax.vecmath.Vector2d secondVector)
public static double distanceBetweenPoints(double[] a, double[] b)
a
- double[]b
- double[]
public static javax.vecmath.Point2d getClosestPointToLineSegment(javax.vecmath.Point2d testPoint, javax.vecmath.Point2d lineStart, javax.vecmath.Point2d lineEnd)
public static double getXYDistance(FramePoint point1, FramePoint point2)
public static double getXYDistance(javax.vecmath.Point3d point1, javax.vecmath.Point3d point2)
public static java.util.ArrayList<javax.vecmath.Point3d> getVerticalSpansOfPoints(double xMin, double yMin, double zMin, double xMax, double yMax, double zMax, double xResolution, double yResolution, double zResolution)
xMin
- doubleyMin
- doublezMin
- doublexMax
- doubleyMax
- doublezMax
- doublexResolution
- doubleyResolution
- doublezResolution
- double
public static javax.vecmath.Vector3d getNormalToPlane(javax.vecmath.Point3d a, javax.vecmath.Point3d b, javax.vecmath.Point3d c)
a
- Point3db
- Point3dc
- Point3d
@Deprecated public static void movePointInsidePolygonAlongLine(FramePoint2d point, FrameConvexPolygon2d polygon, FrameLine2d line)
@Deprecated public static void movePointInsidePolygonAlongLine(FramePoint2d point, FrameConvexPolygon2d polygon, FrameLine2d line, double amountToBeInside)
public static void movePointInsidePolygonAlongVector(FramePoint2d pointToMove, FrameVector2d vector, FrameConvexPolygon2d polygon, double distanceToBeInside)
public static void projectOntoPolygonAndCheckDistance(FramePoint2d point, FrameConvexPolygon2d polygon, double epsilon)
public static boolean arePointsInOrderAndColinear(javax.vecmath.Point2d startPoint, javax.vecmath.Point2d middlePoint, javax.vecmath.Point2d endPoint, double epsilon)
startPoint
- Point2dmiddlePoint
- Point2dendPoint
- Point2d
public static boolean arePointsInOrderAndColinear(javax.vecmath.Point3d startPoint, javax.vecmath.Point3d middlePoint, javax.vecmath.Point3d endPoint, double epsilon)
startPoint
- Point3dmiddlePoint
- Point3dendPoint
- Point3d
public static double getUnknownTriangleSideLengthByLawOfCosine(double lengthSideA, double lengthSideB, double angleBetweenAAndB)
lengthSideA
- lengthSideB
- angleBetweenAAndB
- public static double getUnknownTriangleAngleByLawOfCosine(double lengthNeighbourSideA, double lengthNeighbourSideB, double lengthOppositeSideC)
lengthNeighbourSideA
- lengthNeighbourSideB
- lengthOppositeSideC
- public static double pythagorasGetCathetus(double hypothenuseC, double cathetusA)
hypothenuseC
- the longest sidecathetusA
- one short sidecathetusB
- the other short sidepublic static boolean isFormingTriangle(double lengthNeighbourSideA, double lengthNeighbourSideB, double lengthOppositeSideC)
public static double pythagorasGetHypothenuse(double cathetusA, double cathetusB)
cathetusA
- one short sidecathetusB
- the other short sidehypothenuseC
- the longest sidepublic static javax.vecmath.Vector3d getProjectionOntoPlane(javax.vecmath.Vector3d p1, javax.vecmath.Vector3d p2, javax.vecmath.Vector3d p3, javax.vecmath.Vector3d p)
public static javax.vecmath.Point3d generateRandomPoint3d(java.util.Random random, double[] range1, double[] range2)
random
- Random number generator.range1
- One side of the bounds for x, y, z.bounds2
- Other side of the bounds for x, y, z.
public static double[] intersection(double firstPointX, double firstPointY, double firstVectorX, double firstVectorY, double secondPointX, double secondPointY, double secondVectorX, double secondVectorY)
firstPointX
- double First line starting x.firstPointY
- double First line starting y.firstVectorX
- double First line direction x.firstVectorY
- double First line direction y.secondPointX
- double Second line starting x.secondPointY
- double Second line starting y.secondVectorX
- double Second line direction x.secondVectorY
- double Second line direction y.
public static double minimumDistance(FramePoint testPoint, java.util.List<FramePoint> points)
public static java.util.ArrayList<FramePoint2d> changeFrameToZUpAndProjectToXYPlane(ReferenceFrame zUpFrame, java.util.List<FramePoint> points)
public static java.util.ArrayList<FramePoint2d> projectToXYPlane(java.util.List<FramePoint> points)
public static javax.media.j3d.Transform3D createTranslationTransform(javax.vecmath.Vector3d translation)
public static javax.vecmath.Point2d[] computeMinimumDistancePoints(ConvexPolygon2d polygon1, ConvexPolygon2d polygon2, double epsilon)
public static javax.vecmath.Point2d[] computeMinimumDistancePoints(ConvexPolygon2d polygon1, ConvexPolygon2d polygon2)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |