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 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) AppendColor4(v ...*Color4)
- func (a *ArrayF32) AppendVector2(v ...*Vector2)
- func (a *ArrayF32) AppendVector3(v ...*Vector3)
- func (a *ArrayF32) AppendVector4(v ...*Vector4)
- func (a *ArrayF32) Bytes() int
- func (a ArrayF32) GetColor(pos int, v *Color)
- func (a ArrayF32) GetColor4(pos int, v *Color4)
- func (a ArrayF32) GetMatrix4(pos int, m *Matrix4)
- func (a ArrayF32) GetVector2(pos int, v *Vector2)
- func (a ArrayF32) GetVector3(pos int, v *Vector3)
- func (a ArrayF32) GetVector4(pos int, v *Vector4)
- func (a *ArrayF32) Len() int
- func (a ArrayF32) Set(pos int, v ...float32)
- func (a ArrayF32) SetColor(pos int, v *Color)
- func (a ArrayF32) SetColor4(pos int, v *Color4)
- func (a ArrayF32) SetVector2(pos int, v *Vector2)
- func (a ArrayF32) SetVector3(pos int, v *Vector3)
- func (a ArrayF32) SetVector4(pos int, v *Vector4)
- func (a *ArrayF32) Size() int
- func (a ArrayF32) ToFloat32() []float32
- type ArrayU32
- type Box2
- func (b *Box2) Center(optionalTarget *Vector2) *Vector2
- func (b *Box2) ClampPoint(point *Vector2, optionalTarget *Vector2) *Vector2
- func (b *Box2) ContainsBox(other *Box2) bool
- func (b *Box2) ContainsPoint(point *Vector2) bool
- func (b *Box2) Copy(box *Box2) *Box2
- func (b *Box2) DistanceToPoint(point *Vector2) float32
- func (b *Box2) Empty() bool
- func (b *Box2) Equals(other *Box2) bool
- func (b *Box2) ExpandByPoint(point *Vector2) *Box2
- func (b *Box2) ExpandByScalar(scalar float32) *Box2
- func (b *Box2) ExpandByVector(vector *Vector2) *Box2
- func (b *Box2) Intersect(other *Box2) *Box2
- func (b *Box2) IsIntersectionBox(other *Box2) bool
- func (b *Box2) MakeEmpty() *Box2
- func (b *Box2) Set(min, max *Vector2) *Box2
- func (b *Box2) SetFromCenterAndSize(center, size *Vector2) *Box2
- func (b *Box2) SetFromPoints(points []*Vector2) *Box2
- func (b *Box2) Size(optionalTarget *Vector2) *Vector2
- func (b *Box2) Translate(offset *Vector2) *Box2
- func (b *Box2) Union(other *Box2) *Box2
- type Box3
- func (b *Box3) ApplyMatrix4(m *Matrix4) *Box3
- func (b *Box3) Center(optionalTarget *Vector3) *Vector3
- func (b *Box3) ClampPoint(point *Vector3, optionalTarget *Vector3) *Vector3
- func (b *Box3) Clone() *Box3
- func (b *Box3) ContainsBox(box *Box3) bool
- func (b *Box3) ContainsPoint(point *Vector3) bool
- func (b *Box3) Copy(other *Box3) *Box3
- func (b *Box3) DistanceToPoint(point *Vector3) float32
- func (b *Box3) Empty() bool
- func (b *Box3) Equals(other *Box3) bool
- func (b *Box3) ExpandByPoint(point *Vector3) *Box3
- func (b *Box3) ExpandByScalar(scalar float32) *Box3
- func (b *Box3) ExpandByVector(vector *Vector3) *Box3
- func (b *Box3) GetBoundingSphere(optionalTarget *Sphere) *Sphere
- func (b *Box3) Intersect(other *Box3) *Box3
- func (b *Box3) IsIntersectionBox(other *Box3) bool
- func (b *Box3) MakeEmpty() *Box3
- func (b *Box3) Set(min, max *Vector3) *Box3
- func (b *Box3) SetFromCenterAndSize(center, size *Vector3) *Box3
- func (b *Box3) SetFromPoints(points []Vector3) *Box3
- func (b *Box3) Size(optionalTarget *Vector3) *Vector3
- func (b *Box3) Translate(offset *Vector3) *Box3
- func (b *Box3) Union(other *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) 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
- func (c *Color4) Add(other *Color4) *Color4
- func (c *Color4) FromColor(other *Color, alpha float32)
- func (c *Color4) MultiplyScalar(v float32) *Color4
- func (c *Color4) Set(r, g, b, a float32) *Color4
- func (c *Color4) SetHex(value uint) *Color4
- func (c *Color4) SetName(name string) *Color4
- func (c *Color4) ToColor() Color
- type Curve
- func NewBezierCubic(origin, control1, control2, destination *Vector3, npoints int) *Curve
- func NewBezierQuadratic(origin, control, destination *Vector3, npoints int) *Curve
- func NewCatmullRomSpline(points []*Vector3, npoints int, closed bool) *Curve
- func NewHermiteSpline(origin, tangent1, destination, tangent2 *Vector3, npoints int) *Curve
- type Frustum
- func (f *Frustum) Clone() *Frustum
- func (f *Frustum) ContainsPoint(point *Vector3) bool
- func (f *Frustum) Copy(frustum *Frustum) *Frustum
- func (f *Frustum) IntersectsBox(box *Box3) bool
- func (f *Frustum) IntersectsSphere(sphere *Sphere) bool
- func (f *Frustum) Set(p0, p1, p2, p3, p4, p5 *Plane) *Frustum
- func (f *Frustum) SetFromMatrix(m *Matrix4) *Frustum
- type Line3
- func (l *Line3) ApplyMatrix4(matrix *Matrix4) *Line3
- func (l *Line3) Center(optionalTarget *Vector3) *Vector3
- func (l *Line3) Clone() *Line3
- func (l *Line3) Copy(other *Line3) *Line3
- func (l *Line3) Delta(optionalTarget *Vector3) *Vector3
- func (l *Line3) Distance() float32
- func (l *Line3) DistanceSq() float32
- func (l *Line3) Equals(other *Line3) bool
- func (l *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) FromArray(array []float32, offset int) *Matrix3
- func (m *Matrix3) GetInverse(src *Matrix3) error
- func (m *Matrix3) GetNormalMatrix(src *Matrix4) error
- func (m *Matrix3) Identity() *Matrix3
- func (m *Matrix3) MakeRotationFromQuaternion(q *Quaternion) *Matrix3
- func (m *Matrix3) Multiply(other *Matrix3) *Matrix3
- func (m *Matrix3) MultiplyMatrices(a, b *Matrix3) *Matrix3
- func (m *Matrix3) MultiplyScalar(s float32) *Matrix3
- func (m *Matrix3) ScaleColumns(v *Vector3) *Matrix3
- func (m *Matrix3) Set(n11, n12, n13, n21, n22, n23, n31, n32, n33 float32) *Matrix3
- func (m *Matrix3) SetFromMatrix4(src *Matrix4) *Matrix3
- func (m *Matrix3) ToArray(array []float32, offset int) []float32
- func (m *Matrix3) Transpose() *Matrix3
- func (m *Matrix3) Zero() *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) FromArray(array []float32, offset int) *Matrix4
- func (m *Matrix4) GetColumn(i int) *Vector4
- func (m *Matrix4) GetColumnVector3(i int) *Vector3
- func (m *Matrix4) GetInverse(src *Matrix4) error
- func (m *Matrix4) GetMaxScaleOnAxis() float32
- func (m *Matrix4) GetRow(i int) *Vector4
- func (m *Matrix4) GetRowVector3(i int) *Vector3
- 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(other *Matrix4) *Matrix4
- func (m *Matrix4) MultiplyMatrices(a, b *Matrix4) *Matrix4
- func (m *Matrix4) MultiplyScalar(s 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(array []float32, offset int) []float32
- func (m *Matrix4) Transpose() *Matrix4
- func (m *Matrix4) Zero() *Matrix4
- type Plane
- func (p *Plane) Clone(plane *Plane) *Plane
- func (p *Plane) CoplanarPoint(optionalTarget *Vector3) *Vector3
- func (p *Plane) Copy(other *Plane) *Plane
- func (p *Plane) DistanceToPoint(point *Vector3) float32
- func (p *Plane) DistanceToSphere(sphere *Sphere) float32
- func (p *Plane) Equals(other *Plane) bool
- func (p *Plane) IntersectLine(line *Line3, optionalTarget *Vector3) *Vector3
- func (p *Plane) IsIntersectionLine(line *Line3) bool
- func (p *Plane) Negate() *Plane
- func (p *Plane) Normalize() *Plane
- func (p *Plane) Set(normal *Vector3, constant float32) *Plane
- func (p *Plane) SetComponents(x, y, z, w float32) *Plane
- func (p *Plane) SetFromCoplanarPoints(a, b, c *Vector3) *Plane
- func (p *Plane) SetFromNormalAndCoplanarPoint(normal *Vector3, point *Vector3) *Plane
- func (p *Plane) Translate(offset *Vector3) *Plane
- type Quaternion
- func (q *Quaternion) Clone() *Quaternion
- func (q *Quaternion) Conjugate() *Quaternion
- func (q *Quaternion) Copy(other *Quaternion) *Quaternion
- func (q *Quaternion) Dot(other *Quaternion) float32
- func (q *Quaternion) Equals(other *Quaternion) bool
- func (q *Quaternion) FromArray(array []float32, offset int) *Quaternion
- func (q *Quaternion) Inverse() *Quaternion
- func (q *Quaternion) IsIdentity() bool
- func (q *Quaternion) Length() float32
- func (q *Quaternion) Multiply(other *Quaternion) *Quaternion
- func (q *Quaternion) MultiplyQuaternions(a, b *Quaternion) *Quaternion
- func (q *Quaternion) Normalize() *Quaternion
- func (q *Quaternion) NormalizeFast() *Quaternion
- func (q *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 (q *Quaternion) SetFromRotationMatrix(m *Matrix4) *Quaternion
- func (q *Quaternion) SetFromUnitVectors(vFrom, vTo *Vector3) *Quaternion
- func (q *Quaternion) SetIdentity() *Quaternion
- func (q *Quaternion) SetW(val float32) *Quaternion
- func (q *Quaternion) SetX(val float32) *Quaternion
- func (q *Quaternion) SetY(val float32) *Quaternion
- func (q *Quaternion) SetZ(val float32) *Quaternion
- func (q *Quaternion) Slerp(other *Quaternion, t float32) *Quaternion
- func (q *Quaternion) ToArray(array []float32, offset int) []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 (s *Sphere) ClampPoint(point *Vector3, optionalTarget *Vector3) *Vector3
- func (s *Sphere) ContainsPoint(point *Vector3) bool
- func (s *Sphere) Copy(other *Sphere) *Sphere
- func (s *Sphere) DistanceToPoint(point *Vector3) float32
- func (s *Sphere) Empty(sphere *Sphere) bool
- func (s *Sphere) GetBoundingBox(optionalTarget *Box3) *Box3
- func (s *Sphere) IntersectSphere(other *Sphere) bool
- func (s *Sphere) Set(center *Vector3, radius float32) *Sphere
- func (s *Sphere) SetFromPoints(points []Vector3, optionalCenter *Vector3) *Sphere
- func (s *Sphere) Translate(offset *Vector3) *Sphere
- type Spline
- type Triangle
- func (t *Triangle) Area() float32
- func (t *Triangle) BarycoordFromPoint(point, optionalTarget *Vector3) *Vector3
- func (t *Triangle) Clone(triangle *Triangle) *Triangle
- func (t *Triangle) ContainsPoint(point *Vector3) bool
- func (t *Triangle) Copy(triangle *Triangle) *Triangle
- func (t *Triangle) Equals(triangle *Triangle) bool
- func (t *Triangle) Midpoint(optionalTarget *Vector3) *Vector3
- func (t *Triangle) Normal(optionalTarget *Vector3) *Vector3
- func (t *Triangle) Plane(optionalTarget *Plane) *Plane
- func (t *Triangle) Set(a, b, c *Vector3) *Triangle
- func (t *Triangle) SetFromPointsAndIndices(points []*Vector3, i0, i1, i2 int) *Triangle
- type Vector2
- func (v *Vector2) Add(other *Vector2) *Vector2
- func (v *Vector2) AddScalar(s float32) *Vector2
- func (v *Vector2) AddVectors(a, b *Vector2) *Vector2
- func (v *Vector2) AlmostEquals(other *Vector2, tolerance float32) bool
- func (v *Vector2) Ceil() *Vector2
- func (v *Vector2) Clamp(min, max *Vector2) *Vector2
- func (v *Vector2) ClampScalar(minVal, maxVal float32) *Vector2
- func (v *Vector2) Clone() *Vector2
- func (v *Vector2) Component(index int) float32
- func (v *Vector2) Copy(other *Vector2) *Vector2
- func (v *Vector2) DistanceTo(other *Vector2) float32
- func (v *Vector2) DistanceToSquared(other *Vector2) float32
- func (v *Vector2) Divide(other *Vector2) *Vector2
- func (v *Vector2) DivideScalar(scalar float32) *Vector2
- func (v *Vector2) Dot(other *Vector2) float32
- func (v *Vector2) Equals(other *Vector2) bool
- func (v *Vector2) Floor() *Vector2
- func (v *Vector2) FromArray(array []float32, offset int) *Vector2
- func (v *Vector2) InTriangle(p0, p1, p2 *Vector2) bool
- func (v *Vector2) Length() float32
- func (v *Vector2) LengthSq() float32
- func (v *Vector2) Lerp(other *Vector2, alpha float32) *Vector2
- func (v *Vector2) Max(other *Vector2) *Vector2
- func (v *Vector2) Min(other *Vector2) *Vector2
- func (v *Vector2) Multiply(other *Vector2) *Vector2
- func (v *Vector2) MultiplyScalar(s float32) *Vector2
- func (v *Vector2) Negate() *Vector2
- func (v *Vector2) Normalize() *Vector2
- func (v *Vector2) Round() *Vector2
- func (v *Vector2) Set(x, y float32) *Vector2
- func (v *Vector2) SetByName(name string, value float32)
- func (v *Vector2) SetComponent(index int, value float32) *Vector2
- func (v *Vector2) SetLength(l float32) *Vector2
- func (v *Vector2) SetX(x float32) *Vector2
- func (v *Vector2) SetY(y float32) *Vector2
- func (v *Vector2) Sub(other *Vector2) *Vector2
- func (v *Vector2) SubScalar(s float32) *Vector2
- func (v *Vector2) SubVectors(a, b *Vector2) *Vector2
- func (v *Vector2) ToArray(array []float32, offset int) []float32
- func (v *Vector2) Zero() *Vector2
- type Vector3
- func (v *Vector3) Add(other *Vector3) *Vector3
- func (v *Vector3) AddScalar(s float32) *Vector3
- func (v *Vector3) AddVectors(a, b *Vector3) *Vector3
- func (v *Vector3) AlmostEquals(other *Vector3, tolerance float32) bool
- func (v *Vector3) AngleTo(other *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 (v *Vector3) Ceil() *Vector3
- func (v *Vector3) Clamp(min, max *Vector3) *Vector3
- func (v *Vector3) ClampScalar(minVal, maxVal float32) *Vector3
- func (v *Vector3) Clone() *Vector3
- func (v *Vector3) Component(index int) float32
- func (v *Vector3) Copy(other *Vector3) *Vector3
- func (v *Vector3) Cross(other *Vector3) *Vector3
- func (v *Vector3) CrossVectors(a, b *Vector3) *Vector3
- func (v *Vector3) DistanceTo(other *Vector3) float32
- func (v *Vector3) DistanceToSquared(other *Vector3) float32
- func (v *Vector3) Divide(other *Vector3) *Vector3
- func (v *Vector3) DivideScalar(scalar float32) *Vector3
- func (v *Vector3) Dot(other *Vector3) float32
- func (v *Vector3) Equals(other *Vector3) bool
- func (v *Vector3) Floor() *Vector3
- func (v *Vector3) FromArray(array []float32, offset int) *Vector3
- func (v *Vector3) Length() float32
- func (v *Vector3) LengthSq() float32
- func (v *Vector3) Lerp(other *Vector3, alpha float32) *Vector3
- func (v *Vector3) Max(other *Vector3) *Vector3
- func (v *Vector3) Min(other *Vector3) *Vector3
- func (v *Vector3) Multiply(other *Vector3) *Vector3
- func (v *Vector3) MultiplyScalar(s float32) *Vector3
- func (v *Vector3) MultiplyVectors(a, b *Vector3) *Vector3
- func (v *Vector3) Negate() *Vector3
- func (v *Vector3) Normalize() *Vector3
- func (v *Vector3) ProjectOnPlane(planeNormal *Vector3) *Vector3
- func (v *Vector3) ProjectOnVector(other *Vector3) *Vector3
- func (v *Vector3) RandomTangents() (*Vector3, *Vector3)
- func (v *Vector3) Reflect(normal *Vector3) *Vector3
- func (v *Vector3) Round() *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 (v *Vector3) SetFromQuaternion(q *Quaternion) *Vector3
- func (v *Vector3) SetFromRotationMatrix(m *Matrix4) *Vector3
- func (v *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(other *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) Vector4(w float32) *Vector4
- func (v *Vector3) Zero() *Vector3
- type Vector4
- func (v *Vector4) Add(other *Vector4) *Vector4
- func (v *Vector4) AddScalar(s float32) *Vector4
- func (v *Vector4) AddVectors(a, b *Vector4) *Vector4
- func (v *Vector4) AlmostEquals(other *Vector4, tolerance float32) bool
- func (v *Vector4) ApplyMatrix4(m *Matrix4) *Vector4
- func (v *Vector4) Ceil() *Vector4
- func (v *Vector4) Clamp(min, max *Vector4) *Vector4
- func (v *Vector4) ClampScalar(minVal, maxVal float32) *Vector4
- func (v *Vector4) Clone() *Vector4
- func (v *Vector4) Component(index int) float32
- func (v *Vector4) Copy(other *Vector4) *Vector4
- func (v *Vector4) Divide(other *Vector4) *Vector4
- func (v *Vector4) DivideScalar(scalar float32) *Vector4
- func (v *Vector4) Dot(other *Vector4) float32
- func (v *Vector4) Equals(other *Vector4) bool
- func (v *Vector4) Floor() *Vector4
- func (v *Vector4) FromArray(array []float32, offset int) *Vector4
- func (v *Vector4) Length() float32
- func (v *Vector4) LengthSq() float32
- func (v *Vector4) Lerp(other *Vector4, alpha float32) *Vector4
- func (v *Vector4) Max(other *Vector4) *Vector4
- func (v *Vector4) Min(other *Vector4) *Vector4
- func (v *Vector4) Multiply(other *Vector4) *Vector4
- func (v *Vector4) MultiplyScalar(scalar float32) *Vector4
- func (v *Vector4) Negate() *Vector4
- func (v *Vector4) Normalize() *Vector4
- func (v *Vector4) Round() *Vector4
- func (v *Vector4) Set(x, y, z, w float32) *Vector4
- func (v *Vector4) SetAxisAngleFromQuaternion(q *Quaternion) *Vector4
- func (v *Vector4) SetAxisFromRotationMatrix(m *Matrix4) *Vector4
- func (v *Vector4) SetByName(name string, value float32)
- func (v *Vector4) SetComponent(index int, value float32) *Vector4
- func (v *Vector4) SetLength(l float32) *Vector4
- func (v *Vector4) SetVector3(other *Vector3, w float32) *Vector4
- func (v *Vector4) SetW(w float32) *Vector4
- func (v *Vector4) SetX(x float32) *Vector4
- func (v *Vector4) SetY(y float32) *Vector4
- func (v *Vector4) SetZ(z float32) *Vector4
- func (v *Vector4) Sub(other *Vector4) *Vector4
- func (v *Vector4) SubScalar(s float32) *Vector4
- func (v *Vector4) SubVectors(a, b *Vector4) *Vector4
- func (v *Vector4) ToArray(array []float32, offset int) []float32
- func (v *Vector4) Vector3() *Vector3
- func (v *Vector4) Zero() *Vector4
Constants ¶
const Pi = math.Pi
Variables ¶
var Infinity = float32(math.Inf(1))
Functions ¶
func ContainsPoint ¶
ContainsPoint returns whether a triangle contains a point.
Types ¶
type ArrayF32 ¶
type ArrayF32 []float32
ArrayF32 is a slice of float32 with additional convenience methods
func NewArrayF32 ¶
NewArrayF32 creates a returns a new array of floats with the specified initial size and capacity
func (*ArrayF32) AppendColor ¶
AppendColor appends any number of Color to the array
func (*ArrayF32) AppendColor4 ¶
AppendColor4 appends any number of Color4 to the array
func (*ArrayF32) AppendVector2 ¶
AppendVector2 appends any number of Vector2 to the array
func (*ArrayF32) AppendVector3 ¶
AppendVector3 appends any number of Vector3 to the array
func (*ArrayF32) AppendVector4 ¶
AppendVector4 appends any number of Vector4 to the array
func (ArrayF32) GetColor ¶
GetColor stores in the specified Color the values from the array starting at the specified pos
func (ArrayF32) GetColor4 ¶
GetColor4 stores in the specified Color the values from the array starting at the specified pos
func (ArrayF32) GetMatrix4 ¶
GetMatrix4 stores in the specified Matrix4 the values from the array starting at the specified pos.
func (ArrayF32) GetVector2 ¶
GetVector2 stores in the specified Vector2 the values from the array starting at the specified pos.
func (ArrayF32) GetVector3 ¶
GetVector3 stores in the specified Vector3 the values from the array starting at the specified pos.
func (ArrayF32) GetVector4 ¶
GetVector4 stores in the specified Vector4 the values from the array starting at the specified pos.
func (*ArrayF32) Len ¶
Len returns the number of float32 elements in the array It is equivalent to Size()
func (ArrayF32) Set ¶
Set sets the values of the array starting at the specified pos from the specified values
func (ArrayF32) SetColor ¶
SetColor sets the values of the array at the specified pos from the RGB values of the specified Color
func (ArrayF32) SetColor4 ¶
SetColor4 sets the values of the array at the specified pos from the RGBA values of specified Color4
func (ArrayF32) SetVector2 ¶
SetVector2 sets the values of the array at the specified pos from the XY values of the specified Vector2
func (ArrayF32) SetVector3 ¶
SetVector3 sets the values of the array at the specified pos from the XYZ values of the specified Vector3
func (ArrayF32) SetVector4 ¶
SetVector4 sets the values of the array at the specified pos from the XYZ values of the specified Vector4
type ArrayU32 ¶
type ArrayU32 []uint32
ArrayU32 is a slice of uint32 with additional convenience methods
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
}
Box2 represents a 2D bounding box defined by two points: the point with minimum coordinates and the point with maximum coordinates.
func NewBox2 ¶
NewBox2 creates and returns a pointer to a new Box2 defined by its minimum and maximum coordinates.
func (*Box2) Center ¶
Center calculates the center point of this bounding box and stores its pointer to optionalTarget, if not nil, and also returns it.
func (*Box2) ClampPoint ¶
ClampPoint calculates a new point which is the specified point clamped inside this box. Stores the pointer to this new point into optionaTarget, if not nil, and also returns it.
func (*Box2) ContainsBox ¶
ContainsBox returns if this bounding box contains other box.
func (*Box2) ContainsPoint ¶
ContainsPoint returns if this bounding box contains the specified point.
func (*Box2) Copy ¶
Copy copy other to this bounding box. Returns pointer to this updated bounding box.
func (*Box2) DistanceToPoint ¶
DistanceToPoint returns the distance from this box to the specified point.
func (*Box2) ExpandByPoint ¶
ExpandByPoint may expand this bounding box to include the specified point. Returns pointer to this updated bounding box.
func (*Box2) ExpandByScalar ¶
ExpandByScalar expands this bounding box by the specified scalar. Returns pointer to this updated bounding box.
func (*Box2) ExpandByVector ¶
ExpandByVector expands this bounding box by the specified vector. Returns pointer to this updated bounding box.
func (*Box2) Intersect ¶
Intersect sets this box to the intersection with other box. Returns pointer to this updated bounding box.
func (*Box2) IsIntersectionBox ¶
IsIntersectionBox returns if other box intersects this one.
func (*Box2) MakeEmpty ¶
MakeEmpty set this bounding box to empty. Returns pointer to this updated bounding box.
func (*Box2) Set ¶
Set sets this bounding box minimum and maximum coordinates. Returns pointer to this updated bounding box.
func (*Box2) SetFromCenterAndSize ¶
SetFromCenterAndSize set this bounding box from a center point and size. Size is a vector from the minimum point to the maximum point. Returns pointer to this updated bounding box.
func (*Box2) SetFromPoints ¶
SetFromPoints set this bounding box from the specified array of points. Returns pointer to this updated bounding box.
func (*Box2) Size ¶
Size calculates the size of this bounding box: the vector from its minimum point to its maximum point. Store pointer to the calculated size into optionalTarget, if not nil, and also returns it.
type Box3 ¶
Box3 represents a 3D bounding box defined by two points: the point with minimum coordinates and the point with maximum coordinates.
func NewBox3 ¶
NewBox3 creates and returns a pointer to a new Box3 defined by its minimum and maximum coordinates.
func (*Box3) ApplyMatrix4 ¶
ApplyMatrix4 applies the specified matrix to the vertices of this bounding box. Returns pointer to this updated bounding box.
func (*Box3) Center ¶
Center calculates the center point of this bounding box and stores its pointer to optionalTarget, if not nil, and also returns it.
func (*Box3) ClampPoint ¶
ClampPoint calculates a new point which is the specified point clamped inside this box. Stores the pointer to this new point into optionaTarget, if not nil, and also returns it.
func (*Box3) ContainsBox ¶
ContainsBox returns if this bounding box contains other box.
func (*Box3) ContainsPoint ¶
ContainsPoint returns if this bounding box contains the specified point.
func (*Box3) Copy ¶
Copy copy other to this bounding box. Returns pointer to this updated bounding box.
func (*Box3) DistanceToPoint ¶
DistanceToPoint returns the distance from this box to the specified point.
func (*Box3) ExpandByPoint ¶
ExpandByPoint may expand this bounding box to include the specified point. Returns pointer to this updated bounding box.
func (*Box3) ExpandByScalar ¶
ExpandByScalar expands this bounding box by the specified scalar. Returns pointer to this updated bounding box.
func (*Box3) ExpandByVector ¶
ExpandByVector expands this bounding box by the specified vector. Returns pointer to this updated bounding box.
func (*Box3) GetBoundingSphere ¶
GetBoundingSphere creates a bounding sphere to this bounding box. Store its pointer into optionalTarget, if not nil, and also returns it.
func (*Box3) Intersect ¶
Intersect sets this box to the intersection with other box. Returns pointer to this updated bounding box.
func (*Box3) IsIntersectionBox ¶
IsIntersectionBox returns if other box intersects this one.
func (*Box3) MakeEmpty ¶
MakeEmpty set this bounding box to empty. Returns pointer to this updated bounding box.
func (*Box3) Set ¶
Set sets this bounding box minimum and maximum coordinates. Returns pointer to this updated bounding box.
func (*Box3) SetFromCenterAndSize ¶
SetFromCenterAndSize set this bounding box from a center point and size. Size is a vector from the minimum point to the maximum point. Returns pointer to this updated bounding box.
func (*Box3) SetFromPoints ¶
SetFromPoints set this bounding box from the specified array of points. Returns pointer to this updated bounding box.
func (*Box3) Size ¶
Size calculates the size of this bounding box: the vector from its minimum point to its maximum point. Store pointer to the calculated size into optionalTarget, if not nil, and also returns it.
type Color ¶
Color describes an RGB color
func ColorName ¶
ColorName returns a Color with the specified standard web color name (case insensitive). Returns black color if the specified color name not found
func IsColorName ¶
IsColorName returns if the specified name is valid color name
func NewColor ¶
NewColor creates and returns a pointer to a new Color with the specified web standard color name (case insensitive). Returns nil if the color name not found
func NewColorHex ¶
NewColorHex creates and returns a pointer to a new color with its RGB components from the specified hex value
func (*Color) Add ¶
Add adds to each RGB component of this color the correspondent component of other color Returns pointer to this updated color
func (*Color) AddColors ¶
AddColors adds to each RGB component of this color the correspondent component of color1 and color2 Returns pointer to this updated color
func (*Color) AddScalar ¶
AddScalar adds the specified scalar value to each RGB component of this color Returns pointer to this updated color
func (*Color) Lerp ¶
Lerp linear sets this color as the linear interpolation of itself with the specified color for the specified alpha. Returns pointer to this updated color
func (*Color) Multiply ¶
Multiply multiplies each RGB component of this color by other Returns pointer to this updated color
func (*Color) MultiplyScalar ¶
MultiplyScalar multiplies each RGB component of this color by the specified scalar. Returns pointer to this updated color
type Color4 ¶
Color4 describes an RGBA color
func Color4Name ¶
Color4Name returns a Color4 with the specified standard web color name and an optional alpha channel value.
func NewColor4 ¶
NewColor4 creates and returns a pointer to a new Color4 with the specified standard web color name (case insensitive) and an optional alpha channel value. Returns nil if the specified color name not found
func (*Color4) Add ¶
Add adds to each RGBA component of this color the correspondent component of other color Returns pointer to this updated color
func (*Color4) MultiplyScalar ¶
MultiplyScalar multiplies each RGBA component of this color by the specified scalar. Returns pointer to this updated color
func (*Color4) Set ¶
Set sets this color individual R,G,B,A components Returns pointer to this updated color
func (*Color4) SetHex ¶
SetHex sets the color RGB components from the specified integer interpreted as a color hex number Alpha component is not modified Returns pointer to this updated color
type Curve ¶ added in v0.2.0
type Curve struct {
// contains filtered or unexported fields
}
Curve constructs an array of Vector3
func NewBezierCubic ¶ added in v0.2.0
NewBezierCubic creates and returns a pointer to a new curve Uses Vector3 pointers origin, control1, control2, and destination to calculate with int npoints as the desired number of points along the curve
func NewBezierQuadratic ¶ added in v0.2.0
NewBezierQuadratic creates and returns a pointer to a new curve Uses Vector3 pointers origin, control, and destination to calculate with int npoints as the desired number of points along the curve
func NewCatmullRomSpline ¶ added in v0.2.0
NewCatmullRomSpline creates and returns a pointer to a new curve Uses array of Vector3 pointers with int npoints as the desired number of points between supplied points Use Boolean closed with true to close the start and end points
func NewHermiteSpline ¶ added in v0.2.0
NewHermiteSpline creates and returns a pointer to a new curve Uses Vector3 pointers origin, tangent1, destination, and tangent2 to calculate with int npoints as the desired number of points along the curve
type Frustum ¶
type Frustum struct {
// contains filtered or unexported fields
}
Frustum represents a frustum
func NewFrustum ¶
NewFrustum returns a pointer to a new Frustum object
func NewFrustumFromMatrix ¶
NewFrustumFromMatrix creates and returns a Frustum based on the provided matrix
func (*Frustum) Clone ¶
Clone returns a pointer to a new Frustum object with the same planes as the original
func (*Frustum) ContainsPoint ¶
ContainsPoint determines whether the frustum contains the specified point
func (*Frustum) IntersectsBox ¶
IntersectsBox determines whether the specified box is intersecting the frustum
func (*Frustum) IntersectsSphere ¶
IntersectsSphere determines whether the specified sphere is intersecting the frustum
func (*Frustum) SetFromMatrix ¶
SetFromMatrix sets the frustum's planes based on the specified Matrix4
type Line3 ¶
type Line3 struct {
// contains filtered or unexported fields
}
Line3 represents a 3D line segment defined by a start and an end point.
func NewLine3 ¶
NewLine3 creates and returns a pointer to a new Line3 with the specified start and end points.
func (*Line3) ApplyMatrix4 ¶
ApplyMatrix4 applies the specified matrix to this line segment start and end points. Returns pointer to this updated line segment.
func (*Line3) Center ¶
Center calculates this line segment center point. Store its pointer into optionalTarget, if not nil, and also returns it.
func (*Line3) Copy ¶
Copy copy other line segment to this one. Returns pointer to this updated line segment.
func (*Line3) Delta ¶
Delta calculates the vector from the start to end point of this line segment. Store its pointer in optionalTarget, if not nil, and also returns it.
func (*Line3) DistanceSq ¶
DistanceSq returns the square of the distance from the start point to the end point.
type Matrix3 ¶
type Matrix3 [9]float32
Matrix3 is 3x3 matrix organized internally as column matrix
func NewMatrix3 ¶
func NewMatrix3() *Matrix3
NewMatrix3 creates and returns a pointer to a new Matrix3 initialized as the identity matrix.
func (*Matrix3) ApplyToVector3Array ¶
ApplyToVector3Array multiplies length vectors in the array starting at offset by this matrix. Returns pointer to the updated array. This matrix is unchanged.
func (*Matrix3) Copy ¶
Copy copies src matrix into this one. Returns the pointer to this updated matrix.
func (*Matrix3) Determinant ¶
Determinant calculates and returns the determinant of this matrix.
func (*Matrix3) FromArray ¶
FromArray set this matrix array starting at offset. Returns pointer to this updated matrix.
func (*Matrix3) GetInverse ¶
GetInverse sets this matrix to the inverse of the src matrix. If the src matrix cannot be inverted returns error and sets this matrix to the identity matrix.
func (*Matrix3) GetNormalMatrix ¶
GetNormalMatrix set this matrix to the matrix to transform the normal vectors from the src matrix to transform the vertices. If the src matrix cannot be inverted returns error.
func (*Matrix3) Identity ¶
Identity sets this matrix as the identity matrix. Returns the pointer to this updated matrix.
func (*Matrix3) MakeRotationFromQuaternion ¶
func (m *Matrix3) MakeRotationFromQuaternion(q *Quaternion) *Matrix3
MakeRotationFromQuaternion sets this matrix as a rotation matrix from the specified quaternion. Returns pointer to this updated matrix.
func (*Matrix3) Multiply ¶
Multiply multiply this matrix by the other matrix Returns pointer to this updated matrix.
func (*Matrix3) MultiplyMatrices ¶
MultiplyMatrices multiply matrix a by b storing the result in this matrix. Returns pointer to this updated matrix.
func (*Matrix3) MultiplyScalar ¶
MultiplyScalar multiplies each of this matrix's components by the specified scalar. Returns pointer to this updated matrix.
func (*Matrix3) ScaleColumns ¶
ScaleColumns multiplies the matrix columns by the vector components. This can be used when multiplying this matrix by a diagonal matrix if we store the diagonal components as a vector. Returns pointer to this updated matrix.
func (*Matrix3) Set ¶
Set sets all the elements of the matrix row by row starting at row1, column1, row1, column2, row1, column3 and so forth. Returns the pointer to this updated Matrix.
func (*Matrix3) SetFromMatrix4 ¶
SetFromMatrix4 sets the matrix elements based on a Matrix4.
func (*Matrix3) ToArray ¶
ToArray copies this matrix to array starting at offset. Returns pointer to the updated array.
type Matrix4 ¶
type Matrix4 [16]float32
Matrix4 is 4x4 matrix organized internally as column matrix.
func NewMatrix4 ¶
func NewMatrix4() *Matrix4
NewMatrix4 creates and returns a pointer to a new Matrix4 initialized as the identity matrix.
func (*Matrix4) ApplyToVector3Array ¶
ApplyToVector3Array multiplies length vectors in the array starting at offset by this matrix. Returns pointer to the updated array. This matrix is unchanged.
func (*Matrix4) Compose ¶
func (m *Matrix4) Compose(position *Vector3, quaternion *Quaternion, scale *Vector3) *Matrix4
Compose sets this matrix to a transformation matrix for the specified position, rotation specified by the quaternion and scale. Returns pointer to this updated matrix.
func (*Matrix4) Copy ¶
Copy copies src matrix into this one. Returns pointer to this updated matrix.
func (*Matrix4) CopyPosition ¶
CopyPosition copies the position elements of the src matrix into this one. Returns pointer to this updated matrix.
func (*Matrix4) Decompose ¶
func (m *Matrix4) Decompose(position *Vector3, quaternion *Quaternion, scale *Vector3) *Matrix4
Decompose updates the position vector, quaternion and scale from this transformation matrix. Returns pointer to this unchanged matrix.
func (*Matrix4) Determinant ¶
Determinant calculates and returns the determinat of this matrix.
func (*Matrix4) ExtractBasis ¶
ExtractBasis updates the specified vectors with the basis vectors of this matrix. Returns pointer to this unchanged matrix.
func (*Matrix4) ExtractRotation ¶
ExtractRotation set this matrix as rotation matrix from the src transformation matrix. Returns pointer to this updated matrix.
func (*Matrix4) FromArray ¶
FromArray set this matrix elements from the array starting at offset. Returns pointer to this updated matrix.
func (*Matrix4) GetColumnVector3 ¶ added in v0.2.0
GetColumn returns the ith column.
func (*Matrix4) GetInverse ¶
GetInverse sets this matrix to the inverse of the src matrix. If the src matrix cannot be inverted returns error and sets this matrix to the identity matrix.
func (*Matrix4) GetMaxScaleOnAxis ¶
GetMaxScaleOnAxis returns the maximum scale value of the 3 axes.
func (*Matrix4) GetRowVector3 ¶ added in v0.2.0
GetRow returns the ith row.
func (*Matrix4) Identity ¶
Identity sets this matrix as the identity matrix. Returns pointer to this updated matrix.
func (*Matrix4) LookAt ¶
LookAt sets this matrix as view transform matrix with origin at eye, looking at target and using the up vector. Returns pointer to this updated matrix.
func (*Matrix4) MakeBasis ¶
MakeBasis sets this matrix basis vectors from the specified vectors. Returns pointer to this updated matrix.
func (*Matrix4) MakeFrustum ¶
MakeFrustum sets this matrix to a projection frustum matrix bounded by the specified planes. Returns pointer to this updated matrix.
func (*Matrix4) MakeOrthographic ¶
MakeOrthographic sets this matrix to an orthographic projection matrix bounded by the specified planes. Returns pointer to this updated matrix.
func (*Matrix4) MakePerspective ¶
MakePerspective sets this matrix to a perspective projection matrix with the specified vertical field of view in degrees, aspect ratio (width/height) and near and far planes. Returns pointer to this updated matrix.
func (*Matrix4) MakeRotationAxis ¶
MakeRotationAxis sets this matrix to a rotation matrix of the specified angle around the specified axis. Returns pointer to this updated matrix.
func (*Matrix4) MakeRotationFromEuler ¶
MakeRotationFromEuler set this a matrix as a rotation matrix from the specified euler angles. Returns pointer to this updated matrix.
func (*Matrix4) MakeRotationFromQuaternion ¶
func (m *Matrix4) MakeRotationFromQuaternion(q *Quaternion) *Matrix4
MakeRotationFromQuaternion sets this matrix as a rotation matrix from the specified quaternion. Returns pointer to this updated matrix.
func (*Matrix4) MakeRotationX ¶
MakeRotationX sets this matrix to a rotation matrix of angle theta around the X axis. Returns pointer to this updated matrix.
func (*Matrix4) MakeRotationY ¶
MakeRotationY sets this matrix to a rotation matrix of angle theta around the Y axis. Returns pointer to this updated matrix.
func (*Matrix4) MakeRotationZ ¶
MakeRotationZ sets this matrix to a rotation matrix of angle theta around the Z axis. Returns pointer to this updated matrix.
func (*Matrix4) MakeScale ¶
MakeScale sets this matrix to a scale transformation matrix using the specified x, y and z values. Returns pointer to this updated matrix.
func (*Matrix4) MakeTranslation ¶
MakeTranslation sets this matrix to a translation matrix from the specified x, y and z values. Returns pointer to this updated matrix.
func (*Matrix4) Multiply ¶
Multiply multiply this matrix by the other matrix Returns pointer to this updated matrix.
func (*Matrix4) MultiplyMatrices ¶
MultiplyMatrices computes a * b, storing the result in this matrix. Returns pointer to this updated matrix.
func (*Matrix4) MultiplyScalar ¶
MultiplyScalar multiplies each element of this matrix by the specified scalar. Returns pointer to this updated matrix.
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. Returns pointer to this updated matrix.
func (*Matrix4) Set ¶
func (m *Matrix4) Set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 float32) *Matrix4
Set sets all the elements of this matrix row by row starting at row1, column1, row1, column2, row1, column3 and so forth. Returns pointer to this updated Matrix.
func (*Matrix4) SetPosition ¶
SetPosition sets this transformation matrix position fields from the specified vector v. Returns pointer to this updated matrix.
func (*Matrix4) ToArray ¶
ToArray copies this matrix elements to array starting at offset. Returns pointer to the updated array.
type Plane ¶
type Plane struct {
// contains filtered or unexported fields
}
Plane represents a plane in 3D space by its normal vector and a constant. When the the normal vector is the unit vector the constant is the distance from the origin.
func (*Plane) CoplanarPoint ¶
CoplanarPoint sets the optionalTarget to a point in the plane and also returns it. The point set and returned is the closest point from the origin.
func (*Plane) Copy ¶
Copy sets this plane to a copy of other. Returns pointer to this updated plane.
func (*Plane) DistanceToPoint ¶
DistanceToPoint returns the distance of this plane from point.
func (*Plane) DistanceToSphere ¶
DistanceToSphere returns the distance of this place from the sphere.
func (*Plane) IntersectLine ¶
IntersectLine calculates the point in the plane which intersets the specified line. Sets the optionalTarget, if not nil to this point, and also returns it. Returns nil if the line does not intersects the plane.
func (*Plane) IsIntersectionLine ¶
IsIntersectionLine returns the line intersects this plane.
func (*Plane) Normalize ¶
Normalize normalizes this plane normal vector and adjusts the constant. Note: will lead to a divide by zero if the plane is invalid. Returns pointer to this updated plane.
func (*Plane) Set ¶
Set sets this plane normal vector and constant. Returns pointer to this updated plane.
func (*Plane) SetComponents ¶
SetComponents sets this plane normal vector components and constant. Returns pointer to this updated plane.
func (*Plane) SetFromCoplanarPoints ¶
SetFromCoplanarPoints sets this plane from three coplanar points. Returns pointer to this updated plane.
func (*Plane) SetFromNormalAndCoplanarPoint ¶
SetFromNormalAndCoplanarPoint sets this plane from a normal vector and a point on the plane. Returns pointer to this updated plane.
type Quaternion ¶
Quaternion is quaternion with X,Y,Z and W components.
func NewQuaternion ¶
func NewQuaternion(x, y, z, w float32) *Quaternion
NewQuaternion creates and returns a pointer to a new quaternion from the specified components.
func (*Quaternion) Clone ¶
func (q *Quaternion) Clone() *Quaternion
Clone returns a copy of this quaternion
func (*Quaternion) Conjugate ¶
func (q *Quaternion) Conjugate() *Quaternion
Conjugate sets this quaternion to its conjugate. Returns pointer to this updated quaternion.
func (*Quaternion) Copy ¶
func (q *Quaternion) Copy(other *Quaternion) *Quaternion
Copy copies the other quaternion into this one. Returns pointer to this updated quaternion.
func (*Quaternion) Dot ¶
func (q *Quaternion) Dot(other *Quaternion) float32
Dot returns the dot products of this quaternion with other.
func (*Quaternion) Equals ¶
func (q *Quaternion) Equals(other *Quaternion) bool
Equals returns if this quaternion is equal to other.
func (*Quaternion) FromArray ¶
func (q *Quaternion) FromArray(array []float32, offset int) *Quaternion
FromArray sets this quaternion's components from array starting at offset. Returns pointer to this updated quaternion.
func (*Quaternion) Inverse ¶
func (q *Quaternion) Inverse() *Quaternion
Inverse sets this quaternion to its inverse. Returns pointer to this updated quaternion.
func (*Quaternion) IsIdentity ¶
func (q *Quaternion) IsIdentity() bool
IsIdentity returns it this is an identity quaternion.
func (*Quaternion) Length ¶
func (q *Quaternion) Length() float32
Length returns the length of this quaternion
func (*Quaternion) Multiply ¶
func (q *Quaternion) Multiply(other *Quaternion) *Quaternion
Multiply sets this quaternion to the multiplication of itself by other. Returns pointer to this updated quaternion.
func (*Quaternion) MultiplyQuaternions ¶
func (q *Quaternion) MultiplyQuaternions(a, b *Quaternion) *Quaternion
MultiplyQuaternions set this quaternion to the multiplication of a by b. Returns pointer to this updated quaternion.
func (*Quaternion) Normalize ¶
func (q *Quaternion) Normalize() *Quaternion
Normalize normalizes this quaternion. Returns pointer to this updated quaternion.
func (*Quaternion) NormalizeFast ¶
func (q *Quaternion) NormalizeFast() *Quaternion
NormalizeFast approximates normalizing this quaternion. Works best when the quaternion is already almost-normalized. Returns pointer to this updated quaternion.
func (*Quaternion) Set ¶
func (q *Quaternion) Set(x, y, z, w float32) *Quaternion
Set sets this quaternion's components. Returns pointer to this updated 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. Returns pointer to this updated quaternion.
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. Returns pointer to this updated quaternion.
func (*Quaternion) SetFromRotationMatrix ¶
func (q *Quaternion) SetFromRotationMatrix(m *Matrix4) *Quaternion
SetFromRotationMatrix sets this quaternion from the specified rotation matrix. Returns pointer to this updated quaternion.
func (*Quaternion) SetFromUnitVectors ¶
func (q *Quaternion) SetFromUnitVectors(vFrom, vTo *Vector3) *Quaternion
SetFromUnitVectors sets this quaternion to the rotation from vector vFrom to vTo. The vectors must be normalized. Returns pointer to this updated quaternion.
func (*Quaternion) SetIdentity ¶
func (q *Quaternion) SetIdentity() *Quaternion
SetIdentity sets this quanternion to the identity quaternion. Returns pointer to this updated quaternion.
func (*Quaternion) SetW ¶
func (q *Quaternion) SetW(val float32) *Quaternion
SetW sets this quaternion's W component. Returns pointer to this updated quaternion.
func (*Quaternion) SetX ¶
func (q *Quaternion) SetX(val float32) *Quaternion
SetX sets this quaternion's X component. Returns pointer to this updated quaternion.
func (*Quaternion) SetY ¶
func (q *Quaternion) SetY(val float32) *Quaternion
SetY sets this quaternion's Y component. Returns pointer to this updated quaternion.
func (*Quaternion) SetZ ¶
func (q *Quaternion) SetZ(val float32) *Quaternion
SetZ sets this quaternion's Z component. Returns pointer to this updated quaternion.
func (*Quaternion) Slerp ¶
func (q *Quaternion) Slerp(other *Quaternion, t float32) *Quaternion
Slerp sets this quaternion to another quaternion which is the spherically linear interpolation from this quaternion to other using t. Returns pointer to this updated quaternion.
type Ray ¶
type Ray struct {
// contains filtered or unexported fields
}
Ray represents an oriented 3D line segment defined by an origin point and a direction vector.
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 calculates the point in the ray which is at the specified t distance from the origin along its direction. The calculated point is stored in optionalTarget, if not nil, and also returned.
func (*Ray) ClosestPointToPoint ¶
ClosestPointToPoint calculates the point in the ray which is closest to the specified point. The calculated point is stored in optionalTarget, if not nil, and also returned.
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 ¶
DistanceToPlane returns the distance of this ray origin to its intersection point in the plane. If the ray does not intersects the plane, returns NaN.
func (*Ray) DistanceToPoint ¶
DistanceToPoint returns the smallest distance from the ray direction vector to the specified point.
func (*Ray) IntersectBox ¶
IntersectBox calculates the point which is the intersection of this ray with the specified box. The calculated point is stored in optionalTarget, it not nil, and also returned. If no intersection is found the calculated point is set to nil.
func (*Ray) IntersectPlane ¶
IntersectPlane calculates the point which is the intersection of this ray with the specified plane. The calculated point is stored in optionalTarget, if not nil, and also returned. If no intersection is found the calculated point is set to nil.
func (*Ray) IntersectSphere ¶
IntersectSphere calculates the point which is the intersection of this ray with the specified sphere. The calculated point is stored in optionalTarget, it not nil, and also returned. If no intersection is found the calculated point is set to nil.
func (*Ray) IntersectTriangle ¶
IntersectTriangle returns 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 returns if this ray intersects the specified plane.
func (*Ray) IsIntersectionBox ¶
IsIntersectionBox returns if this ray intersects the specified box.
func (*Ray) IsIntersectionSphere ¶
IsIntersectionSphere returns 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 }
Sphere represents a 3D sphere defined by its center point and a radius
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. Returns pointer to this updated sphere.
func (*Sphere) ClampPoint ¶
ClampPoint clamps the specified point inside the sphere. If the specified point is inside the sphere, it is the clamped point. Otherwise the clamped point is the the point in the sphere surface in the nearest of the specified point. The clamped point is stored in optionalTarget, if not nil, and returned.
func (*Sphere) ContainsPoint ¶
ContainsPoint returns if this sphere contains the specified point.
func (*Sphere) DistanceToPoint ¶
DistanceToPoint returns the distance from the sphere surface to the specified point.
func (*Sphere) GetBoundingBox ¶
GetBoundingBox calculates a Box3 which bounds this sphere. Update optionalTarget with the calculated Box3, if not nil, and also returns it.
func (*Sphere) IntersectSphere ¶
IntersectSphere returns if other sphere intersects this one.
func (*Sphere) Set ¶
Set sets the center and radius of this sphere. Returns pointer to this update sphere.
func (*Sphere) SetFromPoints ¶
SetFromPoints sets this sphere from the specified points array and optional center. Returns pointer to this update sphere.
type Spline ¶
type Spline struct {
// contains filtered or unexported fields
}
func (*Spline) InitFromArray ¶
type Triangle ¶
type Triangle struct {
// contains filtered or unexported fields
}
Triangle represents a triangle made of three vertices.
func NewTriangle ¶
NewTriangle returns a pointer to a new Triangle object.
func (*Triangle) BarycoordFromPoint ¶
BarycoordFromPoint returns the barycentric coordinates for the specified point.
func (*Triangle) ContainsPoint ¶
ContainsPoint returns whether the triangle contains a point.
type Vector2 ¶
Vector2 is a 2D vector/point with X and Y components.
func NewVec2 ¶
func NewVec2() *Vector2
NewVec2 creates and returns a pointer to a new zero-ed Vector2.
func NewVector2 ¶
NewVector2 creates and returns a pointer to a new Vector2 with the specified x and y components
func (*Vector2) Add ¶
Add adds other vector to this one. Returns the pointer to this updated vector.
func (*Vector2) AddScalar ¶
AddScalar adds scalar s to each component of this vector. Returns the pointer to this updated vector.
func (*Vector2) AddVectors ¶
AddVectors adds vectors a and b to this one. Returns the pointer to this updated vector.
func (*Vector2) AlmostEquals ¶ added in v0.2.0
AlmostEquals returns whether the vector is almost equal to another vector within the specified tolerance.
func (*Vector2) Ceil ¶
Ceil applies math32.Ceil() to each of this vector's components. Returns the pointer to this updated vector.
func (*Vector2) Clamp ¶
Clamp sets this vector components to be no less than the corresponding components of min and not greater than the corresponding components of max. Assumes min < max, if this assumption isn't true it will not operate correctly. Returns the pointer to this updated vector.
func (*Vector2) ClampScalar ¶
ClampScalar sets this vector components to be no less than minVal and not greater than maxVal. Returns the pointer to this updated vector.
func (*Vector2) Copy ¶
Copy copies other vector to this one. It is equivalent to: *v = *other. Returns the pointer to this updated vector.
func (*Vector2) DistanceTo ¶
DistanceTo returns the distance of this point to other.
func (*Vector2) DistanceToSquared ¶
DistanceToSquared returns the distance squared of this point to other.
func (*Vector2) Divide ¶
Divide divides each component of this vector by the corresponding one from other vector. Returns the pointer to this updated vector
func (*Vector2) DivideScalar ¶
DivideScalar divides each component of this vector by the scalar s. If scalar is zero, sets this vector to zero. Returns the pointer to this updated vector.
func (*Vector2) Dot ¶
Dot returns the dot product of this vector with other. None of the vectors are changed.
func (*Vector2) Floor ¶
Floor applies math32.Floor() to each of this vector's components. Returns the pointer to this updated vector.
func (*Vector2) FromArray ¶
FromArray sets this vector's components from the specified array and offset Returns the pointer to this updated vector.
func (*Vector2) InTriangle ¶
InTriangle returns whether the vector is inside the specified triangle.
func (*Vector2) LengthSq ¶
LengthSq returns the length squared of this vector. LengthSq can be used to compare vectors' lengths without the need to perform a square root.
func (*Vector2) Lerp ¶
Lerp sets each of this vector's components to the linear interpolated value of alpha between ifself and the corresponding other component. Returns the pointer to this updated vector.
func (*Vector2) Max ¶
Max sets this vector components to the maximum value of itself and other vector. Returns the pointer to this updated vector.
func (*Vector2) Min ¶
Min sets this vector components to the minimum values of itself and other vector. Returns the pointer to this updated vector.
func (*Vector2) Multiply ¶
Multiply multiplies each component of this vector by the corresponding one from other vector. Returns the pointer to this updated vector.
func (*Vector2) MultiplyScalar ¶
MultiplyScalar multiplies each component of this vector by the scalar s. Returns the pointer to this updated vector.
func (*Vector2) Negate ¶
Negate negates each of this vector's components. Returns the pointer to this updated vector.
func (*Vector2) Normalize ¶
Normalize normalizes this vector so its length will be 1. Returns the pointer to this updated vector.
func (*Vector2) Round ¶
Round rounds each of this vector's components. Returns the pointer to this updated vector.
func (*Vector2) Set ¶
Set sets this vector X and Y components. Returns the pointer to this updated vector.
func (*Vector2) SetByName ¶
SetByName sets this vector component value by its case insensitive name: "x" or "y".
func (*Vector2) SetComponent ¶
SetComponent sets this vector component value by its index: 0 for X, 1 for Y. Returns the pointer to this updated vector
func (*Vector2) SetLength ¶
SetLength sets this vector to have the specified length. Returns the pointer to this updated vector.
func (*Vector2) SetX ¶
SetX sets this vector X component. Returns the pointer to this updated Vector.
func (*Vector2) SetY ¶
SetY sets this vector Y component. Returns the pointer to this updated vector.
func (*Vector2) Sub ¶
Sub subtracts other vector from this one. Returns the pointer to this updated vector.
func (*Vector2) SubScalar ¶
SubScalar subtracts scalar s from each component of this vector. Returns the pointer to this updated vector.
func (*Vector2) SubVectors ¶
SubVectors sets this vector to a - b. Returns the pointer to this updated vector.
type Vector3 ¶
Vector3 is a 3D vector/point with X, Y and Z components.
func BarycoordFromPoint ¶
BarycoordFromPoint returns the barycentric coordinates for the specified point.
func NewVec3 ¶
func NewVec3() *Vector3
NewVec3 creates and returns a pointer to a new zero-ed Vector3.
func NewVector3 ¶
NewVector3 creates and returns a pointer to a new Vector3 with the specified x, y and y components
func (*Vector3) Add ¶
Add adds other vector to this one. Returns the pointer to this updated vector.
func (*Vector3) AddScalar ¶
AddScalar adds scalar s to each component of this vector. Returns the pointer to this updated vector.
func (*Vector3) AddVectors ¶
AddVectors adds vectors a and b to this one. Returns the pointer to this updated vector.
func (*Vector3) AlmostEquals ¶
TODO: implement similar methods for Vector2 and Vector4 AlmostEquals returns whether the vector is almost equal to another vector within the specified tolerance.
func (*Vector3) ApplyAxisAngle ¶
ApplyAxisAngle rotates the vector around axis by angle. Returns the pointer to this updated vector.
func (*Vector3) ApplyMatrix3 ¶
ApplyMatrix3 multiplies the specified 3x3 matrix by this vector. Returns the pointer to this updated vector.
func (*Vector3) ApplyMatrix4 ¶
ApplyMatrix4 multiplies the specified 4x4 matrix by this vector. Returns the pointer to this updated vector.
func (*Vector3) ApplyProjection ¶
ApplyProjection applies the projection matrix m to this vector Returns the pointer to this updated vector.
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. Returns the pointer to this updated vector.
func (*Vector3) Ceil ¶
Ceil applies math32.Ceil() to each of this vector's components. Returns the pointer to this updated vector.
func (*Vector3) Clamp ¶
Clamp sets this vector components to be no less than the corresponding components of min and not greater than the corresponding component of max. Assumes min < max, if this assumption isn't true it will not operate correctly. Returns the pointer to this updated vector.
func (*Vector3) ClampScalar ¶
ClampScalar sets this vector components to be no less than minVal and not greater than maxVal. Returns the pointer to this updated vector.
func (*Vector3) Component ¶
Component returns this vector component by its index: 0 for X, 1 for Y, 2 for Z.
func (*Vector3) Copy ¶
Copy copies other vector to this one. It is equivalent to: *v = *other. Returns the pointer to this updated vector.
func (*Vector3) Cross ¶
Cross calculates the cross product of this vector with other and returns the result vector.
func (*Vector3) CrossVectors ¶
CrossVectors calculates the cross product of a and b storing the result in this vector. Returns the pointer to this updated vector.
func (*Vector3) DistanceTo ¶
DistanceTo returns the distance of this point to other.
func (*Vector3) DistanceToSquared ¶
DistanceToSquared returns the distance squared of this point to other.
func (*Vector3) Divide ¶
Divide divides each component of this vector by the corresponding one from other vector. Returns the pointer to this updated vector
func (*Vector3) DivideScalar ¶
DivideScalar divides each component of this vector by the scalar s. If scalar is zero, sets this vector to zero. Returns the pointer to this updated vector.
func (*Vector3) Dot ¶
Dot returns the dot product of this vector with other. None of the vectors are changed.
func (*Vector3) Floor ¶
Floor applies math32.Floor() to each of this vector's components. Returns the pointer to this updated vector.
func (*Vector3) FromArray ¶
FromArray sets this vector's components from the specified array and offset Returns the pointer to this updated vector.
func (*Vector3) LengthSq ¶
LengthSq returns the length squared of this vector. LengthSq can be used to compare vectors' lengths without the need to perform a square root.
func (*Vector3) Lerp ¶
Lerp sets each of this vector's components to the linear interpolated value of alpha between itself and the corresponding other component. Returns the pointer to this updated vector.
func (*Vector3) Max ¶
Max sets this vector components to the maximum value of itself and other vector. Returns the pointer to this updated vector.
func (*Vector3) Min ¶
Min sets this vector components to the minimum values of itself and other vector. Returns the pointer to this updated vector.
func (*Vector3) Multiply ¶
Multiply multiplies each component of this vector by the corresponding one from other vector. Returns the pointer to this updated vector.
func (*Vector3) MultiplyScalar ¶
MultiplyScalar multiplies each component of this vector by the scalar s. Returns the pointer to this updated vector.
func (*Vector3) MultiplyVectors ¶
MultiplyVectors multiply vectors a and b storing the result in this vector. Returns the pointer to this updated vector.
func (*Vector3) Negate ¶
Negate negates each of this vector's components. Returns the pointer to this updated vector.
func (*Vector3) Normalize ¶
Normalize normalizes this vector so its length will be 1. Returns the pointer to this updated vector.
func (*Vector3) ProjectOnPlane ¶
ProjectOnPlane sets this vector to its projection on the plane specified by its normal vector. Returns the pointer to this updated vector.
func (*Vector3) ProjectOnVector ¶
ProjectOnVector sets this vector to its projection on other vector. Returns the pointer to this updated vector.
func (*Vector3) RandomTangents ¶
RandomTangents computes and returns two arbitrary tangents to the vector.
func (*Vector3) Reflect ¶
Reflect sets this vector to its reflection relative to the normal vector. The normal vector is assumed to be normalized. Returns the pointer to this updated vector.
func (*Vector3) Round ¶
Round rounds each of this vector's components. Returns the pointer to this updated vector.
func (*Vector3) Set ¶
Set sets this vector X, Y and Z components. Returns the pointer to this updated vector.
func (*Vector3) SetByName ¶
SetByName sets this vector component value by its case insensitive name: "x", "y", or "z".
func (*Vector3) SetComponent ¶
SetComponent sets this vector component value by its index: 0 for X, 1 for Y, 2 for Z. Returns the pointer to this updated vector
func (*Vector3) SetFromMatrixColumn ¶
SetFromMatrixColumn set this vector with the column at index of the m matrix. Returns the pointer to this updated vector.
func (*Vector3) SetFromMatrixPosition ¶
SetFromMatrixPosition set this vector from the translation coordinates in the specified transformation matrix.
func (*Vector3) SetFromQuaternion ¶
func (v *Vector3) SetFromQuaternion(q *Quaternion) *Vector3
SetFromQuaternion sets this vector components to the Euler angles from the specified quaternion Returns the pointer to this updated vector.
func (*Vector3) SetFromRotationMatrix ¶
SetFromRotationMatrix sets this vector components to the Euler angles from the specified pure rotation matrix. Returns the pointer to this updated vector.
func (*Vector3) SetLength ¶
SetLength sets this vector to have the specified length. If the current length is zero, does nothing. Returns the pointer to this updated vector.
func (*Vector3) SetX ¶
SetX sets this vector X component. Returns the pointer to this updated Vector.
func (*Vector3) SetY ¶
SetY sets this vector Y component. Returns the pointer to this updated vector.
func (*Vector3) SetZ ¶
SetZ sets this vector Z component. Returns the pointer to this updated vector.
func (*Vector3) Sub ¶
Sub subtracts other vector from this one. Returns the pointer to this updated vector.
func (*Vector3) SubScalar ¶
SubScalar subtracts scalar s from each component of this vector. Returns the pointer to this updated vector.
func (*Vector3) SubVectors ¶
SubVectors sets this vector to a - b. Returns the pointer to this updated vector.
func (*Vector3) ToArray ¶
ToArray copies this vector's components to array starting at offset. Returns the array.
type Vector4 ¶
Vector4 is a vector/point in homogeneous coordinates with X, Y, Z and W components.
func NewVec4 ¶
func NewVec4() *Vector4
NewVec4 creates and returns a pointer to a new zero-ed Vector4 (with W=1).
func NewVector4 ¶
NewVector4 creates and returns a pointer to a new Vector4
func (*Vector4) Add ¶
Add adds other vector to this one. Returns the pointer to this updated vector.
func (*Vector4) AddScalar ¶
AddScalar adds scalar s to each component of this vector. Returns the pointer to this updated vector.
func (*Vector4) AddVectors ¶
AddVectors adds vectors a and b to this one. Returns the pointer to this updated vector.
func (*Vector4) AlmostEquals ¶ added in v0.2.0
AlmostEquals returns whether the vector is almost equal to another vector within the specified tolerance.
func (*Vector4) ApplyMatrix4 ¶
ApplyMatrix4 multiplies the specified 4x4 matrix by this vector. Returns the pointer to this updated vector.
func (*Vector4) Ceil ¶
Ceil applies math32.Ceil() to each of this vector's components. Returns the pointer to this updated vector.
func (*Vector4) Clamp ¶
Clamp sets this vector components to be no less than the corresponding components of min and not greater than the corresponding component of max. Assumes min < max, if this assumption isn't true it will not operate correctly. Returns the pointer to this updated vector.
func (*Vector4) ClampScalar ¶
ClampScalar sets this vector components to be no less than minVal and not greater than maxVal. Returns the pointer to this updated vector.
func (*Vector4) Component ¶
Component returns this vector component by its index: 0 for X, 1 for Y, 2 for Z, 3 for W.
func (*Vector4) Copy ¶
Copy copies other vector to this one. Returns the pointer to this updated vector.
func (*Vector4) Divide ¶
Divide divides each component of this vector by the corresponding one from other vector. Returns the pointer to this updated vector
func (*Vector4) DivideScalar ¶
DivideScalar divides each component of this vector by the scalar s. If scalar is zero, sets this vector to zero. Returns the pointer to this updated vector.
func (*Vector4) Dot ¶
Dot returns the dot product of this vector with other. None of the vectors are changed.
func (*Vector4) Floor ¶
Floor applies math32.Floor() to each of this vector's components. Returns the pointer to this updated vector.
func (*Vector4) FromArray ¶
FromArray sets this vector's components from the specified array and offset Returns the pointer to this updated vector.
func (*Vector4) LengthSq ¶
LengthSq returns the length squared of this vector. LengthSq can be used to compare vectors' lengths without the need to perform a square root.
func (*Vector4) Lerp ¶
Lerp sets each of this vector's components to the linear interpolated value of alpha between ifself and the corresponding other component. Returns the pointer to this updated vector.
func (*Vector4) Max ¶
Max sets this vector components to the maximum value of itself and other vector. Returns the pointer to this updated vector.
func (*Vector4) Min ¶
Min sets this vector components to the minimum values of itself and other vector. Returns the pointer to this updated vector.
func (*Vector4) Multiply ¶
Multiply multiplies each component of this vector by the corresponding one from other vector. Returns the pointer to this updated vector.
func (*Vector4) MultiplyScalar ¶
MultiplyScalar multiplies each component of this vector by the scalar s. Returns the pointer to this updated vector.
func (*Vector4) Negate ¶
Negate negates each of this vector's components. Returns the pointer to this updated vector.
func (*Vector4) Normalize ¶
Normalize normalizes this vector so its length will be 1. Returns the pointer to this updated vector.
func (*Vector4) Round ¶
Round rounds each of this vector's components. Returns the pointer to this updated vector.
func (*Vector4) Set ¶
Set sets this vector X, Y, Z and W components. Returns the pointer to this updated vector.
func (*Vector4) SetAxisAngleFromQuaternion ¶
func (v *Vector4) SetAxisAngleFromQuaternion(q *Quaternion) *Vector4
SetAxisAngleFromQuaternion set this vector to be the axis (x, y, z) and angle (w) of a rotation specified the quaternion q. Assumes q is normalized.
func (*Vector4) SetAxisFromRotationMatrix ¶
SetAxisFromRotationMatrix sets this vector to be the axis (x, y, z) and angle (w) of a rotation specified the matrix m. Assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).
func (*Vector4) SetByName ¶
SetByName sets this vector component value by its case insensitive name: "x", "y", "z" or "w".
func (*Vector4) SetComponent ¶
SetComponent sets this vector component value by its index: 0 for X, 1 for Y, 2 for Z, 3 for W. Returns the pointer to this updated vector
func (*Vector4) SetLength ¶
SetLength sets this vector to have the specified length. If the current length is zero, does nothing. Returns the pointer to this updated vector.
func (*Vector4) SetVector3 ¶
SetVector3 sets this vector from another Vector3 and W
func (*Vector4) SetW ¶
SetW sets this vector W component. Returns the pointer to this updated vector.
func (*Vector4) SetX ¶
SetX sets this vector X component. Returns the pointer to this updated Vector.
func (*Vector4) SetY ¶
SetY sets this vector Y component. Returns the pointer to this updated vector.
func (*Vector4) SetZ ¶
SetZ sets this vector Z component. Returns the pointer to this updated vector.
func (*Vector4) Sub ¶
Sub subtracts other vector from this one. Returns the pointer to this updated vector.
func (*Vector4) SubScalar ¶
SubScalar subtracts scalar s from each component of this vector. Returns the pointer to this updated vector.
func (*Vector4) SubVectors ¶
SubVectors sets this vector to a - b. Returns the pointer to this updated vector.
func (*Vector4) ToArray ¶
ToArray copies this vector's components to array starting at offset. Returns the array.