#[repr(C)]
pub struct Rotor2 { pub s: f32, pub bv: Bivec2, }
Expand description

A Rotor in 2d space.

Please see the module level documentation for more information on rotors!

Fields

s: f32bv: Bivec2

Implementations

Construct a Rotor that rotates one vector to another.

A rotation between antiparallel vectors is undefined!

Construct a rotor given a bivector which defines a plane and rotation orientation, and a rotation angle.

plane must be normalized!

This is the equivalent of an axis-angle rotation.

Construct a rotor given only an angle. This is possible in 2d since there is only one possible plane of rotation. However, there are two possible orientations. This function uses the common definition of positive angle in 2d as meaning the direction which brings the x unit vector towards the y unit vector.

Rotates this rotor by another rotor in-place. Note that if you are looking to compose rotations, you should NOT use this operation and rather just use regular left-multiplication like for matrix composition.

Rotates this rotor by another rotor and returns the result. Note that if you are looking to compose rotations, you should NOT use this operation and rather just use regular left-multiplication like for matrix composition.

Rotates a vector by this rotor.

self must be normalized!

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

Performs the += operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

Performs the /= operation. Read more

Performs the conversion.

Linearly interpolate between self and end by t between 0.0 and 1.0. i.e. (1.0 - t) * self + (t) * end.

For interpolating Rotors with linear interpolation, you almost certainly want to normalize the returned Rotor. For example,

let interpolated_rotor = rotor1.lerp(rotor2, 0.5).normalized();

For most cases (especially where performance is the primary concern, like in animation interpolation for games, this ‘normalized lerp’ or ‘nlerp’ is probably what you want to use. However, there are situations in which you really want the interpolation between two Rotors to be of constant angular velocity. In this case, check out Slerp.

The resulting type after applying the * operator.

Performs the * operation. Read more

The composition of self with q, i.e. self * q gives the rotation as though you first perform q and then self.

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

Performs the *= operation. Read more

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

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Spherical-linear interpolation between self and end based on t from 0.0 to 1.0.

self and end should both be normalized or something bad will happen!

The implementation for SIMD types also requires that the two things being interpolated between are not exactly aligned, or else the result is undefined.

Basically, interpolation that maintains a constant angular velocity from one orientation on a unit hypersphere to another. This is sorta the “high quality” interpolation for Rotors, and it can also be used to interpolate other things, one example being interpolation of 3d normal vectors.

Note that you should often normalize the result returned by this operation, when working with Rotors, etc!

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. Read more

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

Returns the argument unchanged.

Calls U::from(self).

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

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

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.