Documentation ¶
Index ¶
- type Quaternion
- func (q Quaternion) Dir() vector3.Float64
- func (q Quaternion) Multiply(other Quaternion) Quaternion
- func (q Quaternion) Normalize() Quaternion
- func (q Quaternion) Rotate(v vector3.Float64) vector3.Float64
- func (q Quaternion) RotateArray(arr []vector3.Float64) []vector3.Float64
- func (q Quaternion) W() float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Quaternion ¶
type Quaternion struct {
// contains filtered or unexported fields
}
Quaternion is a 4 component imaginary number thingy for rotating 3D meshes.
func FromTheta ¶
func FromTheta(theta float64, v vector3.Float64) Quaternion
UnitQuaternionFromTheta takes a vector and angle and builds a unit quaternion in the form (cos(theta/2.0), sin(theta/2.0))
Resources Used:
https://www.youtube.com/watch?v=mHVwd8gYLnI https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation
func RotationTo ¶
func RotationTo(from, to vector3.Float64) Quaternion
func Zero ¶
func Zero() Quaternion
QuaternionZero returns a quaternion with 0 for all it's components
func (Quaternion) Dir ¶
func (q Quaternion) Dir() vector3.Float64
func (Quaternion) Multiply ¶
func (q Quaternion) Multiply(other Quaternion) Quaternion
func (Quaternion) Normalize ¶
func (q Quaternion) Normalize() Quaternion
func (Quaternion) Rotate ¶
func (q Quaternion) Rotate(v vector3.Float64) vector3.Float64
Rotate takes a given vector and rotates it with by this quaternion.
Resources Used:
https://gamedev.stackexchange.com/questions/28395
func (Quaternion) RotateArray ¶
func (q Quaternion) RotateArray(arr []vector3.Float64) []vector3.Float64
func (Quaternion) W ¶
func (q Quaternion) W() float64
Click to show internal directories.
Click to hide internal directories.