Ray3d Class

A Ray3d contains

  • an origin point.
  • a direction vector (The vector is not required to be normalized).
  • an optional weight (number).

Implements

Methods

Name Description
clone(result?: Ray3d): Ray3d Clone the ray.  
cloneInverseTransformed(transform: Transform, result?: Ray3d): undefined | Ray3d Create a clone and return the inverse transform of the clone.  
cloneTransformed(transform: Transform, result?: Ray3d): Ray3d Return a clone of the transformed instance  
distance(spacePoint: Point3d): number Return distance from the ray to point in space.  
dotProductToPoint(spacePoint: Point3d): number Return the dot product of the ray's direction vector with a vector from the ray origin  
fractionToPoint(fraction: number, result?: Point3d): Point3d Return a point at fractional position along the ray.  
getDirectionRef(): Vector3d Return a reference to the ray's direction vector.  
getOriginRef(): Point3d Return a reference to the ray's origin.  
intersectionWithPlane(plane: Plane3dByOriginAndUnitNormal, result?: Point3d): undefined | number Return the intersection parameter of the line defined by the ray with a plane.  
intersectionWithRange3d(range: Range3d, result?: Range1d): Range1d Find the intersection of the line defined by the ray with a Range3d.  
intersectionWithTriangle(vertex0: Point3d, vertex1: Point3d, vertex2: Point3d, distanceTol?: number, parameterTol?: number, result?: Point3d): undefined | Point3d Compute the intersection of the ray with a triangle.  
isAlmostEqual(other: Ray3d): boolean Test for nearly equal Ray3d objects.  
isAlmostEqualPointSet(other: Ray3d): boolean Test for nearly equal rays, allowing origin float and direction scaling.  
perpendicularPartOfVectorToTarget(targetPoint: Readonly<WritableXYAndZ>, result?: Vector3d): Vector3d Return the shortest vector v to targetPoint from the line defined by this ray.  
pointToFraction(spacePoint: Point3d): number Return the fractional coordinate (along the direction vector) of the spacePoint projected to the ray.  
projectPointToRay(spacePoint: Point3d): Point3d Return the spacePoint projected onto the ray.  
set(origin: Point3d, direction: Vector3d): void Copy coordinates from origin and direction.  
setFrom(source: Ray3d): void Copy data from another ray.  
setFromJSON(json?: any): void Convert {origin:[x,y,z], direction:[u,v,w]} to a Ray3d.  
toJSON(): any Construct a JSON object from this Ray3d.  
toRigidZFrame(result?: Transform): Transform Return a transform for rigid axes at ray origin with z in ray direction.  
transformInPlace(transform: Transform): void Apply a transform in place.  
tryNormalizeInPlaceWithAreaWeight(a: number): boolean Normalize the ray direction in place.  
trySetDirectionMagnitudeInPlace(magnitude: number1.0): boolean Try to scale the direction vector to a given magnitude.  
closestApproachRay3dRay3d(rayA: Ray3d, rayB: Ray3d): CurveLocationDetailPair Static Determine if two rays intersect, or are fully overlapped, or parallel but not coincident, or skew.  
create(origin: Point3d, direction: Vector3d, result?: Ray3d): Ray3d Static Create a ray from origin and direction.  
createCapture(origin: Point3d, direction: Vector3d): Ray3d Static Capture origin and direction in a new Ray3d.  
createPointVectorNumber(origin: Point3d, direction: Vector3d, a: number, result?: Ray3d): Ray3d Static Create from (clones of) origin, direction, and numeric weight.  
createStartEnd(origin: Point3d, target: Point3d, result?: Ray3d): Ray3d Static Create from origin and target.  
createWeightedDerivative(weightedPoint: Float64Array, weightedDerivative: Float64Array, result?: Ray3d): undefined | Ray3d Static Given a homogeneous point and its derivative components, construct a Ray3d with cartesian  
createXAxis(): Ray3d Static Create a ray on the x axis.  
createXYZUVW(originX: number, originY: number, originZ: number, directionX: number, directionY: number, directionZ: number, result?: Ray3d): Ray3d Static Create from coordinates of the origin and direction.  
createYAxis(): Ray3d Static Create a ray on the y axis.  
createZAxis(): Ray3d Static Create a ray on the z axis.  
createZero(result?: Ray3d): Ray3d Static Create a ray with all zeros.  
fromJSON(json?: any): Ray3d Static Create a new ray from json object.  
interpolatePointAndTangent(pt1: Readonly<WritableXYAndZ>, fraction: number, pt2: Readonly<WritableXYAndZ>, tangentScale: number, result?: Ray3d): Ray3d Static Return a ray with ray.origin interpolated between pt1 and pt2 at the given fraction  

Properties

Name Type Description
a number | undefined Numeric annotation.  
direction Vector3d The ray direction.  
origin Point3d The ray origin  

Defined in

Last Updated: 14 November, 2024