Struct graphene::Vec2[][src]

pub struct Vec2(_);
Expand description

A structure capable of holding a vector with two dimensions, x and y.

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

Implementations

Adds each component of the two passed vectors and places each result into the components of res.

b

a Vec2

Returns

res

return location for the result

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.

b

a Vec2

Returns

res

return location for the result

Computes the dot product of the two given vectors.

b

a Vec2

Returns

the dot product of the vectors

Retrieves the X component of the Vec2.

Returns

the value of the X component

Retrieves the Y component of the Vec2.

Returns

the value of the Y component

Initializes a Vec2 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

Returns

the initialized vector

Copies the contents of src into self.

src

a Vec2

Returns

the initialized vector

Linearly interpolates self and v2 using the given factor.

v2

a Vec2

factor

the interpolation factor

Returns

res

the interpolated vector

Computes the length of the given vector.

Returns

the length of the vector

Compares the two given vectors and places the maximum values of each component into res.

b

a Vec2

Returns

res

the resulting vector

Compares the two given vectors and places the minimum values of each component into res.

b

a Vec2

Returns

res

the resulting vector

Multiplies each component of the two passed vectors and places each result into the components of res.

b

a Vec2

Returns

res

return location for the result

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

v2

a Vec2

epsilon

the threshold between the two vectors

Returns

true if the two vectors are near each other

Negates the given Vec2.

Returns

res

return location for the result vector

Computes the normalized vector for the given vector self.

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.

b

a Vec2

Returns

res

return location for the result

Retrieves a constant vector with (1, 1) components.

Returns

the one vector

Retrieves a constant vector with (1, 0) components.

Returns

the X axis vector

Retrieves a constant vector with (0, 1) components.

Returns

the Y axis vector

Retrieves a constant vector with (0, 0) components.

Returns

the zero vector

Initializes self with the contents of the given array.

src

an array of floating point values with at least two elements

Returns

the initialized vector

Stores the components of self into an array.

Returns

dest

return location for an array of floating point values with at least 2 elements

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

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

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

Performs the conversion.

Performs the conversion.

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)

recently added

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

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.