Ray
Parametrically defined ray used in ray casting functions.
Static Members
Create ray representing a line segment.
This function will a ray who's origin is the start point
and who's direction is towards the end point with the
maxDistance property appropriately set to not extend
beyond the end point.
Name | Type | Description |
---|---|---|
start |
Vec2 | Start point of line segment |
end |
Vec2 | End point of line segment |
Returns | Description |
---|---|
Ray | A Ray representing this line segment. |
Instance Members
@private
Dynamic object for user to store additional data.
This object cannot be set, only its dynamically created
properties may be set. In AS3 the type of this property is *
This object will be lazily constructed so that until accessed
for the first time, will be null internally.
@default {}
Origin of ray.
This property can be set, and is equivalent to performing:
ray.origin.set(newOrigin)
Direction of ray.
This property can be set, and is equivalent to performing:
ray.direction.set(newDirection)
with the additional
constraint that the input direction must not be degenerate.
This direction vector need not be normalised.
The maximum distance for ray to be queried.
When used in ray test functions, no search will extend beyond this
distance.
This value represents a true distance, even if direction vector is
not normalised. This value may be equal to infinity.
@default infinity
Compute bounding box of ray.
This function will take into account the maxDistance property of this ray.
The return AABB may have in the general case infinite values :)
Returns | Description |
---|---|
AABB | An AABB representing bounding box of ray. |
Compute point along ray at given distance.
Even if ray direction is not normalised, this value still repersents
a true distance. The distance may also be negative.
The Vec2 returned will be allocated from the global object pool.
Name | Type | Default | Description |
---|---|---|---|
distance |
Float | The distance along ray to compute point for. | |
weak |
Bool | false |
If true then a weakly allocated Vec2 will be returned which will be automatically released to global object pool when used as argument to another Nape function. (default false) |
Returns | Description |
---|---|
Vec2 | Vec2 representing point at given distance along ray. |
Produce a copy of this ray.
All ray properties will be copied including maxDistance.
Returns | Description |
---|---|
Ray | The copy of this Ray. |
Construct new Ray.
Name | Type | Description |
---|---|---|
origin |
Vec2 | Origin of ray. |
direction |
Vec2 | Direction of ray. |
Private Members
Metadata
Name | Parameters |
---|---|
:final |
- |