API Reference > geometry-core > CartesianGeometry > Ray3d Ray3d Class A Ray3d contains an origin point. a direction vector. The vector is NOT required to be normalized. an optional weight (number). Implements BeJSONFunctions Methods Name Description clone(result?: Ray3d): Ray3d Clone the ray. cloneInverseTransformed(transform: Transform): undefined | Ray3d Create a clone and return the inverse transform of the clone. cloneTransformed(transform: Transform): Ray3d Create a clone and return the transform of the clone. 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 to the space point. fractionToPoint(fraction: number, result?: Point3d): Point3d fraction 0 is the ray origin. 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 of the unbounded ray with a plane. intersectionWithRange3d(range: Range3d, result?: Range1d): Range1d * Find intersection of the ray with a Range3d. isAlmostEqual(other: Ray3d): boolean Test for nearly equal rays. perpendicularPartOfVectorToTarget(targetPoint: Readonly<WritableXYAndZ>, result?: Vector3d): Vector3d Construct a vector from ray.origin to target point. 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 Convert an Angle to a JSON object. toRigidZFrame(): undefined | Transform Return a transform for rigid axes transformInPlace(transform: Transform): void Apply a transform in place. tryNormalizeInPlaceWithAreaWeight(a: number): boolean * If parameter a is clearly nonzero and the direction vector can be normalized, trySetDirectionMagnitudeInPlace(magnitude: number = 1.0): boolean try to scale the direction vector to a given magnitude. closestApproachRay3dRay3d(rayA: Ray3d, rayB: Ray3d): CurveLocationDetailPair Static Determine if two rays intersect, are fully overlapped, parallel but no 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 coordinates and derivatives. 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. Properties Name Type Description a undefined | number Numeric annotation. direction Vector3d The ray direction. origin Point3d The ray origin Defined in geometry3d/Ray3d.ts Line 26 Last Updated: 11 June, 2024