# Vec3

class `cee.``Vec3`()

  An immutable 3d vector with x, y and z values.

  Used for positions, normals and other 3d entities.

Constructors

- `constructor`

Properties

- `x`
- `y`
- `z`

Methods

- `equals`
- `getLength`
- `getLengthSquared`
- `getNegated`
- `getNormalized`
- `getPointDistance`
- `getPointDistanceSquared`
- `add`
- `cross`
- `dot`
- `from`
- `fromArray`
- `negate`
- `scale`
- `sub`
- `transformPoint`
- `transformVector`

## Constructors

`Vec3.``constructor`(x, y, z)

  Arguments: | x (`number`) – None y (`number`) – None z (`number`) – None

  Constructor

  Return type: | Vec3

## Properties

`Vec3.``x`

  Type: | number

  The x coordinate of the vector

`Vec3.``y`

  Type: | number

  The y coordinate of the vector

`Vec3.``z`

  Type: | number

  The z coordinate of the vector

## Methods

### equals

`Vec3.``equals`(other)

  Arguments: | other (`Vec3Like`) – None

  Returns true if the vectors are equal

  Return type: | boolean

### getLength

`Vec3.``getLength`()

  Returns the length of the vector (sqrt(x^2 + y^2 + z^2)).

  Return type: | number

### getLengthSquared

`Vec3.``getLengthSquared`()

  Returns the squared length of the vector

  Return type: | number

### getNegated

`Vec3.``getNegated`()

  Returns a negated version of the vector.

  Return type: | Vec3

### getNormalized

`Vec3.``getNormalized`()

  Returns a normalized version of the vector.

  Return type: | Vec3

### getPointDistance

`Vec3.``getPointDistance`(otherPoint)

  Arguments: | otherPoint (`Vec3`) – None

  Returns the distance between this point and otherPoint

  Return type: | number

### getPointDistanceSquared

`Vec3.``getPointDistanceSquared`(otherPoint)

  Arguments: | otherPoint (`Vec3Like`) – None

  Returns the squared distance between this point and otherPoint

  Return type: | number

### static add

`Vec3.``add`(a, b)

  Arguments: | a (`Vec3Like`) – None b (`Vec3Like`) – None

  Returns the result of adding the two vectors

  Return type: | Vec3

### static cross

`Vec3.``cross`(a, b)

  Arguments: | a (`Vec3Like`) – None b (`Vec3Like`) – None

  Returns the cross product of the 2 vectors

  Return type: | Vec3

### static dot

`Vec3.``dot`(a, b)

  Arguments: | a (`Vec3Like`) – None b (`Vec3Like`) – None

  Returns the dot product of the 2 vectors

  Return type: | number

### static from

`Vec3.``from`(vec)

  Arguments: | vec (`Vec3Like`) – None

  Creates a new Vec3 instance from any object with x, y and z properties.

  Return type: | Vec3

### static fromArray

`Vec3.``fromArray`(arr)

  Arguments: | arr (`ArrayLike`) – None

  Creates a new Vec3 instance from the first 3 elements of the given array.

  Return type: | Vec3

### static negate

`Vec3.``negate`(vec)

  Arguments: | vec (`Vec3Like`) – None

  Returns the negation of the given vector

  Return type: | Vec3

### static scale

`Vec3.``scale`(vec, factor)

  Arguments: | vec (`Vec3Like`) – None factor (`number`) – None

  Returns the result of scaling the given vector by the given factor

  Return type: | Vec3

### static sub

`Vec3.``sub`(a, b)

  Arguments: | a (`Vec3Like`) – None b (`Vec3Like`) – None

  Returns the result of subtracting vector b from vector a

  Return type: | Vec3

### static transformPoint

`Vec3.``transformPoint`(p, matrix)

  Arguments: | p (`Vec3Like`) – None matrix (`Mat4`) – None

  Returns a new vector with the given vector transforms as a point.

  Transforms the vector as a point by multiplying it with the given matrix. This will both rotate and translate the vector p. Assumes the matrix m doesn’t contain any perspective projection.

  Return type: | Vec3

### static transformVector

`Vec3.``transformVector`(p, matrix)

  Arguments: | p (`Vec3Like`) – None matrix (`Mat4`) – None

  Returns a new vector with the given vector transforms as a vector.

  Transforms the vector as a vector by multiplying it with the given matrix. This will only rotate the vector. The translation part of the matrix will be ignored. Assumes the matrix m doesn’t contain any perspective projection.

  Return type: | Vec3

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Web in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Web?
What are the latest release notes for HOOPS Envision for Web?
How do I start evaluating HOOPS Envision for Web?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...