Skip to content

Ray2

Overview

2-dimensional ray consisting of an origin point and a unit direction vector.

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class Ray2

import { Ray2 } from 'scenerystack/dot';

Constructor

new Ray2( position : Vector2, direction : Vector2 )

Instance Methods

shifted( distance : number ) : Ray2

Returns a new Ray that has it origin shifted to a position given by an amount distance*this.direction.

pointAtDistance( distance : number ) : Vector2

Returns a position that is a distance 'distance' along the ray.

toString() : string

Returns the attributes of this ray into a string

Instance Properties

position : Vector2

direction : Vector2

Source Code

See the source for Ray2.ts in the dot repository.