@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
71 lines (70 loc) • 2.26 kB
TypeScript
/**
* An infinite plane. Internally it's represented in a parametric equation form:
* ax + by + cz + distance = 0.
*
* @category Math
*/
export class Plane {
/**
* Create a new Plane instance.
*
* @param {Vec3} [normal] - Normal of the plane. The constructor copies this parameter. Defaults
* to {@link Vec3.UP}.
* @param {number} [distance] - The distance from the plane to the origin, along its normal.
* Defaults to 0.
*/
constructor(normal?: Vec3, distance?: number);
/**
* The normal of the plane.
*
* @type {Vec3}
*/
normal: Vec3;
/**
* The distance from the plane to the origin, along its normal.
*
* @type {number}
*/
distance: number;
/**
* Sets the plane based on a specified normal and a point on the plane.
*
* @param {Vec3} point - The point on the plane.
* @param {Vec3} normal - The normal of the plane.
* @returns {Plane} Self for chaining.
*/
setFromPointNormal(point: Vec3, normal: Vec3): Plane;
/**
* Test if the plane intersects between two points.
*
* @param {Vec3} start - Start position of line.
* @param {Vec3} end - End position of line.
* @param {Vec3} [point] - If there is an intersection, the intersection point will be copied
* into here.
* @returns {boolean} True if there is an intersection.
*/
intersectsLine(start: Vec3, end: Vec3, point?: Vec3): boolean;
/**
* Test if a ray intersects with the infinite plane.
*
* @param {import('./ray.js').Ray} ray - Ray to test against (direction must be normalized).
* @param {Vec3} [point] - If there is an intersection, the intersection point will be copied
* into here.
* @returns {boolean} True if there is an intersection.
*/
intersectsRay(ray: import("./ray.js").Ray, point?: Vec3): boolean;
/**
* Copies the contents of a source Plane.
*
* @param {Plane} src - The Plane to copy from.
* @returns {Plane} Self for chaining.
*/
copy(src: Plane): Plane;
/**
* Returns a clone of the Plane.
*
* @returns {this} A duplicate Plane.
*/
clone(): this;
}
import { Vec3 } from '../math/vec3.js';