Package toxi.geom
Class Plane
java.lang.Object
toxi.geom.Vec3D
toxi.geom.Plane
- All Implemented Interfaces:
Comparable<ReadonlyVec3D>
,ReadonlyVec3D
,Shape3D
Class to describe and work with infinite generic 3D planes. Useful for
intersection problems and classifying points.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Classifier constant forclassifyPoint(ReadonlyVec3D, float)
Nested classes/interfaces inherited from class toxi.geom.Vec3D
Vec3D.Axis
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclassifyPoint
(ReadonlyVec3D p, float tolerance) Classifies the relative position of the given point to the plane using the given tolerance.boolean
Checks if the point is within the given shape/volume.float
float
Calculates distance from the plane to point P.Calculates the intersection point between plane and ray (line).float
Calculates the distance of the vector to the given plane in the specified direction.intersectsPlane
(Plane plane) Computes the intersection ray between this plane and the given one.toMesh
(float size) Creates a TriangleMesh representation of the plane as a finite, squared quad of the requested size, centred around the current plane point.toString()
Methods inherited from class toxi.geom.Vec3D
abs, add, add, add, addSelf, addSelf, addSelf, angleBetween, angleBetween, clear, compareTo, constrain, constrain, copy, cross, cross, crossInto, crossSelf, distanceTo, distanceToSquared, dot, dot, equals, equals, equalsWithTolerance, floor, frac, fromXYTheta, fromXZTheta, fromYZTheta, getAbs, getCartesian, getClosestAxis, getComponent, getComponent, getConstrained, getFloored, getFrac, getInverted, getLimited, getMapped, getNormalized, getNormalizedTo, getReciprocal, getReflected, getRotatedAroundAxis, getRotatedX, getRotatedY, getRotatedZ, getRoundedTo, getSignum, getSpherical, hashCode, headingXY, headingXZ, headingYZ, immutable, interpolateTo, interpolateTo, interpolateTo, interpolateTo, interpolateToSelf, interpolateToSelf, invert, isInAABB, isInAABB, isMajorAxis, isZeroVector, jitter, jitter, jitter, jitter, jitter, jitter, limit, magnitude, magSquared, max, maxSelf, min, minSelf, modSelf, modSelf, normalize, normalizeTo, randomVector, randomVector, reciprocal, reflect, rotateAroundAxis, rotateX, rotateY, rotateZ, roundTo, scale, scale, scale, scale, scaleSelf, scaleSelf, scaleSelf, scaleSelf, set, set, set, setComponent, setComponent, setX, setXY, setY, setZ, shuffle, signum, snapToAxis, sub, sub, sub, subSelf, subSelf, subSelf, to2DXY, to2DXZ, to2DYZ, to4D, to4D, toArray, toArray4, toCartesian, toSpherical, x, y, z
-
Field Details
-
XY
-
XZ
-
YZ
-
normal
-
-
Constructor Details
-
Plane
public Plane() -
Plane
-
Plane
-
-
Method Details
-
classifyPoint
Classifies the relative position of the given point to the plane using the given tolerance.- Returns:
- One of the 3 classification types: FRONT, BACK, ON_PLANE
-
containsPoint
Description copied from interface:Shape3D
Checks if the point is within the given shape/volume.- Specified by:
containsPoint
in interfaceShape3D
- Returns:
- true, if inside
-
getDCoeff
public float getDCoeff() -
getDistanceToPoint
Calculates distance from the plane to point P.- Parameters:
p
-- Returns:
- distance
-
getIntersectionWithRay
Calculates the intersection point between plane and ray (line).- Parameters:
r
-- Returns:
- intersection point or null if ray doesn't intersect plane
-
getProjectedPoint
-
intersectRayDistance
Calculates the distance of the vector to the given plane in the specified direction. A plane is specified by a 3D point and a normal vector perpendicular to the plane. Normalized directional vectors expected (for rayDir and planeNormal).- Parameters:
ray
- intersection ray- Returns:
- distance to plane in world units, -1 if no intersection.
-
intersectsPlane
Computes the intersection ray between this plane and the given one. If the planes are parallel or coincident the method returns null. If the planes are intersecting, the returnedRay3D
will start at a point lying on both planes and point along the infinite intersection line between them. Code ported from: http://forums.create.msdn.com/forums/p/39074/234178.aspx#234178- Parameters:
plane
- intersection partner- Returns:
- intersection ray or null
-
toMesh
Creates a TriangleMesh representation of the plane as a finite, squared quad of the requested size, centred around the current plane point.- Parameters:
size
- desired edge length- Returns:
- mesh
-
toMesh
-
toString
-