java.lang.Object
uk.ac.leeds.ccg.v3d.core.V3D_Object
uk.ac.leeds.ccg.v3d.geometry.V3D_Geometry
uk.ac.leeds.ccg.v3d.geometry.V3D_Plane
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
V3D_Rectangle,V3D_Triangle
public class V3D_Plane extends V3D_Geometry
V3D_Plane - for representing infinite flat 2D planes in 3D. The plane is
defined by three points
p, q and r that are not
collinear, or from any point on the plane and a normal vector that is
perpendicular to the plane. From three points that are not collinear an
equation of the plane can be derived by creating two V3D_Vectors pq
and pr. The equation of the plane is:
- A*(x-x0) + B*(y-y0) + C*(z-z0) = 0
- A*(x) + B*(y) + C*(z) - D = 0 where D = -(A*x0 + B*y0 + C*z0)
- x, y, and z are any of the coordinates in
p,qandr - x0, y0 and z0 represents any other point in the plane
A = pq.dy.multiply(pr.dz).subtract(pr.dy.multiply(pq.dz))- which is the dx of the normal vector (that is perpendicular to the plane).B = (pq.dx.multiply(pr.dz).subtract(pr.dx.multiply(pq.dz))).negate()- which is the dy of the normal vector.C = pq.dx.multiply(pr.dy).subtract(pr.dx.multiply(pq.dy))- which is the dz of the normal vector.
- n.dx(x(t)−p.x)+n.dy(y(t)−p.y)+n.dz(z(t)−p.z) = 0
- n.dx(x(t)−q.x)+n.dy(y(t)−q.y)+n.dz(z(t)−q.z) = 0
- n.dx(x(t)−r.x)+n.dy(y(t)−r.y)+n.dz(z(t)−r.z) = 0
- Version:
- 1.0
- Author:
- Andy Turner
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected V3D_VectornThe normal vector.protected V3D_PointpOne of the points that defines the plane.protected V3D_Vectorpqprotected V3D_Vectorprprotected V3D_PointqOne of the points that defines the plane.protected V3D_PointrOne of the points that defines the plane. -
Constructor Summary
Constructors Constructor Description V3D_Plane(V3D_Point p, V3D_Point q, V3D_Point r)This assumes that p, q and r are not collinear or that this is called in the construction of an envelope face which can effectively be a line segment or a point.V3D_Plane(V3D_Point p, V3D_Point q, V3D_Point r, boolean checkCollinearity)V3D_Plane(V3D_Point p, V3D_Vector n)An equation of the plane containing the pointpwith normal vectornisn.dx(x) + n.dy(y) + n.dz(z) = d. -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object o)V3D_GeometrygetIntersection(V3D_Line l)V3D_GeometrygetIntersection(V3D_LineSegment l, boolean flag)V3D_GeometrygetIntersection(V3D_Plane pl)static V3D_GeometrygetIntersection(V3D_Plane pl, V3D_Line l)inthashCode()booleanisIntersectedBy(V3D_Line l)booleanisIntersectedBy(V3D_Plane pl)booleanisIntersectedBy(V3D_Point pt)booleanisOnPlane(V3D_Line l)booleanisParallel(V3D_Line l)booleanisParallel(V3D_Plane p)java.lang.StringtoString()
-
Field Details
-
Constructor Details
-
Method Details
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
isIntersectedBy
- Parameters:
pl- The plane to test for intersection with this.- Returns:
trueIf this andplintersect.
-
isIntersectedBy
- Parameters:
l- The line to test for intersection with this.- Returns:
trueIf this andlintersect.
-
isIntersectedBy
- Parameters:
pt- The point to test if it is on the plane.- Returns:
trueIfptis on the plane.
-
isOnPlane
- Parameters:
l- The line segment to test if it is on the plane.- Returns:
trueIfptis on the plane.
-
getIntersection
- Parameters:
pl- The plane to intersect with the line.l- The line to intersect with the plane.- Returns:
- The intersection of the line and the plane. This is either
nulla line or a point.
-
getIntersection
- Parameters:
l- line to intersect with this.- Returns:
- The intersection between
thisandl.
-
getIntersection
- Parameters:
l- line segment to intersect with this.flag- Used to distinguish fromgetIntersection(V3D_Line).- Returns:
- The intersection between
thisandl.
-
getIntersection
- Parameters:
pl- The plane to intersect.- Returns:
- The intersection between
thisandpl
-
isParallel
- Parameters:
p- The plane to test if it is parallel to this.- Returns:
trueifthisis parallel top.
-
isParallel
- Parameters:
l- The line to test if it is parallel to this.- Returns:
trueifthisis parallel tol.
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-