TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

struct Ray in Tinman.Core.Math

A ray in 3D space.

struct Ray  

Public / Attributes

Direction

The unit-length ray direction vector.

public readonly field Direction
type Vec3D

IsUndefined

Is this ray undefined?

public property IsUndefined { get }
type bool
value true if this ray is undefined, false if not.

See also:

Undefined

Origin

The origin of the ray.

public readonly field Origin
type Vec3D

Public / Constants

Undefined

The undefined ray.

public static readonly field Undefined
type Ray

See also:

IsUndefined

Public / Constructors

ForDirection

Creates a ray that starts at origin and points into the given direction.

[Pure]
public static method ForDirection (Vec3D origin, Vec3D direction)
type Ray
params origin The start point of the ray.
  direction The direction vector of the ray. The vector will be normalized to unit length.
returns [not-null] The ray originating at origin, pointing in direction.

Creates a ray that starts at origin and points into the given direction.

[Pure]
public static method ForDirection (Vec3D origin, Vec3D direction, out Ray ray)
type float64
params origin The start point of the ray.
  direction The direction vector of the ray. The vector will be normalized to unit length.
  ray The ray originating at origin, pointing in direction.
returns [>=0] Length of direction.

ForTarget

Creates a ray that starts at origin and points towards target.

[Pure]
public static method ForTarget (Vec3D origin, Vec3D target)
type Ray
params origin The start point of the ray.
  target The target point of the ray.
returns [not-null] The ray originating at origin, pointing towards target.

Creates a ray that starts at origin and points towards target.

[Pure]
public static method ForTarget (Vec3D origin, Vec3D target, out Ray ray)
type float64
params origin The start point of the ray.
  target The target point of the ray.
  ray The ray originating at origin, pointing towards target.
returns [>=0] The distance between origin and target.

Ray

Creates a new instance of Ray.

public constructor Ray (Vec3D origin, Vec3D direction)
params origin The ray origin.
  direction The unit-length ray direction.

Public / Methods

Distance

Returns the point at the given distance along the ray Direction from the ray Origin.

[Pure]
public method Distance (float64 v)
type Vec3D
params v The distance along Direction.
returns The point.

Returns the distance of the given point along the ray Direction from the ray Origin.

[Pure]
public method Distance (Vec3D v)
type float64
params v The point.
returns The distance along Direction.

Returns the distance of the given point along this ray.

[Pure]
public method Distance (float64 x, float64 y, float64 z)
type float64
params x X-coordinate of the point.
  y Y-coordinate of the point.
  z Z-coordinate of the point.
returns The distance of the given point along this ray.

Intersect

Intersects this ray with the given plane.

[Pure]
public method Intersect (Plane plane)
type Vec3D
params plane The plane to intersect with.
returns The intersection point or Undefined if there is no intersection.

Intersects this ray with the given sphere.

[Pure]
public method Intersect (Sphere sphere)
type Vec3D
params sphere The sphere to intersect with.
returns The intersection point or Undefined if there is no intersection.

Scale

Scales this ray.

[Pure]
public method Scale (float64 factor)
type Ray
params factor The scale factor.
returns The scaled ray.

Serialization

Serializer

The serialization helper object for values of Ray.

public static readonly field Serializer
type ITypeSerializer<Ray>