Class Plane
- All Implemented Interfaces:
Embedding<Euclidean3D,,Vector3D, Euclidean2D, Vector2D> Hyperplane<Euclidean3D,Vector3D, Plane, SubPlane>
-
Constructor Summary
ConstructorsConstructorDescriptionCopy constructor.Build a plane normal to a given direction and containing the origin.Build a plane from a point and a normal.Build a plane from three points. -
Method Summary
Modifier and TypeMethodDescriptionGet an arbitrary point in the hyperplane.booleanCheck if the instance contains a point.copySelf()Copy the instance.Build a sub-hyperplane covering nothing.Get the normalized normal vector.doubleGet the offset (oriented distance) of a parallel plane.doubleGet the offset (oriented distance) of a point.Get the origin point of the plane frame.getPointAt(Vector2D inPlane, double offset) Get one point from the 3D-space.doubleGet the tolerance below which points are considered to belong to the hyperplane.getU()Get the plane first canonical vector.getV()Get the plane second canonical vector.intersection(Line line) Get the intersection of a line with the instance.intersection(Plane other) Build the line shared by the instance and another plane.static Vector3Dintersection(Plane plane1, Plane plane2, Plane plane3) Get the intersection point of three planes.booleanisSimilarTo(Plane plane) Check if the instance is similar to another plane.moveToOffset(Vector3D point, double offset) Move point up to specified offset.Project a point to the hyperplane.voidReset the instance from another one.voidReset the instance as if built from a point and a normal.voidRevert the plane.Rotate the plane around the specified point.booleansameOrientationAs(Plane other) Check if the instance has the same orientation as another hyperplane.Transform an in-plane point into a 3D space point.toSubSpace(Vector3D point) Transform a 3D space point into an in-plane point.Translate the plane by the specified amount.Build a region covering the whole hyperplane.Build a region covering the whole space.
-
Constructor Details
-
Plane
Build a plane normal to a given direction and containing the origin.- Parameters:
normal- normal direction to the planetolerance- tolerance below which points are considered identical- Throws:
MathRuntimeException- if the normal norm is too small
-
Plane
Build a plane from a point and a normal.- Parameters:
p- point belonging to the planenormal- normal direction to the planetolerance- tolerance below which points are considered identical- Throws:
MathRuntimeException- if the normal norm is too small
-
Plane
Build a plane from three points.The plane is oriented in the direction of
(p2-p1) ^ (p3-p1)- Parameters:
p1- first point belonging to the planep2- second point belonging to the planep3- third point belonging to the planetolerance- tolerance below which points are considered identical- Throws:
MathRuntimeException- if the points do not constitute a plane
-
Plane
Copy constructor.The instance created is completely independent of the original one. A deep copy is used, none of the underlying object are shared.
- Parameters:
plane- plane to copy
-
-
Method Details
-
copySelf
Copy the instance.The instance created is completely independant of the original one. A deep copy is used, none of the underlying objects are shared (except for immutable objects).
- Specified by:
copySelfin interfaceHyperplane<Euclidean3D,Vector3D, Plane, SubPlane> - Returns:
- a new hyperplane, copy of the instance
-
reset
Reset the instance as if built from a point and a normal.- Parameters:
p- point belonging to the planenormal- normal direction to the plane- Throws:
MathRuntimeException- if the normal norm is too small
-
reset
Reset the instance from another one.The updated instance is completely independant of the original one. A deep reset is used none of the underlying object is shared.
- Parameters:
original- plane to reset from
-
getOrigin
Get the origin point of the plane frame.The point returned is the orthogonal projection of the 3D-space origin in the plane.
- Returns:
- the origin point of the plane frame (point closest to the 3D-space origin)
-
getNormal
Get the normalized normal vector.The frame defined by (
getU(),getV(),getNormal()) is a right-handed orthonormalized frame).- Returns:
- normalized normal vector
- See Also:
-
getU
Get the plane first canonical vector.The frame defined by (
getU(),getV(),getNormal()) is a right-handed orthonormalized frame).- Returns:
- normalized first canonical vector
- See Also:
-
getV
Get the plane second canonical vector.The frame defined by (
getU(),getV(),getNormal()) is a right-handed orthonormalized frame).- Returns:
- normalized second canonical vector
- See Also:
-
project
Project a point to the hyperplane.- Specified by:
projectin interfaceHyperplane<Euclidean3D,Vector3D, Plane, SubPlane> - Parameters:
point- point to project- Returns:
- projected point
-
getTolerance
public double getTolerance()Get the tolerance below which points are considered to belong to the hyperplane.- Specified by:
getTolerancein interfaceHyperplane<Euclidean3D,Vector3D, Plane, SubPlane> - Returns:
- tolerance below which points are considered to belong to the hyperplane
-
revertSelf
public void revertSelf()Revert the plane.Replace the instance by a similar plane with opposite orientation.
The new plane frame is chosen in such a way that a 3D point that had
(x, y)in-plane coordinates andzoffset with respect to the plane and is unaffected by the change will have(y, x)in-plane coordinates and-zoffset with respect to the new plane. This means that theuandvvectors returned by thegetU()andgetV()methods are exchanged, and thewvector returned by thegetNormal()method is reversed. -
toSubSpace
Transform a 3D space point into an in-plane point.- Specified by:
toSubSpacein interfaceEmbedding<Euclidean3D,Vector3D, Euclidean2D, Vector2D> - Parameters:
point- point of the space (must be aVector3Dinstance)- Returns:
- in-plane point (really a
Vector2Dinstance) - See Also:
-
toSpace
Transform an in-plane point into a 3D space point.- Specified by:
toSpacein interfaceEmbedding<Euclidean3D,Vector3D, Euclidean2D, Vector2D> - Parameters:
point- in-plane point (must be aVector2Dinstance)- Returns:
- 3D space point (really a
Vector3Dinstance) - See Also:
-
getPointAt
Get one point from the 3D-space.- Parameters:
inPlane- desired in-plane coordinates for the point in the planeoffset- desired offset for the point- Returns:
- one point in the 3D-space, with given coordinates and offset relative to the plane
-
isSimilarTo
Check if the instance is similar to another plane.Planes are considered similar if they contain the same points. This does not mean they are equal since they can have opposite normals.
- Parameters:
plane- plane to which the instance is compared- Returns:
- true if the planes are similar
-
rotate
Rotate the plane around the specified point.The instance is not modified, a new instance is created.
- Parameters:
center- rotation centerrotation- vectorial rotation operator- Returns:
- a new plane
-
translate
Translate the plane by the specified amount.The instance is not modified, a new instance is created.
- Parameters:
translation- translation to apply- Returns:
- a new plane
-
intersection
Get the intersection of a line with the instance.- Parameters:
line- line intersecting the instance- Returns:
- intersection point between between the line and the instance (null if the line is parallel to the instance)
-
intersection
Build the line shared by the instance and another plane.- Parameters:
other- other plane- Returns:
- line at the intersection of the instance and the
other plane (really a
Lineinstance)
-
intersection
Get the intersection point of three planes.- Parameters:
plane1- first plane1plane2- second plane2plane3- third plane2- Returns:
- intersection point of three planes, null if some planes are parallel
-
wholeHyperplane
Build a region covering the whole hyperplane.- Specified by:
wholeHyperplanein interfaceHyperplane<Euclidean3D,Vector3D, Plane, SubPlane> - Returns:
- a region covering the whole hyperplane
-
emptyHyperplane
Build a sub-hyperplane covering nothing.- Specified by:
emptyHyperplanein interfaceHyperplane<Euclidean3D,Vector3D, Plane, SubPlane> - Returns:
- a sub-hyperplane covering nothing
-
wholeSpace
Build a region covering the whole space.- Specified by:
wholeSpacein interfaceHyperplane<Euclidean3D,Vector3D, Plane, SubPlane> - Returns:
- a region containing the instance (really a
PolyhedronsSetinstance)
-
contains
Check if the instance contains a point.- Parameters:
p- point to check- Returns:
- true if p belongs to the plane
-
getOffset
Get the offset (oriented distance) of a parallel plane.This method should be called only for parallel planes otherwise the result is not meaningful.
The offset is 0 if both planes are the same, it is positive if the plane is on the plus side of the instance and negative if it is on the minus side, according to its natural orientation.
- Parameters:
plane- plane to check- Returns:
- offset of the plane
-
getOffset
Get the offset (oriented distance) of a point.The offset is 0 if the point is on the underlying hyperplane, it is positive if the point is on one particular side of the hyperplane, and it is negative if the point is on the other side, according to the hyperplane natural orientation.
- Specified by:
getOffsetin interfaceHyperplane<Euclidean3D,Vector3D, Plane, SubPlane> - Parameters:
point- point to check- Returns:
- offset of the point
-
moveToOffset
Move point up to specified offset.Motion is orthogonal to the hyperplane
- Specified by:
moveToOffsetin interfaceHyperplane<Euclidean3D,Vector3D, Plane, SubPlane> - Parameters:
point- point to moveoffset- desired offset- Returns:
- moved point at desired offset
-
arbitraryPoint
Get an arbitrary point in the hyperplane.- Specified by:
arbitraryPointin interfaceHyperplane<Euclidean3D,Vector3D, Plane, SubPlane> - Returns:
- arbirary point in the hyperplane
-
sameOrientationAs
Check if the instance has the same orientation as another hyperplane.- Specified by:
sameOrientationAsin interfaceHyperplane<Euclidean3D,Vector3D, Plane, SubPlane> - Parameters:
other- other hyperplane to check against the instance- Returns:
- true if the instance and the other hyperplane have the same orientation
-