raymath

package
v0.0.0-...-81ab1f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2019 License: Zlib Imports: 2 Imported by: 3

README

raymath GoDoc

Some useful functions to work with Vector2, Vector3, Matrix and Quaternions.

Documentation

Overview

Package raymath - Some useful functions to work with Vector2, Vector3, Matrix and Quaternions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp(value, min, max float32) float32

Clamp - Clamp float value

func Mat2MultiplyVector2

func Mat2MultiplyVector2(matrix rl.Mat2, vector rl.Vector2) rl.Vector2

Mat2MultiplyVector2 - Multiplies a vector by a matrix 2x2

func Mat2Radians

func Mat2Radians(radians float32) rl.Mat2

Mat2Radians - Creates a matrix 2x2 from a given radians value

func Mat2Set

func Mat2Set(matrix *rl.Mat2, radians float32)

Mat2Set - Set values from radians to a created matrix 2x2

func Mat2Transpose

func Mat2Transpose(matrix rl.Mat2) rl.Mat2

Mat2Transpose - Returns the transpose of a given matrix 2x2

func MatrixAdd

func MatrixAdd(left, right rl.Matrix) rl.Matrix

MatrixAdd - Add two matrices

func MatrixDeterminant

func MatrixDeterminant(mat rl.Matrix) float32

MatrixDeterminant - Compute matrix determinant

func MatrixFrustum

func MatrixFrustum(left, right, bottom, top, near, far float32) rl.Matrix

MatrixFrustum - Returns perspective projection matrix

func MatrixIdentity

func MatrixIdentity() rl.Matrix

MatrixIdentity - Returns identity matrix

func MatrixInvert

func MatrixInvert(mat *rl.Matrix)

MatrixInvert - Invert provided matrix

func MatrixLookAt

func MatrixLookAt(eye, target, up rl.Vector3) rl.Matrix

MatrixLookAt - Returns camera look-at matrix (view matrix)

func MatrixMultiply

func MatrixMultiply(left, right rl.Matrix) rl.Matrix

MatrixMultiply - Returns two matrix multiplication

func MatrixNormalize

func MatrixNormalize(mat *rl.Matrix)

MatrixNormalize - Normalize provided matrix

func MatrixOrtho

func MatrixOrtho(left, right, bottom, top, near, far float32) rl.Matrix

MatrixOrtho - Returns orthographic projection matrix

func MatrixPerspective

func MatrixPerspective(fovy, aspect, near, far float32) rl.Matrix

MatrixPerspective - Returns perspective projection matrix

func MatrixRotate

func MatrixRotate(axis rl.Vector3, angle float32) rl.Matrix

MatrixRotate - Returns rotation matrix for an angle around an specified axis (angle in radians)

func MatrixRotateX

func MatrixRotateX(angle float32) rl.Matrix

MatrixRotateX - Returns x-rotation matrix (angle in radians)

func MatrixRotateY

func MatrixRotateY(angle float32) rl.Matrix

MatrixRotateY - Returns y-rotation matrix (angle in radians)

func MatrixRotateZ

func MatrixRotateZ(angle float32) rl.Matrix

MatrixRotateZ - Returns z-rotation matrix (angle in radians)

func MatrixScale

func MatrixScale(x, y, z float32) rl.Matrix

MatrixScale - Returns scaling matrix

func MatrixSubtract

func MatrixSubtract(left, right rl.Matrix) rl.Matrix

MatrixSubtract - Subtract two matrices (left - right)

func MatrixTrace

func MatrixTrace(mat rl.Matrix) float32

MatrixTrace - Returns the trace of the matrix (sum of the values along the diagonal)

func MatrixTranslate

func MatrixTranslate(x, y, z float32) rl.Matrix

MatrixTranslate - Returns translation matrix

func MatrixTranspose

func MatrixTranspose(mat *rl.Matrix)

MatrixTranspose - Transposes provided matrix

func QuaternionFromAxisAngle

func QuaternionFromAxisAngle(axis rl.Vector3, angle float32) rl.Quaternion

QuaternionFromAxisAngle - Returns rotation quaternion for an angle and axis

func QuaternionFromMatrix

func QuaternionFromMatrix(matrix rl.Matrix) rl.Quaternion

QuaternionFromMatrix - Returns a quaternion for a given rotation matrix

func QuaternionInvert

func QuaternionInvert(quat *rl.Quaternion)

QuaternionInvert - Invert provided quaternion

func QuaternionLength

func QuaternionLength(quat rl.Quaternion) float32

QuaternionLength - Compute the length of a quaternion

func QuaternionMultiply

func QuaternionMultiply(q1, q2 rl.Quaternion) rl.Quaternion

QuaternionMultiply - Calculate two quaternion multiplication

func QuaternionNormalize

func QuaternionNormalize(q *rl.Quaternion)

QuaternionNormalize - Normalize provided quaternion

func QuaternionSlerp

func QuaternionSlerp(q1, q2 rl.Quaternion, amount float32) rl.Quaternion

QuaternionSlerp - Calculates spherical linear interpolation between two quaternions

func QuaternionToAxisAngle

func QuaternionToAxisAngle(q rl.Quaternion, outAxis *rl.Vector3, outAngle *float32)

QuaternionToAxisAngle - Returns the rotation angle and axis for a given quaternion

