Skip to content

Geom.vector3()

Description

Creates a 3D vector, setting its direction and length.

Syntax

JS
Geom.vector3(x: Number, y: Number, z: Number) -> Vector3
Geom.vector3(p: Point3) -> Vector3
Geom.vector3(p1: Point3, p2: Point3) -> Vector3

Parameters

Parameter Type Default Value Mandatory Description
x Number ✅ x-coordinate of the point
y Number ✅ y-coordinate of the point
z Number ✅ z-coordinate of the point
p Point3 ✅ Point that defines the vector's origin
p1 Point3 ✅ Starting point of the vector
p2 Point3 ✅ Ending point of the vector

See Also

The vector can be created either from coordinates [x, y, z], or from one point p, or from two points p1 and p2.

Return value

Type Description
Vector3 Object of type Vector3, a three-dimensional vector.

Example

JS
1
2
3
4
5
6
let v1 = Geom.vector3(10, 10, 10)
console.info(v1) // output:
let v2 = Geom.vector3(Geom.point3(10, 10, 10))
console.info(v2) // output:
let v3 = Geom.vector3(Geom.point3(20, 20, 20), Geom.point3(10, 10, 10))
console.info(v3) // output:

See Also

Last update: 14 August 2025, 18:47