Ray
A ray.
Constructor Summary
Public Constructor | ||
public |
constructor(origin: Vector3, direction: Vector3) Constructs a new ray. |
Member Summary
Public Members | ||
public |
The direction. |
|
public |
The origin. |
Method Summary
Public Methods | ||
public |
applyMatrix4(m: Matrix4): Ray Applies the given matrix to this ray. |
|
public |
Computes a point along the ray based on a given scalar t. |
|
public |
Clones this ray. |
|
public |
closestPointToPoint(p: Vector3, target: Vector3): Vector3 Finds the closest point along this ray to a given point. |
|
public |
Copies the given ray. |
|
public |
Calculates the squared distance from this ray to the given point. |
|
public |
distanceSquaredToSegment(v0: Vector3, v1: Vector3, pointOnRay: Vector3, pointOnSegment: Vector3): Number Calculates the distance from this ray to a given line segment. |
|
public |
distanceToPlane(p: Plane): Number Calculates the distance from this ray to the given plane. |
|
public |
distanceToPoint(p: Vector3): Number Calculates the distance from this ray to the given point. |
|
public |
Checks if this ray equals the given one. |
|
public |
intersectBox(b: Plane, target: Vector3): Vector3 Finds the point where this ray intersects the given box. |
|
public |
intersectPlane(p: Plane, target: Vector3): Vector3 Finds the point where this ray intersects the given plane. |
|
public |
intersectSphere(s: Sphere, target: Vector3): Vector3 Finds the point where this ray intersects the given sphere. |
|
public |
intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: Boolean, target: Vector3): Vector3 Finds the point where this ray intersects the given triangle. |
|
public |
intersectsBox(b: Box3): Boolean Determines whether this ray intersects the given box. |
|
public |
intersectsPlane(p: Plane): Boolean Determines whether this ray intersects the given plane. |
|
public |
Determines whether this ray intersects the given sphere. |
|
public |
Rotates this ray to look at the given target. |
|
public |
Moves the origin along the ray by a given scalar t. |
|
public |
Sets the origin and the direction. |
Public Constructors
Public Members
Public Methods
public applyMatrix4(m: Matrix4): Ray source
Applies the given matrix to this ray.
Params:
Name | Type | Attribute | Description |
m | Matrix4 | A matrix. |
public at(t: Number, target: Vector3): Vector3 source
Computes a point along the ray based on a given scalar t.
public closestPointToPoint(p: Vector3, target: Vector3): Vector3 source
Finds the closest point along this ray to a given point.
public copy(r: Ray): Ray source
Copies the given ray.
Params:
Name | Type | Attribute | Description |
r | Ray | A ray. |
public distanceSquaredToPoint(p: Vector3): Number source
Calculates the squared distance from this ray to the given point.
Params:
Name | Type | Attribute | Description |
p | Vector3 | The point. |
public distanceSquaredToSegment(v0: Vector3, v1: Vector3, pointOnRay: Vector3, pointOnSegment: Vector3): Number source
Calculates the distance from this ray to a given line segment.
Based on: http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h
Params:
Name | Type | Attribute | Description |
v0 | Vector3 | The start of the segment. |
|
v1 | Vector3 | The end of the segment. |
|
pointOnRay | Vector3 |
|
If provided, the point on this Ray that is closest to the segment will be stored in this vector. |
pointOnSegment | Vector3 |
|
If provided, the point on the line segment that is closest to this ray will be stored in this vector. |
public distanceToPlane(p: Plane): Number source
Calculates the distance from this ray to the given plane.
Params:
Name | Type | Attribute | Description |
p | Plane | The plane. |
public distanceToPoint(p: Vector3): Number source
Calculates the distance from this ray to the given point.
Params:
Name | Type | Attribute | Description |
p | Vector3 | The point. |
public equals(r: Ray): Boolean source
Checks if this ray equals the given one.
Params:
Name | Type | Attribute | Description |
r | Ray | A ray. |
public intersectBox(b: Plane, target: Vector3): Vector3 source
Finds the point where this ray intersects the given box.
public intersectPlane(p: Plane, target: Vector3): Vector3 source
Finds the point where this ray intersects the given plane.
public intersectSphere(s: Sphere, target: Vector3): Vector3 source
Finds the point where this ray intersects the given sphere.
public intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: Boolean, target: Vector3): Vector3 source
Finds the point where this ray intersects the given triangle.
Based on: http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h
Params:
Name | Type | Attribute | Description |
a | Vector3 | A triangle vertex. |
|
b | Vector3 | A triangle vertex. |
|
c | Vector3 | A triangle vertex. |
|
backfaceCulling | Boolean |
|
Whether backface culling should be considered. |
target | Vector3 |
|
A target vector. If none is provided, a new one will be created. |
public intersectsBox(b: Box3): Boolean source
Determines whether this ray intersects the given box.
Params:
Name | Type | Attribute | Description |
b | Box3 | A box. |
public intersectsPlane(p: Plane): Boolean source
Determines whether this ray intersects the given plane.
Params:
Name | Type | Attribute | Description |
p | Plane | A plane. |
public intersectsSphere(s: Sphere): Boolean source
Determines whether this ray intersects the given sphere.
Params:
Name | Type | Attribute | Description |
s | Sphere | A sphere. |
public lookAt(target: Vector3): Ray source
Rotates this ray to look at the given target.
Params:
Name | Type | Attribute | Description |
target | Vector3 | A point to look at. |