Struct Plane
Infinite plane
struct Plane
;
Methods
Name | Description |
---|---|
distance
(p)
|
Get the distance from the center of the plane to the given point. This is useful for determining which side of the plane the point is on. |
intersectsLine
(p0, p1, t)
|
Calculate the intersection between this plane and a line If the plane and the line are parallel, false is returned |
opCall
()
|
Return a Plane with all values at zero |
opCall
(n, d)
|
Return a Plane with the Vec3f component of n and distance of d |
opCall
(x, y, z, d)
|
Return a Plane with a Vec3f component of x, y, z and distance of d |
Example
Plane plane = Plane(Vector3f(0, 1, 0), 0.0f);
assert(isConsiderZero(plane .distance(Vector3f(0, -1, 0)) + 1.0f));
float d = plane .dot(Vector3f(1, 0, 0));
assert(isConsiderZero(d));
assert(isAlmostZero(plane .position));
assert(plane .isOnPlane(Vector3f(0, 0, 0)));
float t;
assert(plane .intersectsLine(Vector3f(0, -1, 0), Vector3f(0, 1, 0), t));
assert(isConsiderZero(t - 0.5f));
Vector3f ip;
assert(plane .intersectsLineSegment(Vector3f(0, -1, 0), Vector3f(0, 1, 0), ip));