Skip to content

point3 overview


Table of contents


utils

Pnt3 (class)

Signature

export declare class Pnt3

clone (static method)

clone point

Signature

static clone(p: Point3): Point3

spr (static method)

spread point components

Signature

static spr(p: Point3): [number, number, number]

neg (static method)

get negation of the point

Signature

static neg(p: Point3): Point3

add (static method)

add point b to point a

Signature

static add(a: Point3, b: Point3): Point3

sub (static method)

subtract point b from point a

Signature

static sub(a: Point3, b: Point3): Point3

scale (static method)

scale point b by point. The result is the point, where each component is a product of appropriate components of input points

Signature

static scale(a: Point3, s: Point3): Point3

avg (static method)

average point between a and b

Signature

static avg(a: Point3, b: Point3): Point3

round (static method)

round point components

Signature

static round(p: Point3): Point3

lenSq (static method)

calculate vector length (squared)

Signature

static lenSq(v: Point3)

len (static method)

calculate vector length

Signature

static len(v: Point3)

dist (static method)

distance between points

Signature

static dist(a: Point3, b: Point3): number

cross (static method)

cross vectors

Signature

static cross(a: Point3, b: Point3): Point3

norm (static method)

normalize

Signature

static norm(p: Point3): Point3

scalarMult (static method)

scalar multiplication

Signature

static scalarMult(p: Point3, m: number): Point3

lerp (static method)

linear interpolation

Signature

static lerp(a: Point3, b: Point3, t: number): Point3

angle (static method)

angle between vectors in radians

Signature

static angle(a: Point3, b: Point3): number

rot (static method)

rotate point a with quaternion q

Signature

static rot(p: Point3, q: Point4): Point3

rotAround (static method)

rotate point around axis a (normalized vector)

Signature

static rotAround(p: Point3, axis: Point3, angle: number): Point3

toSpherical (static method)

Converts a cartesian 3D point to a spherical coordinate system, where theta is azimuth and phi is inclination, theta == 0 is faced towards X axis direction, and phi == 0 is faced towards zenith (Z axis)

Signature

static toSpherical(p: Point3): Spherical

fromSpherical (static method)

Converts a spherical coordinate system to a cartesian 3D point. Used spherical coordinates, where theta is azimuth and phi is inclination, theta == 0 is faced towards X axis direction, and phi == 0 is faced towards zenith (Z axis)

Signature

static fromSpherical(s: Spherical): Point3