func QuaternionToMatrix

func QuaternionToMatrix(q rl.Quaternion) rl.Matrix

QuaternionToMatrix - Returns a matrix for a given quaternion

func QuaternionTransform

func QuaternionTransform(q *rl.Quaternion, mat rl.Matrix)

QuaternionTransform - Transform a quaternion given a transformation matrix

func Vector2Add

func Vector2Add(v1, v2 rl.Vector2) rl.Vector2

Vector2Add - Add two vectors (v1 + v2)

func Vector2Angle

func Vector2Angle(v1, v2 rl.Vector2) float32

Vector2Angle - Calculate angle between two vectors in X-axis

func Vector2Cross

func Vector2Cross(value float32, vector rl.Vector2) rl.Vector2

Vector2Cross - Calculate the cross product of a vector and a value

func Vector2CrossProduct

func Vector2CrossProduct(v1, v2 rl.Vector2) float32

Vector2CrossProduct - Calculate two vectors cross product

func Vector2Distance

func Vector2Distance(v1, v2 rl.Vector2) float32

Vector2Distance - Calculate distance between two vectors

func Vector2Divide

func Vector2Divide(v *rl.Vector2, div float32)

Vector2Divide - Divide vector by a float value

func Vector2DotProduct

func Vector2DotProduct(v1, v2 rl.Vector2) float32

Vector2DotProduct - Calculate two vectors dot product

func Vector2LenSqr

func Vector2LenSqr(vector rl.Vector2) float32

Vector2LenSqr - Returns the len square root of a vector

func Vector2Length

func Vector2Length(v rl.Vector2) float32

Vector2Length - Calculate vector length

func Vector2Negate

func Vector2Negate(v *rl.Vector2)

Vector2Negate - Negate vector

func Vector2Normalize

func Vector2Normalize(v *rl.Vector2)

Vector2Normalize - Normalize provided vector

func Vector2One

func Vector2One() rl.Vector2

Vector2One - Vector with components value 1.0

func Vector2Scale

func Vector2Scale(v *rl.Vector2, scale float32)

Vector2Scale - Scale vector (multiply by value)

func Vector2Subtract

func Vector2Subtract(v1, v2 rl.Vector2) rl.Vector2

Vector2Subtract - Subtract two vectors (v1 - v2)

func Vector2Zero

func Vector2Zero() rl.Vector2

Vector2Zero - Vector with components value 0.0

func Vector3Add

func Vector3Add(v1, v2 rl.Vector3) rl.Vector3

Vector3Add - Add two vectors

func Vector3Barycenter

func Vector3Barycenter(p, a, b, c rl.Vector3) rl.Vector3

Vector3Barycenter - Barycenter coords for p in triangle abc

func Vector3CrossProduct

func Vector3CrossProduct(v1, v2 rl.Vector3) rl.Vector3

Vector3CrossProduct - Calculate two vectors cross product

func Vector3Distance

func Vector3Distance(v1, v2 rl.Vector3) float32

Vector3Distance - Calculate distance between two vectors

func Vector3DotProduct

func Vector3DotProduct(v1, v2 rl.Vector3) float32

Vector3DotProduct - Calculate two vectors dot product

func Vector3Length

func Vector3Length(v rl.Vector3) float32

Vector3Length - Calculate vector length

func Vector3Lerp

func Vector3Lerp(v1, v2 rl.Vector3, amount float32) rl.Vector3

Vector3Lerp - Calculate linear interpolation between two vectors

func Vector3Max

func Vector3Max(vec1, vec2 rl.Vector3) rl.Vector3

Vector3Max - Return max value for each pair of components

func Vector3Min

func Vector3Min(vec1, vec2 rl.Vector3) rl.Vector3

Vector3Min - Return min value for each pair of components

func Vector3Multiply

func Vector3Multiply(v rl.Vector3, scalar float32) rl.Vector3

Vector3Multiply - Multiply vector by scalar

func Vector3MultiplyV

func Vector3MultiplyV(v1, v2 rl.Vector3) rl.Vector3

Vector3MultiplyV - Multiply vector by vector

func Vector3Negate

func Vector3Negate(v *rl.Vector3)

Vector3Negate - Negate provided vector (invert direction)

func Vector3Normalize

func Vector3Normalize(v *rl.Vector3)

Vector3Normalize - Normalize provided vector

func Vector3One

func Vector3One() rl.Vector3

Vector3One - Vector with components value 1.0

func Vector3Perpendicular

func Vector3Perpendicular(v rl.Vector3) rl.Vector3

Vector3Perpendicular - Calculate one vector perpendicular vector

func Vector3Reflect

func Vector3Reflect(vector, normal rl.Vector3) rl.Vector3

Vector3Reflect - Calculate reflected vector to normal

func Vector3Scale

func Vector3Scale(v *rl.Vector3, scale float32)

Vector3Scale - Scale provided vector

func Vector3Subtract

func Vector3Subtract(v1, v2 rl.Vector3) rl.Vector3

Vector3Subtract - Subtract two vectors

func Vector3Transform

func Vector3Transform(v *rl.Vector3, mat rl.Matrix)

Vector3Transform - Transforms a Vector3 by a given Matrix

func Vector3Zero

func Vector3Zero() rl.Vector3

Vector3Zero - Vector with components value 0.0

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL