Documentation ¶
Overview ¶
Package math32 implements basic math functions which operate directly on float32 numbers without casting and contains types of common entities used in 3D Graphics such as vectors, matrices, quaternions and others.
Index ¶
- Constants
- Variables
- func Abs(v float32) float32
- func Acos(v float32) float32
- func Asin(v float32) float32
- func Atan(v float32) float32
- func Atan2(y, x float32) float32
- func Ceil(v float32) float32
- func Clamp(x, a, b float32) float32
- func ClampBotton(x, a float32) float32
- func ClampInt(x, a, b int) int
- func ContainsPoint(point, a, b, c *Vector3) bool
- func Cos(v float32) float32
- func DegToRad(degrees float32) float32
- func Floor(v float32) float32
- func Inf(sign int) float32
- func IsNaN(v float32) bool
- func Max(a, b float32) float32
- func Min(a, b float32) float32
- func Mod(a, b float32) float32
- func NaN() float32
- func Pow(a, b float32) float32
- func RadToDeg(radians float32) float32
- func Round(v float32) float32
- func Sin(v float32) float32
- func Sqrt(v float32) float32
- func Tan(v float32) float32
- type ArrayF32
- func (a *ArrayF32) Append(v ...float32)
- func (a *ArrayF32) AppendColor(v ...*Color)
- func (a *ArrayF32) AppendVector2(v ...*Vector2)
- func (a *ArrayF32) AppendVector3(v ...*Vector3)
- func (a *ArrayF32) Bytes() int
- func (a ArrayF32) GetColor(pos int, v *Color)
- func (a ArrayF32) GetVector2(pos int, v *Vector2)
- func (a ArrayF32) GetVector3(pos int, v *Vector3)
- func (a *ArrayF32) Len() int
- func (a ArrayF32) Set(pos int, v ...float32)
- func (a ArrayF32) SetColor(pos int, v *Color)
- func (a ArrayF32) SetVector2(pos int, v *Vector2)
- func (a ArrayF32) SetVector3(pos int, v *Vector3)
- func (a *ArrayF32) Size() int
- type ArrayU32
- type Box2
- func (this *Box2) Center(optionalTarget *Vector2) *Vector2
- func (this *Box2) ClampPoint(point *Vector2, optionalTarget *Vector2) *Vector2
- func (this *Box2) ContainsBox(box *Box2) bool
- func (this *Box2) ContainsPoint(point *Vector2) bool
- func (this *Box2) Copy(box *Box2) *Box2
- func (this *Box2) DistanceToPoint(point *Vector2) float32
- func (this *Box2) Empty() bool
- func (this *Box2) Equals(box *Box2) bool
- func (this *Box2) ExpandByPoint(point *Vector2) *Box2
- func (this *Box2) ExpandByScalar(scalar float32) *Box2
- func (this *Box2) ExpandByVector(vector *Vector2) *Box2
- func (this *Box2) GetParameter(point *Vector2, optionalTarget *Vector2) *Vector2
- func (this *Box2) Intersect(box *Box2) *Box2
- func (this *Box2) IsIntersectionBox(box *Box2) bool
- func (this *Box2) MakeEmpty() *Box2
- func (this *Box2) Set(min, max *Vector2) *Box2
- func (this *Box2) SetFromCenterAndSize(center, size *Vector2) *Box2
- func (this *Box2) SetFromPoints(points []*Vector2) *Box2
- func (this *Box2) Size(optionalTarget *Vector2) *Vector2
- func (this *Box2) Translate(offset *Vector2) *Box2
- func (this *Box2) Union(box *Box2) *Box2
- type Box3
- func (this *Box3) ApplyMatrix4(matrix *Matrix4) *Box3
- func (this *Box3) Center(optionalTarget *Vector3) *Vector3
- func (this *Box3) ClampPoint(point *Vector3, optionalTarget *Vector3) *Vector3
- func (this *Box3) Clone() *Box3
- func (this *Box3) ContainsBox(box *Box3) bool
- func (this *Box3) ContainsPoint(point *Vector3) bool
- func (this *Box3) Copy(box *Box3) *Box3
- func (this *Box3) DistanceToPoint(point *Vector3) float32
- func (this *Box3) Empty() bool
- func (this *Box3) Equals(box *Box3) bool
- func (this *Box3) ExpandByPoint(point *Vector3) *Box3
- func (this *Box3) ExpandByScalar(scalar float32) *Box3
- func (this *Box3) ExpandByVector(vector *Vector3) *Box3
- func (this *Box3) GetBoundingSphere(optionalTarget *Sphere) *Sphere
- func (this *Box3) GetParameter(point *Vector3, optionalTarget *Vector3) *Vector3
- func (this *Box3) Intersect(box *Box3) *Box3
- func (this *Box3) IsIntersectionBox(box *Box3) bool
- func (this *Box3) MakeEmpty() *Box3
- func (this *Box3) Set(min, max *Vector3) *Box3
- func (this *Box3) SetFromCenterAndSize(center, size *Vector3) *Box3
- func (this *Box3) SetFromPoints(points []Vector3) *Box3
- func (this *Box3) Size(optionalTarget *Vector3) *Vector3
- func (this *Box3) Translate(offset *Vector3) *Box3
- func (this *Box3) Union(box *Box3) *Box3
- type Color
- func (c *Color) Add(other *Color) *Color
- func (c *Color) AddColors(color1, color2 *Color) *Color
- func (c *Color) AddScalar(s float32) *Color
- func (c *Color) Clone() *Color
- func (c *Color) Equals(other *Color) bool
- func (c *Color) Lerp(color *Color, alpha float32) *Color
- func (c *Color) Multiply(other *Color) *Color
- func (c *Color) MultiplyScalar(v float32) *Color
- func (c *Color) Set(r, g, b float32) *Color
- func (c *Color) SetHex(value uint) *Color
- func (c *Color) SetName(name string) *Color
- type Color4
- type Frustum
- func (this *Frustum) Clone() *Frustum
- func (this *Frustum) ContainsPoint(point *Vector3) bool
- func (this *Frustum) Copy(frustum *Frustum) *Frustum
- func (this *Frustum) IntersectsBox(box *Box3) bool
- func (this *Frustum) IntersectsSphere(sphere *Sphere) bool
- func (this *Frustum) Set(p0, p1, p2, p3, p4, p5 *Plane) *Frustum
- func (this *Frustum) SetFromMatrix(m *Matrix4) *Frustum
- type Line3
- func (this *Line3) ApplyMatrix4(matrix *Matrix4) *Line3
- func (this *Line3) At(t float32, optionalTarget *Vector3) *Vector3
- func (this *Line3) Center(optionalTarget *Vector3) *Vector3
- func (this *Line3) Clone() *Line3
- func (this *Line3) ClosestPointToPoint(point *Vector3, clampToLine bool, optionalTarget *Vector3) *Vector3
- func (this *Line3) ClosestPointToPointParameter() func(*Vector3, bool) float32
- func (this *Line3) Copy(line *Line3) *Line3
- func (this *Line3) Delta(optionalTarget *Vector3) *Vector3
- func (this *Line3) Distance() float32
- func (this *Line3) DistanceSq() float32
- func (this *Line3) Equals(line *Line3) bool
- func (this *Line3) Set(start, end *Vector3) *Line3
- type Matrix3
- func (m *Matrix3) ApplyToVector3Array(array []float32, offset int, length int) []float32
- func (m *Matrix3) Clone() *Matrix3
- func (m *Matrix3) Copy(src *Matrix3) *Matrix3
- func (m *Matrix3) Determinant() float32
- func (m *Matrix3) FlattenToArrayOffset(array []float32, offset int) []float32
- func (m *Matrix3) FromArray(array []float32) *Matrix3
- func (m *Matrix3) GetInverse(src *Matrix4, throwOnInvertible bool) *Matrix3
- func (m *Matrix3) GetNormalMatrix(src *Matrix4) *Matrix3
- func (m *Matrix3) Identity() *Matrix3
- func (m *Matrix3) MultiplyScalar(s float32) *Matrix3
- func (m *Matrix3) Set(n11, n12, n13, n21, n22, n23, n31, n32, n33 float32) *Matrix3
- func (m *Matrix3) ToArray() []float32
- func (m *Matrix3) Transpose() *Matrix3
- func (m *Matrix3) TransposeIntoArray(r []float32) *Matrix3
- type Matrix4
- func (m *Matrix4) ApplyToVector3Array(array []float32, offset int, length int) []float32
- func (m *Matrix4) Clone() *Matrix4
- func (m *Matrix4) Compose(position *Vector3, quaternion *Quaternion, scale *Vector3) *Matrix4
- func (m *Matrix4) Copy(src *Matrix4) *Matrix4
- func (m *Matrix4) CopyPosition(src *Matrix4) *Matrix4
- func (m *Matrix4) Decompose(position *Vector3, quaternion *Quaternion, scale *Vector3) *Matrix4
- func (m *Matrix4) Determinant() float32
- func (m *Matrix4) ExtractBasis(xAxis, yAxis, zAxis *Vector3) *Matrix4
- func (m *Matrix4) ExtractRotation(src *Matrix4) *Matrix4
- func (m *Matrix4) FlattenToArrayOffset(array []float32, offset int) []float32
- func (m *Matrix4) FromArray(array [16]float32) *Matrix4
- func (m *Matrix4) GetInverse(src *Matrix4, throwOnInvertible bool) *Matrix4
- func (m *Matrix4) GetMaxScaleOnAxis() float32
- func (m *Matrix4) Identity() *Matrix4
- func (m *Matrix4) LookAt(eye, target, up *Vector3) *Matrix4
- func (m *Matrix4) MakeBasis(xAxis, yAxis, zAxis *Vector3) *Matrix4
- func (m *Matrix4) MakeFrustum(left, right, bottom, top, near, far float32) *Matrix4
- func (m *Matrix4) MakeOrthographic(left, right, top, bottom, near, far float32) *Matrix4
- func (m *Matrix4) MakePerspective(fov, aspect, near, far float32) *Matrix4
- func (m *Matrix4) MakeRotationAxis(axis *Vector3, angle float32) *Matrix4
- func (m *Matrix4) MakeRotationFromEuler(euler *Vector3) *Matrix4
- func (m *Matrix4) MakeRotationFromQuaternion(q *Quaternion) *Matrix4
- func (m *Matrix4) MakeRotationX(theta float32) *Matrix4
- func (m *Matrix4) MakeRotationY(theta float32) *Matrix4
- func (m *Matrix4) MakeRotationZ(theta float32) *Matrix4
- func (m *Matrix4) MakeScale(x, y, z float32) *Matrix4
- func (m *Matrix4) MakeTranslation(x, y, z float32) *Matrix4
- func (m *Matrix4) Multiply(src *Matrix4) *Matrix4
- func (m *Matrix4) MultiplyMatrices(a, b *Matrix4) *Matrix4
- func (m *Matrix4) MultiplyScalar(s float32) *Matrix4
- func (m *Matrix4) MultiplyToArray(a, b *Matrix4, r []float32) *Matrix4
- func (m *Matrix4) Scale(v *Vector3) *Matrix4
- func (m *Matrix4) Set(...) *Matrix4
- func (m *Matrix4) SetPosition(v *Vector3) *Matrix4
- func (m *Matrix4) ToArray() []float32
- func (m *Matrix4) Transpose() *Matrix4
- type Plane
- func (this *Plane) ApplyMatrix4(matrix *Matrix4, optionalNormalMatrix *Matrix3) *Plane
- func (this *Plane) Clone(plane *Plane) *Plane
- func (this *Plane) CoplanarPoint(optionalTarget *Vector3) *Vector3
- func (this *Plane) Copy(plane *Plane) *Plane
- func (this *Plane) DistanceToPoint(point *Vector3) float32
- func (this *Plane) DistanceToSphere(sphere *Sphere) float32
- func (this *Plane) Equals(plane *Plane) bool
- func (this *Plane) IntersectLine(line *Line3, optionalTarget *Vector3) *Vector3
- func (this *Plane) IsIntersectionLine(line *Line3) bool
- func (this *Plane) Negate() *Plane
- func (this *Plane) Normalize() *Plane
- func (this *Plane) OrthoPoint(point *Vector3, optionalTarget *Vector3) *Vector3
- func (this *Plane) ProjectPoint(point *Vector3, optionalTarget *Vector3) *Vector3
- func (this *Plane) Set(normal *Vector3, constant float32) *Plane
- func (this *Plane) SetComponents(x, y, z, w float32) *Plane
- func (this *Plane) SetFromCoplanarPoints(a, b, c *Vector3) *Plane
- func (this *Plane) SetFromNormalAndCoplanarPoint(normal *Vector3, point *Vector3) *Plane
- func (this *Plane) Translate(offset *Vector3) *Plane
- type Quaternion
- func (this *Quaternion) Conjugate() *Quaternion
- func (this *Quaternion) Copy(quaternion *Quaternion) *Quaternion
- func (this *Quaternion) Dot(v *Quaternion) float32
- func (this *Quaternion) Equals(quaternion *Quaternion) bool
- func (this *Quaternion) FromArray(array []float32, offset int) *Quaternion
- func (q *Quaternion) Inverse() *Quaternion
- func (q *Quaternion) IsIdentity() bool
- func (this *Quaternion) Length() float32
- func (this *Quaternion) Multiply(q *Quaternion) *Quaternion
- func (this *Quaternion) MultiplyQuaternions(a, b *Quaternion) *Quaternion
- func (this *Quaternion) Normalize() *Quaternion
- func (this *Quaternion) Set(x, y, z, w float32) *Quaternion
- func (q *Quaternion) SetFromAxisAngle(axis *Vector3, angle float32) *Quaternion
- func (q *Quaternion) SetFromEuler(euler *Vector3) *Quaternion
- func (this *Quaternion) SetFromRotationMatrix(m *Matrix4) *Quaternion
- func (this *Quaternion) SetFromUnitVectors(vFrom, vTo *Vector3) *Quaternion
- func (this *Quaternion) SetIdentity() *Quaternion
- func (this *Quaternion) SetW(val float32) *Quaternion
- func (this *Quaternion) SetX(val float32) *Quaternion
- func (this *Quaternion) SetY(val float32) *Quaternion
- func (this *Quaternion) SetZ(val float32) *Quaternion
- func (this *Quaternion) Slerp(qb *Quaternion, t float32) *Quaternion
- func (this *Quaternion) ToArray(array []float32, offset int) []float32
- func (this *Quaternion) W() float32
- func (this *Quaternion) X() float32
- func (this *Quaternion) Y() float32
- func (this *Quaternion) Z() float32
- type Ray
- func (ray *Ray) ApplyMatrix4(matrix4 *Matrix4) *Ray
- func (ray *Ray) At(t float32, optionalTarget *Vector3) *Vector3
- func (ray *Ray) Clone() *Ray
- func (ray *Ray) ClosestPointToPoint(point, optionalTarget *Vector3) *Vector3
- func (ray *Ray) Copy(other *Ray) *Ray
- func (ray *Ray) Direction() Vector3
- func (ray *Ray) DistanceSqToPoint(point *Vector3) float32
- func (ray *Ray) DistanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment *Vector3) float32
- func (ray *Ray) DistanceToPlane(plane *Plane) float32
- func (ray *Ray) DistanceToPoint(point *Vector3) float32
- func (ray *Ray) Equals(other *Ray) bool
- func (ray *Ray) IntersectBox(box *Box3, optionalTarget *Vector3) *Vector3
- func (ray *Ray) IntersectPlane(plane *Plane, optionalTarget *Vector3) *Vector3
- func (ray *Ray) IntersectSphere(sphere *Sphere, optionalTarget *Vector3) *Vector3
- func (ray *Ray) IntersectTriangle(a, b, c *Vector3, backfaceCulling bool, point *Vector3) bool
- func (ray *Ray) IsIntersectPlane(plane *Plane) bool
- func (ray *Ray) IsIntersectionBox(box *Box3) bool
- func (ray *Ray) IsIntersectionSphere(sphere *Sphere) bool
- func (ray *Ray) Origin() Vector3
- func (ray *Ray) Recast(t float32) *Ray
- func (ray *Ray) Set(origin, direction *Vector3) *Ray
- type Sphere
- func (s *Sphere) ApplyMatrix4(matrix *Matrix4) *Sphere
- func (this *Sphere) ClampPoint(point *Vector3, optionalTarget *Vector3) *Vector3
- func (s *Sphere) ContainsPoint(point *Vector3) bool
- func (this *Sphere) Copy(sphere *Sphere) *Sphere
- func (this *Sphere) DistanceToPoint(point *Vector3) float32
- func (s *Sphere) Empty(sphere *Sphere) bool
- func (s *Sphere) GetBoundingBox(optionalTarget *Box3) *Box3
- func (this *Sphere) IntersectSphere(sphere *Sphere) bool
- func (s *Sphere) Set(center *Vector3, radius float32) *Sphere
- func (this *Sphere) SetFromPoints(points []Vector3, optionalCenter *Vector3) *Sphere
- func (this *Sphere) Translate(offset *Vector3) *Sphere
- type Spline
- type Triangle
- func (this *Triangle) Area() float32
- func (this *Triangle) BarycoordFromPoint(point, optionalTarget *Vector3) *Vector3
- func (this *Triangle) Clone(triangle *Triangle) *Triangle
- func (this *Triangle) ContainsPoint(point *Vector3) bool
- func (this *Triangle) Copy(triangle *Triangle) *Triangle
- func (this *Triangle) Equals(triangle *Triangle) bool
- func (this *Triangle) Midpoint(optionalTarget *Vector3) *Vector3
- func (this *Triangle) Normal(optionalTarget *Vector3) *Vector3
- func (this *Triangle) Plane(optionalTarget *Plane) *Plane
- func (this *Triangle) Set(a, b, c *Vector3) *Triangle
- func (this *Triangle) SetFromPointsAndIndices(points []*Vector3, i0, i1, i2 int) *Triangle
- type Vector2
- func (this *Vector2) Add(v *Vector2) *Vector2
- func (this *Vector2) AddScalar(s float32) *Vector2
- func (this *Vector2) AddVectors(a, b *Vector2) *Vector2
- func (this *Vector2) Ceil() *Vector2
- func (this *Vector2) Clamp(min, max *Vector2) *Vector2
- func (this *Vector2) ClampScalar(minVal, maxVal float32) *Vector2
- func (this *Vector2) Close() *Vector2
- func (this *Vector2) Copy(v *Vector2) *Vector2
- func (this *Vector2) DistanceTo(v *Vector2) float32
- func (this *Vector2) DistanceToSquared(v *Vector2) float32
- func (this *Vector2) Divide(v *Vector2) *Vector2
- func (this *Vector2) DivideScalar(scalar float32) *Vector2
- func (this *Vector2) Dot(v *Vector2) float32
- func (this *Vector2) Equals(v *Vector2) bool
- func (this *Vector2) Floor() *Vector2
- func (this *Vector2) FromArray(array []float32, offset int) *Vector2
- func (this *Vector2) GetComponent(index int) float32
- func (this *Vector2) Length() float32
- func (this *Vector2) LengthSq() float32
- func (this *Vector2) Lerp(v *Vector2, alpha float32) *Vector2
- func (this *Vector2) LerpVectors(v1, v2 *Vector2, alpha float32) *Vector2
- func (this *Vector2) Max(v *Vector2) *Vector2
- func (this *Vector2) Min(v *Vector2) *Vector2
- func (this *Vector2) Multiply(v *Vector2) *Vector2
- func (this *Vector2) MultiplyScalar(s float32) *Vector2
- func (this *Vector2) Negate() *Vector2
- func (this *Vector2) Normalize() *Vector2
- func (this *Vector2) Round() *Vector2
- func (this *Vector2) RoundToZero() *Vector2
- func (this *Vector2) Set(x, y float32) *Vector2
- func (this *Vector2) SetComponent(index int, value float32)
- func (this *Vector2) SetLength(l float32) *Vector2
- func (this *Vector2) SetX(x float32) *Vector2
- func (this *Vector2) SetY(y float32) *Vector2
- func (this *Vector2) Sub(v *Vector2) *Vector2
- func (this *Vector2) SubScalar(s float32) *Vector2
- func (this *Vector2) SubVectors(a, b *Vector2) *Vector2
- func (this *Vector2) ToArray(array []float32, offset int) []float32
- type Vector3
- func (v *Vector3) Add(src *Vector3) *Vector3
- func (v *Vector3) AddScalar(s float32) *Vector3
- func (v *Vector3) AddVectors(a, b *Vector3) *Vector3
- func (this *Vector3) AngleTo(v *Vector3) float32
- func (v *Vector3) ApplyAxisAngle(axis *Vector3, angle float32) *Vector3
- func (v *Vector3) ApplyMatrix3(m *Matrix3) *Vector3
- func (v *Vector3) ApplyMatrix4(m *Matrix4) *Vector3
- func (v *Vector3) ApplyProjection(m *Matrix4) *Vector3
- func (v *Vector3) ApplyQuaternion(q *Quaternion) *Vector3
- func (this *Vector3) Ceil() *Vector3
- func (this *Vector3) Clamp(min, max *Vector3) *Vector3
- func (this *Vector3) ClampScalar(minVal, maxVal float32) *Vector3
- func (this *Vector3) Clone() *Vector3
- func (v *Vector3) Copy(src *Vector3) *Vector3
- func (this *Vector3) Cross(v *Vector3) *Vector3
- func (this *Vector3) CrossVectors(a, b *Vector3) *Vector3
- func (this *Vector3) DistanceTo(v *Vector3) float32
- func (this *Vector3) DistanceToSquared(v *Vector3) float32
- func (v *Vector3) Divide(other *Vector3) *Vector3
- func (v *Vector3) DivideScalar(scalar float32) *Vector3
- func (this *Vector3) Dot(v *Vector3) float32
- func (this *Vector3) Equals(v *Vector3) bool
- func (this *Vector3) Floor() *Vector3
- func (v *Vector3) FromArray(array []float32, offset int) *Vector3
- func (this *Vector3) Length() float32
- func (this *Vector3) LengthManhattan(v *Vector3) float32
- func (this *Vector3) LengthSq() float32
- func (this *Vector3) Lerp(v *Vector3, alpha float32) *Vector3
- func (this *Vector3) LerpVectors(v1, v2 *Vector3, alpha float32) *Vector3
- func (v *Vector3) Max(other *Vector3) *Vector3
- func (v *Vector3) Min(other *Vector3) *Vector3
- func (v *Vector3) Multiply(a *Vector3) *Vector3
- func (v *Vector3) MultiplyScalar(s float32) *Vector3
- func (v *Vector3) MultiplyVectors(a, b *Vector3) *Vector3
- func (this *Vector3) Negate() *Vector3
- func (this *Vector3) Normalize() *Vector3
- func (this *Vector3) ProjectOnPlane(planeNormal *Vector3) *Vector3
- func (this *Vector3) ProjectOnVector(vector *Vector3) *Vector3
- func (this *Vector3) Reflect(normal *Vector3) *Vector3
- func (this *Vector3) Round() *Vector3
- func (this *Vector3) RoundToZero() *Vector3
- func (v *Vector3) Set(x, y, z float32) *Vector3
- func (v *Vector3) SetByName(name string, value float32)
- func (v *Vector3) SetComponent(index int, value float32)
- func (v *Vector3) SetFromMatrixColumn(index int, m *Matrix4) *Vector3
- func (v *Vector3) SetFromMatrixPosition(m *Matrix4) *Vector3
- func (this *Vector3) SetFromMatrixScale(m *Matrix4) *Vector3
- func (v *Vector3) SetFromQuaternion(q *Quaternion) *Vector3
- func (v *Vector3) SetFromRotationMatrix(m *Matrix4) *Vector3
- func (this *Vector3) SetLength(l float32) *Vector3
- func (v *Vector3) SetX(x float32) *Vector3
- func (v *Vector3) SetY(y float32) *Vector3
- func (v *Vector3) SetZ(z float32) *Vector3
- func (v *Vector3) Sub(p *Vector3) *Vector3
- func (v *Vector3) SubScalar(s float32) *Vector3
- func (v *Vector3) SubVectors(a, b *Vector3) *Vector3
- func (v *Vector3) ToArray(array []float32, offset int) []float32
- func (v *Vector3) TransformDirection(m *Matrix4) *Vector3
- type Vector4
- func (this *Vector4) Add(v *Vector4) *Vector4
- func (this *Vector4) AddScalar(s float32) *Vector4
- func (this *Vector4) AddVectors(a, b *Vector4) *Vector4
- func (this *Vector4) ApplyMatrix4(m *Matrix4) *Vector4
- func (this *Vector4) Ceil() *Vector4
- func (this *Vector4) Clamp(min, max *Vector4) *Vector4
- func (this *Vector4) ClampScalar(minVal, maxVal float32) *Vector4
- func (this *Vector4) Clone() *Vector4
- func (this *Vector4) Copy(v *Vector4) *Vector4
- func (this *Vector4) DivideScalar(scalar float32) *Vector4
- func (this *Vector4) Dot(v *Vector4) float32
- func (this *Vector4) Equals(v *Vector4) bool
- func (this *Vector4) Floor() *Vector4
- func (this *Vector4) FromArray(array []float32, offset int) *Vector4
- func (this *Vector4) GetComponent(index int) float32
- func (this *Vector4) Length() float32
- func (this *Vector4) LengthManhattan(v *Vector4) float32
- func (this *Vector4) LengthSq(v *Vector4) float32
- func (this *Vector4) Lerp(v *Vector4, alpha float32) *Vector4
- func (this *Vector4) LerpVectors(v1, v2 *Vector4, alpha float32) *Vector4
- func (this *Vector4) Max(v *Vector4) *Vector4
- func (this *Vector4) Min(v *Vector4) *Vector4
- func (this *Vector4) MultiplyScalar(scalar float32) *Vector4
- func (this *Vector4) Negate() *Vector4
- func (this *Vector4) Normalize() *Vector4
- func (this *Vector4) Round() *Vector4
- func (this *Vector4) RoundToZero() *Vector4
- func (v *Vector4) Set(x, y, z, w float32) *Vector4
- func (this *Vector4) SetAxisAngleFromQuaternion(q *Quaternion) *Vector4
- func (this *Vector4) SetAxisFromRotationMatrix(m *Matrix4) *Vector4
- func (this *Vector4) SetComponent(index int, value float32) *Vector4
- func (this *Vector4) SetLength(l float32) *Vector4
- func (v *Vector4) SetVector3(other *Vector3, w float32) *Vector4
- func (this *Vector4) Sub(v *Vector4) *Vector4
- func (this *Vector4) SubScalar(s float32) *Vector4
- func (this *Vector4) SubVectors(a, b *Vector4) *Vector4
- func (this *Vector4) ToArray(array []float32, offset int) []float32
Constants ¶
const Pi = math.Pi
Variables ¶
var Black = Color{0, 0, 0}
var Black4 = Color4{0, 0, 0, 1}
var Blue = Color{0, 0, 1}
var Blue4 = Color4{0, 0, 1, 1}
var Gray = Color{0.5, 0.5, 0.5}
var Gray4 = Color4{0.5, 0.5, 0.5, 1}
var Green = Color{0, 1, 0}
var Green4 = Color4{0, 1, 0, 1}
var Infinity = float32(math.Inf(1))
var Red = Color{1, 0, 0}
var Red4 = Color4{1, 0, 0, 1}
var Vector3Back = Vector3{0, 0, -1}
var Vector3Down = Vector3{0, -1, 0}
var Vector3Front = Vector3{0, 0, 1}
var Vector3Left = Vector3{-1, 0, 0}
var Vector3Right = Vector3{1, 0, 0}
var Vector3Up = Vector3{0, 1, 0}
var Vector3Zero = Vector3{0, 0, 0}
Common Vector3 values
var White = Color{1, 1, 1}
var White4 = Color4{1, 1, 1, 1}
Functions ¶
func ClampBotton ¶
func ContainsPoint ¶
Types ¶
type ArrayF32 ¶
type ArrayF32 []float32
func NewArrayF32 ¶
NewArrayF32 creates a returns a new array of floats with the specified initial size and capacity
func (*ArrayF32) AppendColor ¶
func (*ArrayF32) AppendVector2 ¶
func (*ArrayF32) AppendVector3 ¶
func (ArrayF32) GetVector2 ¶
func (ArrayF32) GetVector3 ¶
func (ArrayF32) SetVector2 ¶
func (ArrayF32) SetVector3 ¶
type ArrayU32 ¶
type ArrayU32 []uint32
func NewArrayU32 ¶
NewArrayU32 creates a returns a new array of uint32 with the specified initial size and capacity
type Box2 ¶
type Box2 struct {
// contains filtered or unexported fields
}
func (*Box2) ClampPoint ¶
func (*Box2) ContainsBox ¶
func (*Box2) ContainsPoint ¶
func (*Box2) DistanceToPoint ¶
func (*Box2) ExpandByPoint ¶
func (*Box2) ExpandByScalar ¶
func (*Box2) ExpandByVector ¶
func (*Box2) GetParameter ¶
func (*Box2) IsIntersectionBox ¶
func (*Box2) SetFromCenterAndSize ¶
func (*Box2) SetFromPoints ¶
type Box3 ¶
func (*Box3) ApplyMatrix4 ¶
func (*Box3) ClampPoint ¶
func (*Box3) ContainsBox ¶
func (*Box3) ContainsPoint ¶
func (*Box3) DistanceToPoint ¶
func (*Box3) ExpandByPoint ¶
func (*Box3) ExpandByScalar ¶
func (*Box3) ExpandByVector ¶
func (*Box3) GetBoundingSphere ¶
func (*Box3) GetParameter ¶
func (*Box3) IsIntersectionBox ¶
func (*Box3) SetFromCenterAndSize ¶
func (*Box3) SetFromPoints ¶
type Color ¶
func NewColor ¶
NewColor creates and returns a pointer to a new color with the specified RGB components
func NewColorHex ¶
NewColorHex creates and returns a pointer to a new color with its RGB components from the specified hex value
func (*Color) MultiplyScalar ¶
type Color4 ¶
func (*Color4) MultiplyScalar ¶
func (*Color4) SetHex ¶
SetHex sets the color RGB components from the specified integer interpreted as a color hex number Alpha component is not modified
type Frustum ¶
type Frustum struct {
// contains filtered or unexported fields
}
func NewFrustum ¶
func (*Frustum) ContainsPoint ¶
func (*Frustum) IntersectsBox ¶
func (*Frustum) IntersectsSphere ¶
func (*Frustum) SetFromMatrix ¶
type Line3 ¶
type Line3 struct {
// contains filtered or unexported fields
}
func (*Line3) ApplyMatrix4 ¶
func (*Line3) ClosestPointToPoint ¶
func (*Line3) ClosestPointToPointParameter ¶
func (*Line3) DistanceSq ¶
type Matrix3 ¶
type Matrix3 [9]float32
func NewMatrix3 ¶
func NewMatrix3() *Matrix3
func (*Matrix3) ApplyToVector3Array ¶
func (*Matrix3) Determinant ¶
func (*Matrix3) FlattenToArrayOffset ¶
func (*Matrix3) GetInverse ¶
func (*Matrix3) GetNormalMatrix ¶
func (*Matrix3) MultiplyScalar ¶
func (*Matrix3) TransposeIntoArray ¶
type Matrix4 ¶
type Matrix4 [16]float32
func NewMatrix4 ¶
func NewMatrix4() *Matrix4
func (*Matrix4) ApplyToVector3Array ¶
func (*Matrix4) Compose ¶
func (m *Matrix4) Compose(position *Vector3, quaternion *Quaternion, scale *Vector3) *Matrix4
func (*Matrix4) CopyPosition ¶
Copy position copies the position elements of the specified matrix into this one.
func (*Matrix4) Decompose ¶
func (m *Matrix4) Decompose(position *Vector3, quaternion *Quaternion, scale *Vector3) *Matrix4
func (*Matrix4) Determinant ¶
Determinant calculates and returns the determinat of this matrix.
func (*Matrix4) ExtractBasis ¶
func (*Matrix4) ExtractRotation ¶
func (*Matrix4) FlattenToArrayOffset ¶
func (*Matrix4) GetInverse ¶
GetInverse set this matrix to the inverse of the specified matrix "src".
func (*Matrix4) GetMaxScaleOnAxis ¶
func (*Matrix4) MakeFrustum ¶
func (*Matrix4) MakeOrthographic ¶
func (*Matrix4) MakePerspective ¶
func (*Matrix4) MakeRotationAxis ¶
func (*Matrix4) MakeRotationFromEuler ¶
func (*Matrix4) MakeRotationFromQuaternion ¶
func (m *Matrix4) MakeRotationFromQuaternion(q *Quaternion) *Matrix4
func (*Matrix4) MakeRotationX ¶
func (*Matrix4) MakeRotationY ¶
func (*Matrix4) MakeRotationZ ¶
func (*Matrix4) MakeTranslation ¶
func (*Matrix4) MultiplyMatrices ¶
MultiplyMatrices multiply matrix 'a' by 'b' storing the result in this matrix.
func (*Matrix4) MultiplyScalar ¶
MultiplyScalar multiplies each element of this matrix by the specified scalar.
func (*Matrix4) MultiplyToArray ¶
func (*Matrix4) Scale ¶
Scale multiply the first column of this matrix by the vector X component, the second column by the vector Y component and the third column by the vector Z component. The matrix fourth column is unchanged.
func (*Matrix4) SetPosition ¶
type Plane ¶
type Plane struct {
// contains filtered or unexported fields
}
func (*Plane) ApplyMatrix4 ¶
func (*Plane) CoplanarPoint ¶
func (*Plane) DistanceToPoint ¶
func (*Plane) DistanceToSphere ¶
func (*Plane) IntersectLine ¶
func (*Plane) IsIntersectionLine ¶
func (*Plane) OrthoPoint ¶
func (*Plane) ProjectPoint ¶
func (*Plane) SetComponents ¶
func (*Plane) SetFromCoplanarPoints ¶
func (*Plane) SetFromNormalAndCoplanarPoint ¶
type Quaternion ¶
type Quaternion struct {
// contains filtered or unexported fields
}
func NewQuaternion ¶
func NewQuaternion(x, y, z, w float32) *Quaternion
func (*Quaternion) Conjugate ¶
func (this *Quaternion) Conjugate() *Quaternion
func (*Quaternion) Copy ¶
func (this *Quaternion) Copy(quaternion *Quaternion) *Quaternion
Copy copies the specified quaternion into this one.
func (*Quaternion) Dot ¶
func (this *Quaternion) Dot(v *Quaternion) float32
func (*Quaternion) Equals ¶
func (this *Quaternion) Equals(quaternion *Quaternion) bool
func (*Quaternion) FromArray ¶
func (this *Quaternion) FromArray(array []float32, offset int) *Quaternion
func (*Quaternion) Inverse ¶
func (q *Quaternion) Inverse() *Quaternion
func (*Quaternion) IsIdentity ¶
func (q *Quaternion) IsIdentity() bool
func (*Quaternion) Length ¶
func (this *Quaternion) Length() float32
func (*Quaternion) Multiply ¶
func (this *Quaternion) Multiply(q *Quaternion) *Quaternion
func (*Quaternion) MultiplyQuaternions ¶
func (this *Quaternion) MultiplyQuaternions(a, b *Quaternion) *Quaternion
func (*Quaternion) Normalize ¶
func (this *Quaternion) Normalize() *Quaternion
func (*Quaternion) Set ¶
func (this *Quaternion) Set(x, y, z, w float32) *Quaternion
func (*Quaternion) SetFromAxisAngle ¶
func (q *Quaternion) SetFromAxisAngle(axis *Vector3, angle float32) *Quaternion
SetFromAxisAngle sets this quaternion with the rotation specified by the given axis and angle.
func (*Quaternion) SetFromEuler ¶
func (q *Quaternion) SetFromEuler(euler *Vector3) *Quaternion
SetFromEuler sets this quaternion from the specified vector with euler angles for each axis. It is assumed that the Euler angles are in XYZ order.
func (*Quaternion) SetFromRotationMatrix ¶
func (this *Quaternion) SetFromRotationMatrix(m *Matrix4) *Quaternion
func (*Quaternion) SetFromUnitVectors ¶
func (this *Quaternion) SetFromUnitVectors(vFrom, vTo *Vector3) *Quaternion
func (*Quaternion) SetIdentity ¶
func (this *Quaternion) SetIdentity() *Quaternion
func (*Quaternion) SetW ¶
func (this *Quaternion) SetW(val float32) *Quaternion
func (*Quaternion) SetX ¶
func (this *Quaternion) SetX(val float32) *Quaternion
func (*Quaternion) SetY ¶
func (this *Quaternion) SetY(val float32) *Quaternion
func (*Quaternion) SetZ ¶
func (this *Quaternion) SetZ(val float32) *Quaternion
func (*Quaternion) Slerp ¶
func (this *Quaternion) Slerp(qb *Quaternion, t float32) *Quaternion
func (*Quaternion) W ¶
func (this *Quaternion) W() float32
func (*Quaternion) X ¶
func (this *Quaternion) X() float32
func (*Quaternion) Y ¶
func (this *Quaternion) Y() float32
func (*Quaternion) Z ¶
func (this *Quaternion) Z() float32
type Ray ¶
type Ray struct {
// contains filtered or unexported fields
}
func NewRay ¶
NewRay creates and returns a pointer to a Ray object with the specified origin and direction vectors. If a nil pointer is supplied for any of the parameters, the zero vector will be used.
func (*Ray) ApplyMatrix4 ¶
ApplyMatrix4 multiplies this ray origin and direction by the specified matrix4, basically transforming this ray coordinates.
func (*Ray) At ¶
At sets the target position vector at the specified distance from the ray origin and along its direction.
func (*Ray) ClosestPointToPoint ¶
func (*Ray) DistanceSqToPoint ¶
DistanceSqToPoint returns the smallest squared distance from the ray direction vector to the specified point. If the ray was pointed directly at the point this distance would be 0.
func (*Ray) DistanceSqToSegment ¶
func (ray *Ray) DistanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment *Vector3) float32
DistanceSqToSegment returns the smallest squared distance from this ray to the line segment from v0 to v1. If optionalPointOnRay Vector3 is not nil, it is set with the coordinates of the point on the ray if optionalPointOnSegment Vector3 is not nil, it is set with the coordinates of the point on the segment
func (*Ray) DistanceToPlane ¶
func (*Ray) DistanceToPoint ¶
func (*Ray) IntersectBox ¶
func (*Ray) IntersectPlane ¶
func (*Ray) IntersectSphere ¶
func (*Ray) IntersectTriangle ¶
IntersectTriangle checks if this ray intersects the triangle with the face defined by points a, b, c. Returns true if it intersects and sets the point parameter with the intersected point coordinates. If backfaceCulling is false it ignores the intersection if the face is not oriented in the ray direction.
func (*Ray) IsIntersectPlane ¶
IsIntersectPlane checks if this ray intersects the specified plane
func (*Ray) IsIntersectionBox ¶
func (*Ray) IsIntersectionSphere ¶
IsIntersectionSphere checks if this ray intersects with the specified sphere
type Sphere ¶
type Sphere struct { Center Vector3 // center of the sphere Radius float32 // radius of the sphere }
func NewSphere ¶
NewSphere creates and returns a pointer to a new sphere with the specified center and radius
func (*Sphere) ApplyMatrix4 ¶
ApplyMatrix4 applies the specified matrix transform to this sphere
func (*Sphere) ClampPoint ¶
func (*Sphere) ContainsPoint ¶
ContainsPoint checks if this sphere contains the specified point
func (*Sphere) DistanceToPoint ¶
func (*Sphere) GetBoundingBox ¶
func (*Sphere) IntersectSphere ¶
func (*Sphere) SetFromPoints ¶
type Spline ¶
type Spline struct {
// contains filtered or unexported fields
}
func (*Spline) InitFromArray ¶
type Triangle ¶
type Triangle struct {
// contains filtered or unexported fields
}
func NewTriangle ¶
func (*Triangle) BarycoordFromPoint ¶
func (*Triangle) ContainsPoint ¶
type Vector2 ¶
func NewVector2 ¶
func (*Vector2) AddVectors ¶
func (*Vector2) ClampScalar ¶
func (*Vector2) DistanceTo ¶
func (*Vector2) DistanceToSquared ¶
func (*Vector2) DivideScalar ¶
func (*Vector2) GetComponent ¶
func (*Vector2) LerpVectors ¶
func (*Vector2) MultiplyScalar ¶
func (*Vector2) RoundToZero ¶
func (*Vector2) SetComponent ¶
func (*Vector2) SubVectors ¶
type Vector3 ¶
func BarycoordFromPoint ¶
func NewVector3 ¶
NewVector creates and returns a pointer to a Vector3 type
func (*Vector3) AddVectors ¶
AddVectors adds the specified vectors and saves the result in this vector: v = a * b
func (*Vector3) ApplyAxisAngle ¶
ApplyAxisAngle rotates the vertex around the specified axis by the specified angle
func (*Vector3) ApplyMatrix3 ¶
ApplyMatrix3 multiplies the specified 3x3 matrix by this vector: v = m * v
func (*Vector3) ApplyMatrix4 ¶
ApplyMatrix4 multiplies the specified 4x4 matrix by this vector: v = m * v
func (*Vector3) ApplyProjection ¶
func (*Vector3) ApplyQuaternion ¶
func (v *Vector3) ApplyQuaternion(q *Quaternion) *Vector3
ApplyQuaternion transforms this vector by multiplying it by the specified quaternion and then by the quaternion inverse. It basically applies the rotation encoded in the quaternion to this vector. v = q * v * inverse(q)
func (*Vector3) ClampScalar ¶
func (*Vector3) CrossVectors ¶
func (*Vector3) DistanceTo ¶
func (*Vector3) DistanceToSquared ¶
func (*Vector3) DivideScalar ¶
func (*Vector3) LengthManhattan ¶
func (*Vector3) LerpVectors ¶
func (*Vector3) MultiplyScalar ¶
MultiplyScalar multiples this vector by the specified scalar: v = v * s
func (*Vector3) MultiplyVectors ¶
MultiplyVectors multiply the specified vectors storing the result in this vector: v = a * b
func (*Vector3) ProjectOnPlane ¶
func (*Vector3) ProjectOnVector ¶
func (*Vector3) RoundToZero ¶
func (*Vector3) SetByName ¶
SetByName sets the value of this vector component specified by its name: "x|Z", "y|Y", or "z|Z".
func (*Vector3) SetComponent ¶
SetComponent sets the value of this vector component specified by its index: X=0, Y=1, Z=2
func (*Vector3) SetFromMatrixColumn ¶
SetFromMatrixColumn set this vector with the column at index 'index' of the 'm' matrix.
func (*Vector3) SetFromMatrixPosition ¶
SetFromMatrixPosition set this vector from translation coordinates in the specified transformation matrix.
func (*Vector3) SetFromMatrixScale ¶
func (*Vector3) SetFromQuaternion ¶
func (v *Vector3) SetFromQuaternion(q *Quaternion) *Vector3
SetFromQuaternion sets this vector components to the Euler angles from the specified quaternion
func (*Vector3) SetFromRotationMatrix ¶
SetFromRotationMatrix sets this vector components to the Euler angles from the specified pure rotation matrix.
func (*Vector3) SubVectors ¶
SubVectors subtracts the specified vectors and stores the result in this vector: v = a - b
func (*Vector3) TransformDirection ¶
type Vector4 ¶
func NewVector4 ¶
func (*Vector4) AddVectors ¶
func (*Vector4) ApplyMatrix4 ¶
func (*Vector4) ClampScalar ¶
func (*Vector4) DivideScalar ¶
func (*Vector4) GetComponent ¶
func (*Vector4) LengthManhattan ¶
func (*Vector4) LerpVectors ¶
func (*Vector4) MultiplyScalar ¶
func (*Vector4) RoundToZero ¶
func (*Vector4) SetAxisAngleFromQuaternion ¶
func (this *Vector4) SetAxisAngleFromQuaternion(q *Quaternion) *Vector4
func (*Vector4) SetAxisFromRotationMatrix ¶
func (*Vector4) SetVector3 ¶
SetVector3 sets this vector from another Vector3 and 'w' value