# Struct graphene::Vec3

``#[repr(transparent)]pub struct Vec3 { /* private fields */ }``
Expand description

A structure capable of holding a vector with three dimensions: x, y, and z.

The contents of the `Vec3` structure are private and should never be accessed directly.

## Implementations

Adds each component of the two given vectors.

##### Returns
###### `res`

return location for the resulting vector

Computes the cross product of the two given vectors.

##### Returns
###### `res`

return location for the resulting vector

Divides each component of the first operand `self` by the corresponding component of the second operand `b`, and places the results into the vector `res`.

##### Returns
###### `res`

return location for the resulting vector

Computes the dot product of the two given vectors.

##### Returns

the value of the dot product

Retrieves the first component of the given vector `self`.

##### Returns

the value of the first component of the vector

Creates a `Vec2` that contains the first and second components of the given `Vec3`.

##### Returns
###### `res`

return location for a `Vec2`

Creates a `Vec3` that contains the first two components of the given `Vec3`, and the third component set to 0.

##### Returns
###### `res`

return location for a `Vec3`

Converts a `Vec3` in a `Vec4` using 0.0 as the value for the fourth component of the resulting vector.

##### Returns
###### `res`

return location for the vector

Converts a `Vec3` in a `Vec4` using 1.0 as the value for the fourth component of the resulting vector.

##### Returns
###### `res`

return location for the vector

Converts a `Vec3` in a `Vec4` using `w` as the value of the fourth component of the resulting vector.

###### `w`

the value of the W component

##### Returns
###### `res`

return location for the vector

Retrieves the second component of the given vector `self`.

##### Returns

the value of the second component of the vector

Retrieves the third component of the given vector `self`.

##### Returns

the value of the third component of the vector

Linearly interpolates `self` and `v2` using the given `factor`.

###### `factor`

the interpolation factor

##### Returns
###### `res`

the interpolated vector

Retrieves the length of the given vector `self`.

##### Returns

the value of the length of the vector

Compares each component of the two given vectors and creates a vector that contains the maximum values.

##### Returns
###### `res`

return location for the result vector

Compares each component of the two given vectors and creates a vector that contains the minimum values.

##### Returns
###### `res`

return location for the result vector

Multiplies each component of the two given vectors.

##### Returns
###### `res`

return location for the resulting vector

Compares the two given `Vec3` vectors and checks whether their values are within the given `epsilon`.

###### `epsilon`

the threshold between the two vectors

##### Returns

`true` if the two vectors are near each other

Negates the given `Vec3`.

##### Returns
###### `res`

return location for the result vector

Normalizes the given `Vec3`.

##### Returns
###### `res`

return location for the normalized vector

Multiplies all components of the given vector with the given scalar `factor`.

###### `factor`

the scalar factor

##### Returns
###### `res`

return location for the result vector

Subtracts from each component of the first operand `self` the corresponding component of the second operand `b` and places each result into the components of `res`.

##### Returns
###### `res`

return location for the resulting vector

Provides a constant pointer to a vector with three components, all sets to 1.

##### Returns

a constant vector

Provides a constant pointer to a vector with three components with values set to (1, 0, 0).

##### Returns

a constant vector

Provides a constant pointer to a vector with three components with values set to (0, 1, 0).

##### Returns

a constant vector

Provides a constant pointer to a vector with three components with values set to (0, 0, 1).

##### Returns

a constant vector

Provides a constant pointer to a vector with three components, all sets to 0.

##### Returns

a constant vector

Initializes a `Vec3` using the given values.

This function can be called multiple times.

###### `x`

the X field of the vector

###### `y`

the Y field of the vector

###### `z`

the Z field of the vector

##### Returns

a pointer to the initialized vector

Initializes a `Vec3` with the values from an array.

###### `src`

an array of 3 floating point values

##### Returns

the initialized vector

Copies the components of a `Vec3` into the given array.

##### Returns
###### `dest`

return location for an array of floating point values

## Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from `source`. Read more

Formats the value using the given formatter. Read more

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

This method tests for `!=`.

Returns the type identifier of `Self`.

## Blanket Implementations

Gets the `TypeId` of `self`. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

Ensures that the type has been registered with the type system.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (`toowned_clone_into`)

Uses borrowed data to replace owned data, usually by cloning. Read more

Returns a `SendValue` clone of `self`.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.