Skip to content

Latest commit

 

History

History
338 lines (189 loc) · 5.88 KB

File metadata and controls

338 lines (189 loc) · 5.88 KB

@immugio/three-math-extensions / Exports / Vec3

Class: Vec3

Vec3 represents a 3D vector. It extends Vector3 from the threejs library.

Hierarchy

  • Vector3

    Vec3

Table of contents

Constructors

Methods

Constructors

constructor

new Vec3(x?, y?, z?): Vec3

Parameters

Name Type
x? number
y? number
z? number

Returns

Vec3

Inherited from

Vector3.constructor

Defined in

node_modules/@types/three/src/math/Vector3.d.ts:27

Methods

addX

addX(x): Vec3

Adds x amount to this Vec3 instance and return this

Parameters

Name Type
x number

Returns

Vec3

Defined in

src/Vec3.ts:73


addY

addY(y): Vec3

Adds y amount to this Vec3 instance and return this

Parameters

Name Type
y number

Returns

Vec3

Defined in

src/Vec3.ts:64


addZ

addZ(z): Vec3

Adds z amount to this Vec3 instance and return this

Parameters

Name Type
z number

Returns

Vec3

Defined in

src/Vec3.ts:82


clone

clone(): Vec3

Returns

Vec3

Overrides

Vector3.clone

Defined in

src/Vec3.ts:131


closest

closest(...points): Vec3

Returns a clone of the point closest to this from the given points.

Parameters

Name Type
...points Vector3[]

Returns

Vec3

Defined in

src/Vec3.ts:91


horizontalDistanceTo

horizontalDistanceTo(point): number

Get distance to another vector while ignoring the y-axis.

Parameters

Name Type
point Vector3

Returns

number

Defined in

src/Vec3.ts:115


isNear

isNear(v, maxDistance?): boolean

Determines if this Vec2 instance is near the target Vec2. maxDistance is the maximum distance between the two vectors within which they are considered near.

Parameters

Name Type Default value
v Vector3 undefined
maxDistance number undefined

Returns

boolean

Defined in

src/Vec3.ts:123


moveHalfWayTowards

moveHalfWayTowards(target): Vec3

Moves this Vec3 instance halfway towards the target Vec3 by the given amount.

Parameters

Name Type Description
target Vector3 The target Vec3.

Returns

Vec3

This Vec3 instance.

Defined in

src/Vec3.ts:51


moveTowards

moveTowards(target, amount): Vec3

Moves this Vec3 instance towards the target Vec3 by the given amount.

Parameters

Name Type Description
target Vector3 The target Vec3.
amount number The distance to move.

Returns

Vec3

This Vec3 instance.

Defined in

src/Vec3.ts:35


onPlan

onPlan(): Vec2

Projects this Vec3 instance onto 2d plan. Vec3.z becomes Vec2.y and Vec3.y is ignored.

Returns

Vec2

Defined in

src/Vec3.ts:107


toPointWithFlippedYZ

toPointWithFlippedYZ(): Vec3

Returns a clone of this Vec3 instance with y and z swapped.

Returns

Vec3

Defined in

src/Vec3.ts:100


fromPoint

fromPoint(point): Vec3

Creates a new Vec3 instance from an {x, y, z} object.

Parameters

Name Type Description
point Point3 The {x, y, z} instance.

Returns

Vec3

A new Vec3 instance.

Defined in

src/Vec3.ts:17


fromPoints

fromPoints(...points): Vec3[]

Creates a new Vec3[] array from arguments of {x, y, z} objects.

Parameters

Name Type Description
...points Point3[] The ...{x, y, z} instances.

Returns

Vec3[]

Defined in

src/Vec3.ts:25