Ray

nape.geom.Ray (final class)

Parametrically defined ray used in ray casting functions.

Static Members

nape
fromSegment(start: Vec2, end: Vec2): Ray

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

nape
zpp_inner: zpp_nape.geom.ZPP_Ray

@private


nape
userData: Dynamic

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 &#42

This object will be lazily constructed so that until accessed for the first time, will be null internally.

@default {}


nape
origin: Vec2

Origin of ray.

This property can be set, and is equivalent to performing: ray.origin.set(newOrigin)


nape
direction: Vec2

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.


nape
maxDistance: Float

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


nape
aabb(): AABB

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.

nape
at(distance: Float, ?weak: Bool = false): Vec2

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.

nape
copy(): Ray

Produce a copy of this ray.

All ray properties will be copied including maxDistance.

Returns Description
Ray The copy of this Ray.

nape
new(origin: Vec2, direction: Vec2): Void

Construct new Ray.

Name Type Description
origin Vec2 Origin of ray.
direction Vec2 Direction of ray.

Private Members

Metadata

Name Parameters
:final -