Skip to content

Ray3d

Represents an immutable ray (or line) in 3d coordinates

SDK 2.37.0

new Ray3d(origin, direction): Ray3d

Parameter Type Description

origin

Point3d

The origin point of this ray

direction

Vector3d

‐

Ray3d

readonly direction: Vector3d

The normalized direction vector for this ray


readonly origin: Point3d

The origin point of this ray

projectPoint(point): Point3d

Projects the given point onto this line

Parameter Type Description

point

Readonly<Point3Like>

‐

Point3d

SDK 2.37.0


toString(): string

string


static between(start, end): Ray3d

Constructs a ray (line) between two points.

Parameter Type Description

start

Readonly<Point3Like>

‐

end

Readonly<Point3Like>

‐

Ray3d

let { Ray3d } = SketchUpApi;
let ray = Ray3d.between([0,0,0],[1,0,0]);
console.log(ray.toString());

Error if start and end are the same

SDK 2.37.0


static create(input): Ray3d

Creates a Ray from any input that can be interpreted as a Ray.

NOTE For a tuple the second argument is assumed to be a vector rather than a point unless a Point3d is explicitly supplied.

Parameter Type Description

input

Readonly<Ray3dLike>

‐

Ray3d

let { Point3d, Ray3d } = SketchUpApi;
// Interpreted as Point+Vector
let a = Ray3d.create([[0,0,0],[1,0,0]]);
// Interpreted as Point+Point
let b = Ray3d.create([[0,0,0],new Point3d(1,0,0)]);
console.log(a.toString(),b.toString());

SDK 2.37.0

Error on invalid input