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. | |
| intersectionWithRange2d(range: Range2d, result?: Range1d): Range1d | Find the intersection of the line defined by the ray with a Range2d. | |
| intersectUnboundedLine(linePointA: Readonly<WritableXAndY>, linePointB: Readonly<WritableXAndY>): { cross: number, fraction: number, hasIntersection: boolean } | Intersect this ray with the unbounded line defined by the given points. | |
| normalizeDirectionInPlace(defaultX: number = 1, defaultY: number = 0): 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: Readonly<WritableXAndY>): number | Return the ray fraction where the given point projects onto the perpendicular ray. | |
| projectionFraction(point: Readonly<WritableXAndY>): number | Return the ray fraction where the given point projects onto the ray. | |
| set(origin: Readonly<WritableXAndY>, direction: Readonly<WritableXAndY>): void | Copy coordinates from origin and direction. | |
| createOriginAndDirection(origin: Readonly<WritableXAndY>, direction: Readonly<WritableXAndY>, 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: Readonly<WritableXAndY>, target: Readonly<WritableXAndY>, result?: Ray2d): Ray2d Static | Create from origin and target points. |
|
| createZero(result?: Ray2d): Ray2d Static | Create a ray with all zeros. |
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
- geometry3d/Ray2d.ts Line 19
Last Updated: 29 October, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.