Package com.irurueta.geometry
Class Line3D
java.lang.Object
com.irurueta.geometry.Line3D
- All Implemented Interfaces:
Serializable
This class defines a lines in 3D space.
A line in 3D space is defined as the intersection of two non-parallel planes.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doublePositive threshold determine whether points lay inside (is locus) of a given line or not.private static final intConstant defining the size of vector that define the direction of a linestatic final doubleMinimum allowed thresholdprivate Plane1st plane forming this 3D line.private Plane2nd plane forming this 3D line. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareCoincidentPlanes(Plane plane1, Plane plane2) Determines whether provided planes are coincident.voidclosestPoint(Point3D point, Point3D result) Computes closest point belonging to this 3D line respect provided point and stores the result in provided instance.voidclosestPoint(Point3D point, Point3D result, double threshold) Computes closest point belonging to this 3D line respect provided point up to provided threshold and stores the result in provided instance.getClosestPoint(Point3D point) Returns closest point belonging to this 3D line respect provided point.getClosestPoint(Point3D point, double threshold) Returns closest point belonging to this 3D line respect provided point up to provided threshold.double[]Returns array containing vector that indicates the direction of this 3D line.doublegetDistance(Point3D point) Returns shortest distance of provided point to this 3D line.getIntersection(Plane plane) Returns point where provided point intersects this 3D line.Returns 1st plane determining this 3D line.Returns 2nd plane determining this 3D line.voidintersection(Plane plane, Point3D result) Computes point where provided point intersects this 3D line and stores the result in provided instance.booleanRaised if provided point is locus of this 3D line.booleanDetermines if provided point is locus of this 3D line up to provided threshold.booleanDetermines whether the planes forming this 3D line are normalized or not.voidNormalize the planes forming this 3D line.final voidSets intersecting planes for this 3D line.final voidsetPlanesFromPoints(Point3D point1, Point3D point2) Sets planes of this 3D line so that it passes through provided points.
-
Field Details
-
DEFAULT_LOCUS_THRESHOLD
public static final double DEFAULT_LOCUS_THRESHOLDPositive threshold determine whether points lay inside (is locus) of a given line or not.- See Also:
-
MIN_THRESHOLD
public static final double MIN_THRESHOLDMinimum allowed threshold- See Also:
-
INHOM_VECTOR_SIZE
private static final int INHOM_VECTOR_SIZEConstant defining the size of vector that define the direction of a line- See Also:
-
plane1
1st plane forming this 3D line. -
plane2
2nd plane forming this 3D line.
-
-
Constructor Details
-
Line3D
Constructor. Sets planes intersecting into this 3D line.- Parameters:
plane1- 1st plane.plane2- 2nd plane.- Throws:
CoincidentPlanesException- Raised if provided planes are coincident and hence never intersect. Notice that parallel planes are not coincident and they intersect at infinity.
-
Line3D
Constructor. Builds a 3D line passing through provided 2 points.- Parameters:
point1- 1st point.point2- 2nd point.- Throws:
CoincidentPointsException- Raised if provided points are considered to be equal.
-
-
Method Details
-
areCoincidentPlanes
Determines whether provided planes are coincident. Two planes are considered coincident if they are equal up to scale.- Parameters:
plane1- 1st plane.plane2- 2nd plane.- Returns:
- True if planes are coincident, false otherwise.
-
setPlanes
Sets intersecting planes for this 3D line. The intersection of provided planes will determine this 3D line.- Parameters:
plane1- 1st plane.plane2- 2nd plane.- Throws:
CoincidentPlanesException- Raised if provided planes are coincident. Notice that parallel planes are not coincident and they intersect at infinity.
-
setPlanesFromPoints
public final void setPlanesFromPoints(Point3D point1, Point3D point2) throws CoincidentPointsException Sets planes of this 3D line so that it passes through provided points.- Parameters:
point1- 1st point.point2- 2nd point.- Throws:
CoincidentPointsException- Raised if provided points are equal and hence a line cannot be determined.
-
getPlane1
Returns 1st plane determining this 3D line. The intersection of plane1 and plane2 determines this 3D line.- Returns:
- 1st plane.
-
getPlane2
Returns 2nd plane determining this 3D line. The intersection of plane1 and plane2 determines this 3D line.- Returns:
- 2nd plane.
-
isLocus
Determines if provided point is locus of this 3D line up to provided threshold.- Parameters:
point- Point to be checked.threshold- Threshold to determine if provided point is locus or not. This should usually be a small value.- Returns:
- True if provided point belongs to this 3D line, false otherwise.
- Throws:
IllegalArgumentException- Raised if provided threshold is negative.
-
isLocus
Raised if provided point is locus of this 3D line.- Parameters:
point- Point to be checked.- Returns:
- True if provided point belongs to this 3D line, false otherwise.
-
getDistance
Returns shortest distance of provided point to this 3D line. The shortest distance is obtained in perpendicular direction of this line.- Parameters:
point- Point to be checked.- Returns:
- Shortest distance of provided point to this 3D line.
-
getClosestPoint
Returns closest point belonging to this 3D line respect provided point.- Parameters:
point- Point to be checked.- Returns:
- Closest point belonging to this 3D line respect provided point.
-
getClosestPoint
Returns closest point belonging to this 3D line respect provided point up to provided threshold.- Parameters:
point- Point to be checked.threshold- Threshold to determine the closest point.- Returns:
- Closest point belonging to this 3D line respect provided point.
- Throws:
IllegalArgumentException- Raised if provided threshold is negative.
-
closestPoint
Computes closest point belonging to this 3D line respect provided point and stores the result in provided instance.- Parameters:
point- Point to be checked.result- Instance where computed point will be stored.
-
closestPoint
Computes closest point belonging to this 3D line respect provided point up to provided threshold and stores the result in provided instance.- Parameters:
point- Point to be checked.result- Instance where computed point will be stored.threshold- Threshold to determine the closest point.- Throws:
IllegalArgumentException- Raised if provided threshold is negative.
-
normalize
public void normalize()Normalize the planes forming this 3D line. -
isNormalized
public boolean isNormalized()Determines whether the planes forming this 3D line are normalized or not.- Returns:
- True if planes forming this 3D line are normalized, false otherwise.
-
getDirection
public double[] getDirection()Returns array containing vector that indicates the direction of this 3D line.- Returns:
- Returns vector indicating the direction of this 3D line.
-
getIntersection
Returns point where provided point intersects this 3D line.- Parameters:
plane- Plane to intersect this 3D line.- Returns:
- Point where provided point intersects this 3D line.
- Throws:
NoIntersectionException- Raised if provided plane does not intersect this 3D line.
-
intersection
Computes point where provided point intersects this 3D line and stores the result in provided instance.- Parameters:
plane- Plane to intersect this 3D line.result- Instance where computes point will be stored.- Throws:
NoIntersectionException- Raised if provided plane does not intersect this 3D line.
-