Ray2d Class

Ray with xy origin and direction

Methods

Name Description
ccwPerpendicularRay(result?: Ray2d): Ray2d Return a ray with cloned origin and with direction rotated 90 degrees counterclockwise  
cwPerpendicularRay(result?: Ray2d): Ray2d Return a ray with cloned origin and with direction rotated 90 degrees clockwise  
fractionToPoint(f: number, result?: Point2d): Point2d Compute and return origin plus scaled direction.  
intersectUnboundedLine(linePointA: Point2d, linePointB: Point2d): { cross: number, fraction: number, hasIntersection: boolean } Intersect this ray with the unbounded line defined by the given points.  
normalizeDirectionInPlace(defaultX: number1, defaultY: number0): boolean Normalize the direction vector in place.  
parallelRay(leftFraction: number, result?: Ray2d): Ray2d Return a parallel ray to the left of this ray.  
perpendicularProjectionFraction(point: Point2d): number Return the ray fraction where the given point projects onto the perpendicular ray.  
projectionFraction(point: Point2d): number Return the ray fraction where the given point projects onto the ray.  
set(origin: Point2d, direction: Vector2d): void Copy coordinates from origin and direction.  
createOriginAndDirection(origin: Point2d, direction: Vector2d, result?: Ray2d): Ray2d Static Create by copying coordinates from origin and direction.  
createOriginAndDirectionCapture(origin: Point2d, direction: Vector2d, result?: Ray2d): Ray2d Static Create from captured origin and direction.  
createOriginAndTarget(origin: Point2d, target: Point2d, result?: Ray2d): Ray2d Static Create from origin and target points.  

Properties

Name Type Description
direction Accessor ReadOnly Vector2d Get the reference to the ray direction.  
origin Accessor ReadOnly Point2d Get the reference to the ray origin.  

Defined in

Last Updated: 14 November, 2024