Plane

open class Plane

Represents a plane in Cartesian coordinates. The plane's X, Y and Z components indicate the plane's normal vector. The distance component indicates the plane's distance from the origin relative to its unit normal.

Constructors

Link copied to clipboard
constructor()

Constructs a plane in the X-Y plane with its unit normal pointing along the Z axis.

constructor(x: Double, y: Double, z: Double, distance: Double)

Constructs a plane with specified normal vector components and distance from the origin. This constructor normalizes the components, ensuring that the plane has a unit normal vector.

constructor(plane: Plane)

Constructs a plane with the normal vector and distance from a specified plane.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The plane's distance from the origin.

Link copied to clipboard

The normal vector to the plane.

Functions

Link copied to clipboard
fun clip(pointA: Vec3, pointB: Vec3): Array<Vec3>?

Clips a line segment to this plane, returning an two-point array indicating the clipped segment. If the direction of the line formed by the two points is positive with respect to this plane's normal vector, the first point in the array will be the intersection point on the plane, and the second point will be the original segment end point. If the direction of the line is negative with respect to this plane's normal vector, the first point in the array will be the original segment's begin point, and the second point will be the intersection point on the plane. If the segment does not intersect the plane, null is returned. If the segment is coincident with the plane, the input points are returned, in their input order.

Link copied to clipboard
fun copy(plane: Plane): Plane

Sets this plane's normal vector and distance to that of a specified plane.

Link copied to clipboard

Computes the distance between this plane and a point.

Link copied to clipboard
fun dot(vector: Vec3): Double

Computes the dot product of this plane's components with a specified vector. Since the plane was defined with a unit normal vector, this function returns the distance of the vector from the plane.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun intersectsSegment(endPoint1: Vec3, endPoint2: Vec3): Boolean

Determines whether a specified line segment intersects this plane.

Link copied to clipboard
fun onSameSide(pointA: Vec3, pointB: Vec3): Int

Determines whether two points are on the same side of this plane.

Link copied to clipboard
fun set(x: Double, y: Double, z: Double, distance: Double): Plane

Sets this plane's specified normal vector and distance to specified values. This normalizes the components, ensuring that the plane has a unit normal vector.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Transforms this plane by a specified matrix.