Documentation ¶
Overview ¶
mat32 is our version of the G3N math32 32-bit, 3D rendering-based math library.
Initially copied from G3N: github.com/g3n/engine/math32 Copyright 2016 The G3N Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
A major modification from the G3N version is to use value-based logic instead of pointer-based self-modification in the Vector classes, As used in e.g., go-gl/mathgl (which uses slice-based vectors instead of the more intuitive and likely more efficient struct-based ones here).
The pointer-based approach was retained for the Matrix classes, which are larger and that is likely more performant.
Many names were shortened, consistent with more idiomatic Go naming. and again with the go-gl/mathgl library
Index ¶
- Constants
- Variables
- func Abs(x float32) float32
- func Acos(x float32) float32
- func Acosh(x float32) float32
- func Asin(x float32) float32
- func Asinh(x float32) float32
- func Atan(x float32) float32
- func Atan2(y, x float32) float32
- func Atanh(x float32) float32
- func Cbrt(x float32) float32
- func Ceil(x float32) float32
- func Clamp(x, a, b float32) float32
- func ClampInt(x, a, b int) int
- func ContainsPoint(point, a, b, c Vec3) bool
- func CopyFloat32s(trg *[]float32, src []float32)
- func CopyFloat64s(trg *[]float64, src []float64)
- func Copysign(f, sign float32) float32
- func Cos(x float32) float32
- func Cosh(x float32) float32
- func DegToRad(degrees float32) float32
- func Dim(x, y float32) float32
- func Erf(x float32) float32
- func Erfc(x float32) float32
- func Erfcinv(x float32) float32
- func Erfinv(x float32) float32
- func Exp(x float32) float32
- func Exp2(x float32) float32
- func Expm1(x float32) float32
- func FMA(x, y, z float32) float32
- func FastExp(x float32) float32
- func FitGeomInWindow(stPos, stSz, winPos, winSz int) (pos, sz int)
- func Floor(x float32) float32
- func Frexp(f float32) (frac float32, exp int)
- func FromFixed(x fixed.Int26_6) float32
- func Gamma(x float32) float32
- func Hypot(p, q float32) float32
- func Ilogb(x float32) float32
- func Inf(sign int) float32
- func IntMultiple(val, mod float32) float32
- func IntMultipleGE(val, mod float32) float32
- func IsInf(x float32, sign int) bool
- func IsNaN(x float32) bool
- func J0(x float32) float32
- func J1(x float32) float32
- func Jn(n int, x float32) float32
- func Ldexp(frac float32, exp int) float32
- func Lerp(start, stop, amount float32) float32
- func Lgamma(x float32) (lgamma float32, sign int)
- func Log(x float32) float32
- func Log10(x float32) float32
- func Log1p(x float32) float32
- func Log2(x float32) float32
- func Logb(x float32) float32
- func Max(x, y float32) float32
- func Max32i(a, b int32) int32
- func MaxPos(a, b float32) float32
- func Min(x, y float32) float32
- func Min32i(a, b int32) int32
- func MinPos(a, b float32) float32
- func Mod(x, y float32) float32
- func Modf(f float32) (it float32, frac float32)
- func NaN() float32
- func Nextafter(x, y float32) float32
- func ParseAngle32(pstr string) (float32, error)
- func ParseFloat32(pstr string) (float32, error)
- func PointDim(v image.Point, dim Dims) int
- func PointsCheckN(pts []float32, n int, errmsg string) error
- func Pow(x, y float32) float32
- func Pow10(n int) float32
- func RadToDeg(radians float32) float32
- func ReadPoints(pstr string) []float32
- func RectFromPosSizeMax(pos, sz Vec2) image.Rectangle
- func RectFromPosSizeMin(pos, sz Vec2) image.Rectangle
- func RectInNotEmpty(r, b image.Rectangle) bool
- func Remainder(x, y float32) float32
- func Round(x float32) float32
- func RoundToEven(x float32) float32
- func SRGBFromLinear(lin float32) float32
- func SRGBToLinear(sr float32) float32
- func SetPointDim(v *image.Point, dim Dims, value int)
- func Sign(x float32) float32
- func Signbit(x float32) bool
- func Sin(x float32) float32
- func Sincos(x float32) (sin, cos float32)
- func Sinh(x float32) float32
- func Sqrt(x float32) float32
- func Tan(x float32) float32
- func Tanh(x float32) float32
- func ToFixed(x float32) fixed.Int26_6
- func ToFixedPoint(x, y float32) fixed.Point26_6
- func Trunc(x float32) float32
- func Truncate(val float32, prec int) float32
- func Truncate64(val float64, prec int) float64
- func Y0(x float32) float32
- func Y1(x float32) float32
- func Yn(n int, x float32) float32
- type ArrayF32
- func (a *ArrayF32) Append(v ...float32)
- func (a *ArrayF32) AppendVec2(v ...Vec2)
- func (a *ArrayF32) AppendVec3(v ...Vec3)
- func (a *ArrayF32) AppendVec4(v ...Vec4)
- func (a *ArrayF32) Bytes() int
- func (a *ArrayF32) CopyFrom(src ArrayF32)
- func (a *ArrayF32) Extend(addLen int)
- func (a ArrayF32) GetMat4(pos int, m *Mat4)
- func (a ArrayF32) GetVec2(pos int, v *Vec2)
- func (a ArrayF32) GetVec3(pos int, v *Vec3)
- func (a ArrayF32) GetVec4(pos int, v *Vec4)
- func (a *ArrayF32) Len() int
- func (a ArrayF32) Set(pos int, v ...float32)
- func (a ArrayF32) SetVec2(pos int, v Vec2)
- func (a ArrayF32) SetVec3(pos int, v Vec3)
- func (a ArrayF32) SetVec4(pos int, v Vec4)
- func (a *ArrayF32) Size() int
- type ArrayU32
- type Box2
- func (b Box2) Canon() Box2
- func (b Box2) Center() Vec2
- func (b Box2) ClampPoint(point Vec2) Vec2
- func (b Box2) ContainsBox(box Box2) bool
- func (b Box2) ContainsPoint(point Vec2) bool
- func (b Box2) DistToPoint(point Vec2) float32
- func (b *Box2) ExpandByBox(box Box2)
- func (b *Box2) ExpandByPoint(point Vec2)
- func (b *Box2) ExpandByScalar(scalar float32)
- func (b *Box2) ExpandByVector(vector Vec2)
- func (b Box2) Intersect(other Box2) Box2
- func (b Box2) IntersectsBox(other Box2) bool
- func (b *Box2) IsEmpty() bool
- func (b Box2) IsEqual(other Box2) bool
- func (b Box2) MulMat2(m Mat2) Box2
- func (b *Box2) Set(min, max *Vec2)
- func (b *Box2) SetEmpty()
- func (b *Box2) SetFromCenterAndSize(center, size Vec2)
- func (b *Box2) SetFromPoints(points []Vec2)
- func (b *Box2) SetFromRect(rect image.Rectangle)
- func (b Box2) Size() Vec2
- func (b Box2) ToRect() image.Rectangle
- func (b Box2) Translate(offset Vec2) Box2
- func (b Box2) Union(other Box2) Box2
- type Box3
- func (b Box3) Center() Vec3
- func (b Box3) ClampPoint(point Vec3) Vec3
- func (b Box3) ContainsBox(box Box3) bool
- func (b Box3) ContainsPoint(point Vec3) bool
- func (b Box3) DistToPoint(point Vec3) float32
- func (b *Box3) ExpandByBox(box Box3)
- func (b *Box3) ExpandByPoint(point Vec3)
- func (b *Box3) ExpandByPoints(points []Vec3)
- func (b *Box3) ExpandByScalar(scalar float32)
- func (b *Box3) ExpandByVector(vector Vec3)
- func (b Box3) GetBoundingSphere() Sphere
- func (b Box3) Intersect(other Box3) Box3
- func (b Box3) IntersectsBox(other Box3) bool
- func (b Box3) IsEmpty() bool
- func (b Box3) IsEqual(other Box3) bool
- func (b Box3) MVProjToNDC(m *Mat4) Box3
- func (b Box3) MulMat4(m *Mat4) Box3
- func (b Box3) MulQuat(q Quat) Box3
- func (b *Box3) Set(min, max *Vec3)
- func (b *Box3) SetEmpty()
- func (b *Box3) SetFromCenterAndSize(center, size Vec3)
- func (b *Box3) SetFromPoints(points []Vec3)
- func (b Box3) Size() Vec3
- func (b Box3) Translate(offset Vec3) Box3
- func (b Box3) Union(other Box3) Box3
- type Dims
- func (i Dims) Desc() string
- func (i Dims) Int64() int64
- func (i Dims) IsValid() bool
- func (i Dims) MarshalText() ([]byte, error)
- func (d Dims) Other() Dims
- func (i *Dims) SetInt64(in int64)
- func (i *Dims) SetString(s string) error
- func (i Dims) String() string
- func (i *Dims) UnmarshalText(text []byte) error
- func (i Dims) Values() []enums.Enum
- type Frustum
- type Geom2DInt
- type Line3
- type Mat2
- func (a Mat2) ExtractRot() float32
- func (a Mat2) ExtractScale() (scx, scy float32)
- func (a Mat2) Inverse() Mat2
- func (m Mat2) IsIdentity() bool
- func (a Mat2) Mul(b Mat2) Mat2
- func (a Mat2) MulCtr(b Mat2, ctr Vec2) Mat2
- func (a Mat2) MulFixedAsPt(fp fixed.Point26_6) fixed.Point26_6
- func (a Mat2) MulVec2AsPt(v Vec2) Vec2
- func (a Mat2) MulVec2AsPtCtr(v, ctr Vec2) Vec2
- func (a Mat2) MulVec2AsVec(v Vec2) Vec2
- func (a Mat2) Rotate(angle float32) Mat2
- func (a Mat2) Scale(x, y float32) Mat2
- func (a *Mat2) SetMul(b Mat2)
- func (a *Mat2) SetMulCtr(b Mat2, ctr Vec2)
- func (a *Mat2) SetString(str string) error
- func (a Mat2) Shear(x, y float32) Mat2
- func (a Mat2) Skew(x, y float32) Mat2
- func (a *Mat2) String() string
- func (a Mat2) Translate(x, y float32) Mat2
- type Mat3
- func (m *Mat3) CopyFrom(src *Mat3)
- func (m *Mat3) Determinant() float32
- func (m *Mat3) FromArray(array []float32, offset int)
- func (m *Mat3) Inverse() (*Mat3, error)
- func (m *Mat3) Mul(other *Mat3) *Mat3
- func (m *Mat3) MulMatrices(a, b *Mat3)
- func (m *Mat3) MulScalar(s float32)
- func (m *Mat3) MulVec3Array(array []float32, start, count int)
- func (m *Mat3) ScaleCols(v Vec3) *Mat3
- func (m *Mat3) Set(n11, n12, n13, n21, n22, n23, n31, n32, n33 float32)
- func (m *Mat3) SetFromMat4(src *Mat4)
- func (m *Mat3) SetIdentity()
- func (m *Mat3) SetInverse(src *Mat3) error
- func (m *Mat3) SetMul(other *Mat3)
- func (m *Mat3) SetMulScalar(s float32)
- func (m *Mat3) SetNormalMatrix(src *Mat4) error
- func (m *Mat3) SetRotationFromQuat(q Quat)
- func (m *Mat3) SetScaleCols(v Vec3)
- func (m *Mat3) SetTranspose()
- func (m *Mat3) SetZero()
- func (m *Mat3) ToArray(array []float32, offset int)
- func (m *Mat3) Transpose() *Mat3
- type Mat4
- func (m *Mat4) CopyFrom(src *Mat4)
- func (m *Mat4) CopyPos(src *Mat4)
- func (m *Mat4) Decompose() (pos Vec3, quat Quat, scale Vec3)
- func (m *Mat4) Determinant() float32
- func (m *Mat4) ExtractBasis() (xAxis, yAxis, zAxis Vec3)
- func (m *Mat4) ExtractRotation(src *Mat4)
- func (m *Mat4) FromArray(array []float32, offset int)
- func (m *Mat4) GetMaxScaleOnAxis() float32
- func (m *Mat4) Inverse() (*Mat4, error)
- func (m *Mat4) LookAt(eye, target, up Vec3)
- func (m *Mat4) Mul(other *Mat4) *Mat4
- func (m *Mat4) MulMatrices(a, b *Mat4)
- func (m *Mat4) MulScalar(s float32)
- func (m *Mat4) MulVec3Array(array []float32, start, count int)
- func (m *Mat4) Pos() Vec3
- func (m *Mat4) ScaleCols(v Vec3) *Mat4
- func (m *Mat4) Set(...)
- func (m *Mat4) SetBasis(xAxis, yAxis, zAxis Vec3)
- func (m *Mat4) SetFromMat3(src *Mat3)
- func (m *Mat4) SetFrustum(left, right, bottom, top, near, far float32)
- func (m *Mat4) SetIdentity()
- func (m *Mat4) SetInverse(src *Mat4) error
- func (m *Mat4) SetMul(other *Mat4)
- func (m *Mat4) SetOrthographic(width, height, near, far float32)
- func (m *Mat4) SetPerspective(fov, aspect, near, far float32)
- func (m *Mat4) SetPos(v Vec3)
- func (m *Mat4) SetRotationAxis(axis *Vec3, angle float32)
- func (m *Mat4) SetRotationFromEuler(euler Vec3)
- func (m *Mat4) SetRotationFromQuat(q Quat)
- func (m *Mat4) SetRotationX(theta float32)
- func (m *Mat4) SetRotationY(theta float32)
- func (m *Mat4) SetRotationZ(theta float32)
- func (m *Mat4) SetScale(x, y, z float32)
- func (m *Mat4) SetScaleCols(v Vec3)
- func (m *Mat4) SetTransform(pos Vec3, quat Quat, scale Vec3)
- func (m *Mat4) SetTranslation(x, y, z float32)
- func (m *Mat4) SetTranspose()
- func (m *Mat4) SetVkFrustum(left, right, bottom, top, near, far float32)
- func (m *Mat4) SetVkPerspective(fov, aspect, near, far float32)
- func (m *Mat4) SetZero()
- func (m *Mat4) ToArray(array []float32, offset int)
- func (m *Mat4) Transpose() *Mat4
- type Plane
- func (p *Plane) CoplanarPoint() Vec3
- func (p *Plane) DistToPoint(point Vec3) float32
- func (p *Plane) DistToSphere(sphere Sphere) float32
- func (p *Plane) IntersectLine(line Line3) (Vec3, bool)
- func (p *Plane) IsEqual(other *Plane) bool
- func (p *Plane) IsIntersectionLine(line Line3) bool
- func (p *Plane) Negate()
- func (p *Plane) Normalize()
- func (p *Plane) Set(normal Vec3, offset float32)
- func (p *Plane) SetDims(x, y, z, w float32)
- func (p *Plane) SetFromCoplanarPoints(a, b, c Vec3)
- func (p *Plane) SetFromNormalAndCoplanarPoint(normal Vec3, point Vec3)
- func (p *Plane) SetTranslate(offset Vec3)
- type Quat
- func (q *Quat) Conjugate() Quat
- func (q *Quat) Dot(other Quat) float32
- func (q *Quat) FromArray(array []float32, offset int)
- func (q *Quat) GenGoNew() string
- func (q *Quat) GenGoSet(path string) string
- func (q *Quat) Inverse() Quat
- func (q *Quat) IsEqual(other Quat) bool
- func (q *Quat) IsIdentity() bool
- func (q *Quat) IsNil() bool
- func (q Quat) Length() float32
- func (q Quat) LengthSq() float32
- func (q *Quat) Mul(other Quat) Quat
- func (q *Quat) MulQuats(a, b Quat)
- func (q *Quat) Normalize()
- func (q *Quat) NormalizeFast()
- func (q *Quat) Set(x, y, z, w float32)
- func (q *Quat) SetConjugate()
- func (q *Quat) SetFromAxisAngle(axis Vec3, angle float32)
- func (q *Quat) SetFromEuler(euler Vec3)
- func (q *Quat) SetFromRotationMatrix(m *Mat4)
- func (q *Quat) SetFromUnitVectors(vFrom, vTo Vec3)
- func (q *Quat) SetIdentity()
- func (q *Quat) SetInverse()
- func (q *Quat) SetMul(other Quat)
- func (q *Quat) Slerp(other Quat, t float32)
- func (q Quat) String() string
- func (q *Quat) ToArray(array []float32, offset int)
- func (q *Quat) ToAxisAngle() Vec4
- func (q *Quat) ToEuler() Vec3
- type Ray
- func (ray *Ray) ApplyMat4(mat4 *Mat4)
- func (ray *Ray) At(t float32) Vec3
- func (ray *Ray) ClosestPointToPoint(point Vec3) Vec3
- func (ray *Ray) DistSqToPoint(point Vec3) float32
- func (ray *Ray) DistSqToSegment(v0, v1 Vec3, optPointOnRay, optPointOnSegment *Vec3) float32
- func (ray *Ray) DistToPlane(plane Plane) float32
- func (ray *Ray) DistToPoint(point Vec3) float32
- func (ray *Ray) IntersectBox(box Box3) (Vec3, bool)
- func (ray *Ray) IntersectPlane(plane Plane) (Vec3, bool)
- func (ray *Ray) IntersectSphere(sphere Sphere) (Vec3, bool)
- func (ray *Ray) IntersectTriangle(a, b, c Vec3, backfaceCulling bool) (Vec3, bool)
- func (ray *Ray) IntersectsBox(box Box3) bool
- func (ray *Ray) IsEqual(other Ray) bool
- func (ray *Ray) IsIntersectPlane(plane Plane) bool
- func (ray *Ray) IsIntersectionSphere(sphere Sphere) bool
- func (ray *Ray) Recast(t float32)
- func (ray *Ray) Set(origin, dir Vec3)
- type Sphere
- func (s *Sphere) ClampPoint(point Vec3) Vec3
- func (s *Sphere) ContainsPoint(point Vec3) bool
- func (s *Sphere) DistToPoint(point Vec3) float32
- func (s *Sphere) GetBoundingBox() Box3
- func (s *Sphere) IntersectSphere(other Sphere) bool
- func (s *Sphere) IsEmpty(sphere *Sphere) bool
- func (s *Sphere) MulMat4(mat *Mat4)
- func (s *Sphere) Set(center Vec3, radius float32)
- func (s *Sphere) SetFromBox(box Box3)
- func (s *Sphere) SetFromPoints(points []Vec3, optCenter *Vec3)
- func (s *Sphere) Translate(offset Vec3)
- type Spline
- type Triangle
- func (t *Triangle) Area() float32
- func (t *Triangle) BarycoordFromPoint(point Vec3) Vec3
- func (t *Triangle) ContainsPoint(point Vec3) bool
- func (t *Triangle) IsEqual(tri Triangle) bool
- func (t *Triangle) Midpoint() Vec3
- func (t *Triangle) Normal() Vec3
- func (t *Triangle) Plane() Plane
- func (t *Triangle) Set(a, b, c Vec3)
- func (t *Triangle) SetFromPointsAndIndices(points []Vec3, i0, i1, i2 int)
- type Vec2
- func (v Vec2) Abs() Vec2
- func (v Vec2) Add(other Vec2) Vec2
- func (a Vec2) AddDim(d Dims, val float32) Vec2
- func (v Vec2) AddScalar(s float32) Vec2
- func (v Vec2) AlmostEqual(other Vec2, tol float32) bool
- func (v Vec2) AngleTo(other Vec2) float32
- func (v Vec2) Ceil() Vec2
- func (v *Vec2) Clamp(min, max Vec2)
- func (v *Vec2) ClampScalar(minVal, maxVal float32)
- func (v Vec2) CosTo(other Vec2) float32
- func (v Vec2) Cross(other Vec2) float32
- func (v Vec2) Dim(dim Dims) float32
- func (v Vec2) DistTo(other Vec2) float32
- func (v Vec2) DistToSquared(other Vec2) float32
- func (v Vec2) Div(other Vec2) Vec2
- func (a Vec2) DivDim(d Dims, val float32) Vec2
- func (v Vec2) DivScalar(scalar float32) Vec2
- func (v Vec2) Dot(other Vec2) float32
- func (a Vec2) Fixed() fixed.Point26_6
- func (v Vec2) Floor() Vec2
- func (v *Vec2) FromArray(array []float32, offset int)
- func (v Vec2) InTriangle(p0, p1, p2 Vec2) bool
- func (v Vec2) IsEqual(other Vec2) bool
- func (v Vec2) Length() float32
- func (v Vec2) LengthSq() float32
- func (v Vec2) Lerp(other Vec2, alpha float32) Vec2
- func (v Vec2) Max(other Vec2) Vec2
- func (v Vec2) Min(other Vec2) Vec2
- func (a Vec2) MinPos(b Vec2) Vec2
- func (v Vec2) Mul(other Vec2) Vec2
- func (a Vec2) MulDim(d Dims, val float32) Vec2
- func (v Vec2) MulScalar(s float32) Vec2
- func (v Vec2) Negate() Vec2
- func (v Vec2) Normal() Vec2
- func (v *Vec2) Normalize()
- func (v Vec2) Round() Vec2
- func (v *Vec2) Set(x, y float32)
- func (v *Vec2) SetAdd(other Vec2)
- func (a *Vec2) SetAddDim(d Dims, val float32)
- func (v *Vec2) SetAddScalar(s float32)
- func (v *Vec2) SetByName(name string, value float32)
- func (v *Vec2) SetCeil()
- func (v *Vec2) SetDim(dim Dims, value float32)
- func (v *Vec2) SetDiv(other Vec2)
- func (a *Vec2) SetDivDim(d Dims, val float32)
- func (v *Vec2) SetDivScalar(s float32)
- func (a *Vec2) SetFixed(pt fixed.Point26_6)
- func (v *Vec2) SetFloor()
- func (v *Vec2) SetFromVec2i(vi Vec2i)
- func (v *Vec2) SetLength(l float32)
- func (v *Vec2) SetLerp(other Vec2, alpha float32)
- func (v *Vec2) SetMax(other Vec2)
- func (a *Vec2) SetMaxDim(d Dims, val float32)
- func (a *Vec2) SetMaxPos(o Vec2)
- func (v *Vec2) SetMaxScalar(val float32)
- func (v *Vec2) SetMin(other Vec2)
- func (a *Vec2) SetMinDim(d Dims, val float32)
- func (v *Vec2) SetMinPos(b Vec2)
- func (a *Vec2) SetMinPosDim(d Dims, val float32)
- func (v *Vec2) SetMinPosScalar(val float32)
- func (v *Vec2) SetMinScalar(val float32)
- func (v *Vec2) SetMul(other Vec2)
- func (a *Vec2) SetMulDim(d Dims, val float32)
- func (v *Vec2) SetMulScalar(s float32)
- func (v *Vec2) SetNegate()
- func (v *Vec2) SetNormal()
- func (a *Vec2) SetPoint(pt image.Point)
- func (v *Vec2) SetRound()
- func (v *Vec2) SetScalar(s float32)
- func (v *Vec2) SetSub(other Vec2)
- func (a *Vec2) SetSubDim(d Dims, val float32)
- func (v *Vec2) SetSubScalar(s float32)
- func (v *Vec2) SetZero()
- func (a Vec2) String() string
- func (v Vec2) Sub(other Vec2) Vec2
- func (a Vec2) SubDim(d Dims, val float32) Vec2
- func (v Vec2) SubScalar(s float32) Vec2
- func (v Vec2) ToArray(array []float32, offset int)
- func (a Vec2) ToCeil() Vec2
- func (a Vec2) ToFloor() Vec2
- func (a Vec2) ToPoint() image.Point
- func (a Vec2) ToPointCeil() image.Point
- func (a Vec2) ToPointFloor() image.Point
- func (a Vec2) ToPointRound() image.Point
- func (a Vec2) ToRound() Vec2
- func (v Vec2) WindowToNDC(size, off Vec2, flipY bool) Vec3
- type Vec2i
- func (v Vec2i) Add(other Vec2i) Vec2i
- func (v Vec2i) AddScalar(s int32) Vec2i
- func (v *Vec2i) Clamp(min, max Vec2i)
- func (v *Vec2i) ClampScalar(minVal, maxVal int32)
- func (v Vec2i) Dim(dim Dims) int32
- func (v Vec2i) Div(other Vec2i) Vec2i
- func (v Vec2i) DivScalar(scalar int32) Vec2i
- func (v *Vec2i) FromArray(array []int32, offset int)
- func (v Vec2i) IsEqual(other Vec2i) bool
- func (v Vec2i) Max(other Vec2i) Vec2i
- func (v Vec2i) Min(other Vec2i) Vec2i
- func (v Vec2i) Mul(other Vec2i) Vec2i
- func (v Vec2i) MulScalar(s int32) Vec2i
- func (v Vec2i) Negate() Vec2i
- func (v *Vec2i) Set(x, y int32)
- func (v *Vec2i) SetAdd(other Vec2i)
- func (v *Vec2i) SetAddScalar(s int32)
- func (v *Vec2i) SetByName(name string, value int32)
- func (v *Vec2i) SetDim(dim Dims, value int32)
- func (v *Vec2i) SetDiv(other Vec2i)
- func (v *Vec2i) SetDivScalar(s int32)
- func (v *Vec2i) SetFromVec2(vf Vec2)
- func (v *Vec2i) SetMax(other Vec2i)
- func (v *Vec2i) SetMin(other Vec2i)
- func (v *Vec2i) SetMul(other Vec2i)
- func (v *Vec2i) SetMulScalar(s int32)
- func (v *Vec2i) SetNegate()
- func (v *Vec2i) SetScalar(s int32)
- func (v *Vec2i) SetSub(other Vec2i)
- func (v *Vec2i) SetSubScalar(s int32)
- func (v *Vec2i) SetZero()
- func (v Vec2i) Sub(other Vec2i) Vec2i
- func (v Vec2i) SubScalar(s int32) Vec2i
- func (v Vec2i) ToArray(array []int32, offset int)
- type Vec3
- func (v Vec3) Abs() Vec3
- func (v Vec3) Add(other Vec3) Vec3
- func (v Vec3) AddScalar(s float32) Vec3
- func (v *Vec3) AlmostEqual(other Vec3, tol float32) bool
- func (v Vec3) AngleTo(other Vec3) float32
- func (v Vec3) Ceil() Vec3
- func (v *Vec3) Clamp(min, max Vec3)
- func (v *Vec3) ClampScalar(minVal, maxVal float32)
- func (v Vec3) CosTo(other Vec3) float32
- func (v Vec3) Cross(other Vec3) Vec3
- func (v Vec3) Dim(dim Dims) float32
- func (v Vec3) DistTo(other Vec3) float32
- func (v Vec3) DistToSquared(other Vec3) float32
- func (v Vec3) Div(other Vec3) Vec3
- func (v Vec3) DivScalar(scalar float32) Vec3
- func (v Vec3) Dot(other Vec3) float32
- func (v Vec3) Floor() Vec3
- func (v *Vec3) FromArray(array []float32, offset int)
- func (v *Vec3) GenGoNew() string
- func (v *Vec3) GenGoSet(path string) string
- func (v Vec3) IsEqual(other Vec3) bool
- func (v Vec3) Length() float32
- func (v Vec3) LengthSq() float32
- func (v Vec3) Lerp(other Vec3, alpha float32) Vec3
- func (v Vec3) MVProjToNDC(m *Mat4, w float32) Vec3
- func (v Vec3) Max(other Vec3) Vec3
- func (v Vec3) Min(other Vec3) Vec3
- func (v Vec3) Mul(other Vec3) Vec3
- func (v Vec3) MulMat3(m *Mat3) Vec3
- func (v Vec3) MulMat4(m *Mat4) Vec3
- func (v Vec3) MulMat4AsVec4(m *Mat4, w float32) Vec3
- func (v Vec3) MulProjection(m *Mat4) Vec3
- func (v Vec3) MulQuat(q Quat) Vec3
- func (v Vec3) MulScalar(s float32) Vec3
- func (v Vec3) NDCToWindow(size, off Vec2, near, far float32, flipY bool) Vec3
- func (v Vec3) Negate() Vec3
- func (v Vec3) Normal() Vec3
- func (v *Vec3) Normalize()
- func (v *Vec3) ProjectOnPlane(planeNormal Vec3) Vec3
- func (v *Vec3) ProjectOnVector(other Vec3) Vec3
- func (v *Vec3) RandomTangents() (Vec3, Vec3)
- func (v *Vec3) Reflect(normal Vec3) Vec3
- func (v Vec3) RotateAxisAngle(axis Vec3, angle float32) Vec3
- func (v Vec3) Round() Vec3
- func (v Vec3) SRGBFromLinear() Vec3
- func (v Vec3) SRGBToLinear() Vec3
- func (v *Vec3) Set(x, y, z float32)
- func (v *Vec3) SetAdd(other Vec3)
- func (v *Vec3) SetAddScalar(s float32)
- func (v *Vec3) SetByName(name string, value float32)
- func (v *Vec3) SetCeil()
- func (v *Vec3) SetColor(clr color.Color)
- func (v *Vec3) SetDim(dim Dims, value float32)
- func (v *Vec3) SetDiv(other Vec3)
- func (v *Vec3) SetDivScalar(s float32)
- func (v *Vec3) SetEulerAnglesFromMatrix(m *Mat4)
- func (v *Vec3) SetEulerAnglesFromQuat(q Quat)
- func (v *Vec3) SetFloor()
- func (v *Vec3) SetFromMatrixCol(index int, m *Mat4)
- func (v *Vec3) SetFromMatrixPos(m *Mat4)
- func (v *Vec3) SetFromVec3i(vi Vec3i)
- func (v *Vec3) SetFromVec4(other Vec4)
- func (v *Vec3) SetLength(l float32)
- func (v *Vec3) SetLerp(other Vec3, alpha float32)
- func (v *Vec3) SetMax(other Vec3)
- func (v *Vec3) SetMin(other Vec3)
- func (v *Vec3) SetMul(other Vec3)
- func (v *Vec3) SetMulMat3(m *Mat3)
- func (v *Vec3) SetMulMat4(m *Mat4)
- func (v *Vec3) SetMulQuat(q Quat)
- func (v *Vec3) SetMulScalar(s float32)
- func (v *Vec3) SetNegate()
- func (v *Vec3) SetNormal()
- func (v *Vec3) SetRotateAxisAngle(axis Vec3, angle float32)
- func (v *Vec3) SetRound()
- func (v *Vec3) SetScalar(s float32)
- func (v *Vec3) SetSub(other Vec3)
- func (v *Vec3) SetSubScalar(s float32)
- func (v *Vec3) SetZero()
- func (a Vec3) String() string
- func (v Vec3) Sub(other Vec3) Vec3
- func (v Vec3) SubScalar(s float32) Vec3
- func (v Vec3) ToArray(array []float32, offset int)
- type Vec3i
- func (v Vec3i) Add(other Vec3i) Vec3i
- func (v Vec3i) AddScalar(s int32) Vec3i
- func (v *Vec3i) Clamp(min, max Vec3i)
- func (v *Vec3i) ClampScalar(minVal, maxVal int32)
- func (v Vec3i) Dim(dim Dims) int32
- func (v Vec3i) Div(other Vec3i) Vec3i
- func (v Vec3i) DivScalar(scalar int32) Vec3i
- func (v *Vec3i) FromArray(array []int32, offset int)
- func (v Vec3i) IsEqual(other Vec3i) bool
- func (v Vec3i) Max(other Vec3i) Vec3i
- func (v Vec3i) Min(other Vec3i) Vec3i
- func (v Vec3i) Mul(other Vec3i) Vec3i
- func (v Vec3i) MulScalar(s int32) Vec3i
- func (v Vec3i) Negate() Vec3i
- func (v *Vec3i) Set(x, y, z int32)
- func (v *Vec3i) SetAdd(other Vec3i)
- func (v *Vec3i) SetAddScalar(s int32)
- func (v *Vec3i) SetByName(name string, value int32)
- func (v *Vec3i) SetDim(dim Dims, value int32)
- func (v *Vec3i) SetDiv(other Vec3i)
- func (v *Vec3i) SetDivScalar(s int32)
- func (v *Vec3i) SetFromVec3(vf Vec3)
- func (v *Vec3i) SetMax(other Vec3i)
- func (v *Vec3i) SetMin(other Vec3i)
- func (v *Vec3i) SetMul(other Vec3i)
- func (v *Vec3i) SetMulScalar(s int32)
- func (v *Vec3i) SetNegate()
- func (v *Vec3i) SetScalar(s int32)
- func (v *Vec3i) SetSub(other Vec3i)
- func (v *Vec3i) SetSubScalar(s int32)
- func (v *Vec3i) SetZero()
- func (v Vec3i) Sub(other Vec3i) Vec3i
- func (v Vec3i) SubScalar(s int32) Vec3i
- func (v Vec3i) ToArray(array []int32, offset int)
- type Vec4
- func (v Vec4) Add(other Vec4) Vec4
- func (v Vec4) AddScalar(s float32) Vec4
- func (v *Vec4) AlmostEqual(other Vec4, tol float32) bool
- func (v Vec4) Ceil() Vec4
- func (v *Vec4) Clamp(min, max Vec4)
- func (v *Vec4) ClampScalar(minVal, maxVal float32)
- func (v Vec4) Dim(dim Dims) float32
- func (v Vec4) Div(other Vec4) Vec4
- func (v Vec4) DivScalar(scalar float32) Vec4
- func (v Vec4) Dot(other Vec4) float32
- func (v Vec4) Floor() Vec4
- func (v *Vec4) FromArray(array []float32, offset int)
- func (v *Vec4) IsEqual(other Vec4) bool
- func (v Vec4) Length() float32
- func (v Vec4) LengthSq() float32
- func (v Vec4) Lerp(other Vec4, alpha float32) Vec4
- func (v Vec4) Max(other Vec4) Vec4
- func (v Vec4) Min(other Vec4) Vec4
- func (v Vec4) Mul(other Vec4) Vec4
- func (v Vec4) MulMat4(m *Mat4) Vec4
- func (v Vec4) MulScalar(s float32) Vec4
- func (v Vec4) Negate() Vec4
- func (v Vec4) Normal() Vec4
- func (v *Vec4) Normalize()
- func (v Vec4) PerspDiv() Vec3
- func (v Vec4) Round() Vec4
- func (v Vec4) SRGBFromLinear() Vec4
- func (v Vec4) SRGBToLinear() Vec4
- func (v *Vec4) Set(x, y, z, w float32)
- func (v *Vec4) SetAdd(other Vec4)
- func (v *Vec4) SetAddScalar(s float32)
- func (v *Vec4) SetAxisAngleFromQuat(q Quat)
- func (v *Vec4) SetAxisFromRotationMatrix(m *Mat4)
- func (v *Vec4) SetByName(name string, value float32)
- func (v *Vec4) SetCeil()
- func (v *Vec4) SetColor(clr color.Color)
- func (v *Vec4) SetDim(dim Dims, value float32)
- func (v *Vec4) SetDiv(other Vec4)
- func (v *Vec4) SetDivScalar(s float32)
- func (v *Vec4) SetFloor()
- func (v *Vec4) SetFromVec2(other Vec2)
- func (v *Vec4) SetFromVec3(other Vec3, w float32)
- func (v *Vec4) SetLength(l float32)
- func (v *Vec4) SetLerp(other *Vec4, alpha float32)
- func (v *Vec4) SetMax(other Vec4)
- func (v *Vec4) SetMin(other Vec4)
- func (v *Vec4) SetMul(other Vec4)
- func (v *Vec4) SetMulScalar(s float32)
- func (v *Vec4) SetNegate()
- func (v *Vec4) SetNormal()
- func (v *Vec4) SetRound()
- func (v *Vec4) SetSub(other Vec4)
- func (v *Vec4) SetSubScalar(s float32)
- func (v *Vec4) SetZero()
- func (v Vec4) String() string
- func (v Vec4) Sub(other Vec4) Vec4
- func (v Vec4) SubScalar(s float32) Vec4
- func (v Vec4) ToArray(array []float32, offset int)
Constants ¶
const ( E = math.E Pi = math.Pi Phi = math.Phi Sqrt2 = math.Sqrt2 SqrtE = math.SqrtE SqrtPi = math.SqrtPi SqrtPhi = math.SqrtPhi Ln2 = math.Ln2 Log2E = math.Log2E Ln10 = math.Ln10 Log10E = math.Log10E )
Mathematical constants.
const ( MaxFloat32 = math.MaxFloat32 SmallestNonzeroFloat32 = math.SmallestNonzeroFloat32 )
Floating-point limit values. Max is the largest finite value representable by the type. SmallestNonzero is the smallest positive, non-zero value representable by the type.
const ( // DegToRadFactor is the number of radians per degree. DegToRadFactor = Pi / 180 // RadToDegFactor is the number of degrees per radian. RadToDegFactor = 180 / Pi )
Variables ¶
var Infinity = float32(math.Inf(1))
Infinity is positive infinity.
Functions ¶
func Acos ¶
Acos returns the arccosine, in radians, of x.
Special case is:
Acos(x) = NaN if x < -1 or x > 1
func Acosh ¶
Acosh returns the inverse hyperbolic cosine of x.
Special cases are:
Acosh(+Inf) = +Inf Acosh(x) = NaN if x < 1 Acosh(NaN) = NaN
func Asin ¶
Asin returns the arcsine, in radians, of x.
Special cases are:
Asin(±0) = ±0 Asin(x) = NaN if x < -1 or x > 1
func Asinh ¶
Asinh returns the inverse hyperbolic sine of x.
Special cases are:
Asinh(±0) = ±0 Asinh(±Inf) = ±Inf Asinh(NaN) = NaN
func Atan ¶
Atan returns the arctangent, in radians, of x.
Special cases are:
Atan(±0) = ±0 Atan(±Inf) = ±Pi/2
func Atan2 ¶
Atan2 returns the arc tangent of y/x, using the signs of the two to determine the quadrant of the return value. Special cases are (in order):
Atan2(y, NaN) = NaN Atan2(NaN, x) = NaN Atan2(+0, x>=0) = +0 Atan2(-0, x>=0) = -0 Atan2(+0, x<=-0) = +Pi Atan2(-0, x<=-0) = -Pi Atan2(y>0, 0) = +Pi/2 Atan2(y<0, 0) = -Pi/2 Atan2(+Inf, +Inf) = +Pi/4 Atan2(-Inf, +Inf) = -Pi/4 Atan2(+Inf, -Inf) = 3Pi/4 Atan2(-Inf, -Inf) = -3Pi/4 Atan2(y, +Inf) = 0 Atan2(y>0, -Inf) = +Pi Atan2(y<0, -Inf) = -Pi Atan2(+Inf, x) = +Pi/2 Atan2(-Inf, x) = -Pi/2
func Atanh ¶
Atanh returns the inverse hyperbolic tangent of x.
Special cases are:
Atanh(1) = +Inf Atanh(±0) = ±0 Atanh(-1) = -Inf Atanh(x) = NaN if x < -1 or x > 1 Atanh(NaN) = NaN
func Cbrt ¶
Cbrt returns the cube root of x.
Special cases are:
Cbrt(±0) = ±0 Cbrt(±Inf) = ±Inf Cbrt(NaN) = NaN
func Ceil ¶
Ceil returns the least integer value greater than or equal to x.
Special cases are:
Ceil(±0) = ±0 Ceil(±Inf) = ±Inf Ceil(NaN) = NaN
func ContainsPoint ¶
ContainsPoint returns whether a triangle contains a point.
func CopyFloat32s ¶
CopyFloat32s copies a []float32 slice from src into target
func CopyFloat64s ¶
CopyFloat64s copies a []float64 slice from src into target
func Cos ¶
Cos returns the cosine of the radian argument x.
Special cases are:
Cos(±Inf) = NaN Cos(NaN) = NaN
func Cosh ¶
Cosh returns the hyperbolic cosine of x.
Special cases are:
Cosh(±0) = 1 Cosh(±Inf) = +Inf Cosh(NaN) = NaN
func Dim ¶
Dim returns the maximum of x-y or 0.
Special cases are:
Dim(+Inf, +Inf) = NaN Dim(-Inf, -Inf) = NaN Dim(x, NaN) = Dim(NaN, x) = NaN
func Erf ¶
Erf returns the error function of x.
Special cases are:
Erf(+Inf) = 1 Erf(-Inf) = -1 Erf(NaN) = NaN
func Erfc ¶
Erfc returns the complementary error function of x.
Special cases are:
Erfc(+Inf) = 0 Erfc(-Inf) = 2 Erfc(NaN) = NaN
func Erfcinv ¶
Erfcinv returns the inverse of Erfc(x).
Special cases are:
Erfcinv(0) = +Inf Erfcinv(2) = -Inf Erfcinv(x) = NaN if x < 0 or x > 2 Erfcinv(NaN) = NaN
func Erfinv ¶
Erfinv returns the inverse error function of x.
Special cases are:
Erfinv(1) = +Inf Erfinv(-1) = -Inf Erfinv(x) = NaN if x < -1 or x > 1 Erfinv(NaN) = NaN
func Exp ¶
Exp returns e**x, the base-e exponential of x.
Special cases are:
Exp(+Inf) = +Inf Exp(NaN) = NaN
Very large values overflow to 0 or +Inf. Very small values underflow to 1.
func Expm1 ¶
Expm1 returns e**x - 1, the base-e exponential of x minus 1. It is more accurate than Exp(x) - 1 when x is near zero.
Special cases are:
Expm1(+Inf) = +Inf Expm1(-Inf) = -1 Expm1(NaN) = NaN
Very large values overflow to -1 or +Inf.
func FMA ¶
FMA returns x * y + z, computed with only one rounding. (That is, FMA returns the fused multiply-add of x, y, and z.)
func FastExp ¶
FastExp is a quartic spline approximation to the Exp function, by N.N. Schraudolph It does not have any of the sanity checking of a standard method -- returns nonsense when arg is out of range. Runs in 2.23ns vs. 6.3ns for 64bit which is faster than math32.Exp actually.
func FitGeomInWindow ¶
FitGeomInWindow returns a position and size for a region (sub-window) within a larger window geom (pos and size) that fits entirely within that window to the extent possible, given an initial starting position and size. The position is first adjusted to try to fit the size, and then the size is adjusted to make it fit if it is still too big.
func Floor ¶
Floor returns the greatest integer value less than or equal to x.
Special cases are:
Floor(±0) = ±0 Floor(±Inf) = ±Inf Floor(NaN) = NaN
func Frexp ¶
Frexp breaks f into a normalized fraction and an integral power of two. It returns frac and exp satisfying f == frac × 2**exp, with the absolute value of frac in the interval [½, 1).
Special cases are:
Frexp(±0) = ±0, 0 Frexp(±Inf) = ±Inf, 0 Frexp(NaN) = NaN, 0
func Gamma ¶
Gamma returns the Gamma function of x.
Special cases are:
Gamma(+Inf) = +Inf Gamma(+0) = +Inf Gamma(-0) = -Inf Gamma(x) = NaN for integer x < 0 Gamma(-Inf) = NaN Gamma(NaN) = NaN
func Hypot ¶
Hypot returns Sqrt(p*p + q*q), taking care to avoid unnecessary overflow and underflow.
Special cases are:
Hypot(±Inf, q) = +Inf Hypot(p, ±Inf) = +Inf Hypot(NaN, q) = NaN Hypot(p, NaN) = NaN
func Ilogb ¶
Ilogb returns the binary exponent of x as an integer.
Special cases are:
Ilogb(±Inf) = MaxInt32 Ilogb(0) = MinInt32 Ilogb(NaN) = MaxInt32
func IntMultiple ¶
IntMultiple returns the interger multiple of mod closest to given value: Round(val / mod) * mod
func IntMultipleGE ¶
IntMultipleGE returns the interger multiple of mod >= given value: Ceil(val / mod) * mod
func IsInf ¶
IsInf reports whether f is an infinity, according to sign. If sign > 0, IsInf reports whether f is positive infinity. If sign < 0, IsInf reports whether f is negative infinity. If sign == 0, IsInf reports whether f is either infinity.
func J0 ¶
J0 returns the order-zero Bessel function of the first kind.
Special cases are:
J0(±Inf) = 0 J0(0) = 1 J0(NaN) = NaN
func J1 ¶
J1 returns the order-one Bessel function of the first kind.
Special cases are:
J1(±Inf) = 0 J1(NaN) = NaN
func Jn ¶
Jn returns the order-n Bessel function of the first kind.
Special cases are:
Jn(n, ±Inf) = 0 Jn(n, NaN) = NaN
func Ldexp ¶
Ldexp is the inverse of Frexp. It returns frac × 2**exp.
Special cases are:
Ldexp(±0, exp) = ±0 Ldexp(±Inf, exp) = ±Inf Ldexp(NaN, exp) = NaN
func Lgamma ¶
Lgamma returns the natural logarithm and sign (-1 or +1) of Gamma(x).
Special cases are:
Lgamma(+Inf) = +Inf Lgamma(0) = +Inf Lgamma(-integer) = +Inf Lgamma(-Inf) = -Inf Lgamma(NaN) = NaN
func Log ¶
Log returns the natural logarithm of x.
Special cases are:
Log(+Inf) = +Inf Log(0) = -Inf Log(x < 0) = NaN Log(NaN) = NaN
func Log1p ¶
Log1p returns the natural logarithm of 1 plus its argument x. It is more accurate than Log(1 + x) when x is near zero.
Special cases are:
Log1p(+Inf) = +Inf Log1p(±0) = ±0 Log1p(-1) = -Inf Log1p(x < -1) = NaN Log1p(NaN) = NaN
func Logb ¶
Logb returns the binary exponent of x.
Special cases are:
Logb(±Inf) = +Inf Logb(0) = -Inf Logb(NaN) = NaN
func Max ¶
Max returns the larger of x or y.
Special cases are:
Max(x, +Inf) = Max(+Inf, x) = +Inf Max(x, NaN) = Max(NaN, x) = NaN Max(+0, ±0) = Max(±0, +0) = +0 Max(-0, -0) = -0
Note that this differs from the built-in function max when called with NaN and +Inf.
func Min ¶
Min returns the smaller of x or y.
Special cases are:
Min(x, -Inf) = Min(-Inf, x) = -Inf Min(x, NaN) = Min(NaN, x) = NaN Min(-0, ±0) = Min(±0, -0) = -0
Note that this differs from the built-in function min when called with NaN and -Inf.
func Mod ¶
Mod returns the floating-point remainder of x/y. The magnitude of the result is less than y and its sign agrees with that of x.
Special cases are:
Mod(±Inf, y) = NaN Mod(NaN, y) = NaN Mod(x, 0) = NaN Mod(x, ±Inf) = x Mod(x, NaN) = NaN
func Modf ¶
Modf returns integer and fractional floating-point numbers that sum to f. Both values have the same sign as f.
Special cases are:
Modf(±Inf) = ±Inf, NaN Modf(NaN) = NaN, NaN
func Nextafter ¶
Nextafter returns the next representable float32 value after x towards y.
Special cases are:
Nextafter32(x, x) = x Nextafter32(NaN, y) = NaN Nextafter32(x, NaN) = NaN
func ParseAngle32 ¶
ParseAngle32 returns radians angle from string that can specify units (deg, grad, rad) -- deg is assumed if not specified
func ParseFloat32 ¶
ParseFloat32 logs any strconv.ParseFloat errors
func PointsCheckN ¶
PointsCheckN checks the number of points read and emits an error if not equal to n
func Pow ¶
Pow returns x**y, the base-x exponential of y.
Special cases are (in order):
Pow(x, ±0) = 1 for any x Pow(1, y) = 1 for any y Pow(x, 1) = x for any x Pow(NaN, y) = NaN Pow(x, NaN) = NaN Pow(±0, y) = ±Inf for y an odd integer < 0 Pow(±0, -Inf) = +Inf Pow(±0, +Inf) = +0 Pow(±0, y) = +Inf for finite y < 0 and not an odd integer Pow(±0, y) = ±0 for y an odd integer > 0 Pow(±0, y) = +0 for finite y > 0 and not an odd integer Pow(-1, ±Inf) = 1 Pow(x, +Inf) = +Inf for |x| > 1 Pow(x, -Inf) = +0 for |x| > 1 Pow(x, +Inf) = +0 for |x| < 1 Pow(x, -Inf) = +Inf for |x| < 1 Pow(+Inf, y) = +Inf for y > 0 Pow(+Inf, y) = +0 for y < 0 Pow(-Inf, y) = Pow(-0, -y) Pow(x, y) = NaN for finite x < 0 and finite non-integer y
func Pow10 ¶
Pow10 returns 10**n, the base-10 exponential of n.
Special cases are:
Pow10(n) = 0 for n < -323 Pow10(n) = +Inf for n > 308
func ReadPoints ¶
ReadPoints reads a set of floating point values from a SVG format number string -- returns a slice or nil if there was an error
func RectFromPosSizeMax ¶
RectFromPosSizeMax returns an image.Rectangle from max dims of pos, size (floor on pos, ceil on size)
func RectFromPosSizeMin ¶
RectFromPosSizeMin returns an image.Rectangle from min dims of pos, size (ceil on pos, floor on size)
func RectInNotEmpty ¶
RectInNotEmpty returns true if rect r is contained within b box and r is not empty. The existing image.Rectangle.In method returns true if r is empty, but we typically expect that case to be false (out of range box)
func Remainder ¶
Remainder returns the IEEE 754 floating-point remainder of x/y.
Special cases are:
Remainder(±Inf, y) = NaN Remainder(NaN, y) = NaN Remainder(x, 0) = NaN Remainder(x, ±Inf) = x Remainder(x, NaN) = NaN
func Round ¶
Round returns the nearest integer, rounding half away from zero.
Special cases are:
Round(±0) = ±0 Round(±Inf) = ±Inf Round(NaN) = NaN
func RoundToEven ¶
RoundToEven returns the nearest integer, rounding ties to even.
Special cases are:
RoundToEven(±0) = ±0 RoundToEven(±Inf) = ±Inf RoundToEven(NaN) = NaN
func SRGBFromLinear ¶
SRGBFromLinear converts a color with linear gamma correction to SRGB standard 2.4 gamma with offsets.
func SRGBToLinear ¶
SRGBToLinear converts a color with SRGB gamma correction to SRGB standard 2.4 gamma with offsets
func SetPointDim ¶
SetPointDim is a helper function for image.Point for setting given dimension
func Sin ¶
Sin returns the sine of the radian argument x.
Special cases are:
Sin(±0) = ±0 Sin(±Inf) = NaN Sin(NaN) = NaN
func Sincos ¶
Sincos returns Sin(x), Cos(x).
Special cases are:
Sincos(±0) = ±0, 1 Sincos(±Inf) = NaN, NaN Sincos(NaN) = NaN, NaN
func Sinh ¶
Sinh returns the hyperbolic sine of x.
Special cases are:
Sinh(±0) = ±0 Sinh(±Inf) = ±Inf Sinh(NaN) = NaN
func Sqrt ¶
Sqrt returns the square root of x.
Special cases are:
Sqrt(+Inf) = +Inf Sqrt(±0) = ±0 Sqrt(x < 0) = NaN Sqrt(NaN) = NaN
func Tan ¶
Tan returns the tangent of the radian argument x.
Special cases are:
Tan(±0) = ±0 Tan(±Inf) = NaN Tan(NaN) = NaN
func Tanh ¶
Tanh returns the hyperbolic tangent of x.
Special cases are:
Tanh(±0) = ±0 Tanh(±Inf) = ±1 Tanh(NaN) = NaN
func ToFixedPoint ¶
ToFixedPoint converts float32 x,y values to a fixed.Point26_6
func Trunc ¶
Trunc returns the integer value of x.
Special cases are:
Trunc(±0) = ±0 Trunc(±Inf) = ±Inf Trunc(NaN) = NaN
func Truncate ¶
Truncate rounds a float32 number to the given level of precision, which the number of significant digits to include in the result.
func Truncate64 ¶
Truncate64 rounds a float64 number to the given level of precision, which the number of significant digits to include in the result.
func Y0 ¶
Y0 returns the order-zero Bessel function of the second kind.
Special cases are:
Y0(+Inf) = 0 Y0(0) = -Inf Y0(x < 0) = NaN Y0(NaN) = NaN
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) AppendVec2 ¶
AppendVec2 appends any number of Vec2 to the array
func (*ArrayF32) AppendVec3 ¶
AppendVec3 appends any number of Vec3 to the array
func (*ArrayF32) AppendVec4 ¶
AppendVec4 appends any number of Vec4 to the array
func (*ArrayF32) Extend ¶
Extend appends given number of new float elements to end of existing array
func (ArrayF32) GetMat4 ¶
GetMat4 stores in the specified Mat4 the values from the array starting at the specified pos.
func (ArrayF32) GetVec2 ¶
GetVec2 stores in the specified Vec2 the values from the array starting at the specified pos.
func (ArrayF32) GetVec3 ¶
GetVec3 stores in the specified Vec3 the values from the array starting at the specified pos.
func (ArrayF32) GetVec4 ¶
GetVec4 stores in the specified Vec4 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) SetVec2 ¶
SetVec2 sets the values of the array at the specified pos from the XY values of the specified Vec2
func (ArrayF32) SetVec3 ¶
SetVec3 sets the values of the array at the specified pos from the XYZ values of the specified Vec3
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 ¶
Box2 represents a 2D bounding box defined by two points: the point with minimum coordinates and the point with maximum coordinates.
func B2FromRect ¶
B2FromRect returns a new Box2 from the given image.Rectangle.
func (Box2) Canon ¶
Canon returns the canonical version of the box. The returned rectangle has minimum and maximum coordinates swapped if necessary so that it is well-formed.
func (Box2) ClampPoint ¶
ClampPoint calculates a new point which is the specified point clamped inside this box.
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) DistToPoint ¶
DistToPoint returns the distance from this box to the specified point.
func (*Box2) ExpandByBox ¶
ExpandByBox may expand this bounding box to include the specified box
func (*Box2) ExpandByPoint ¶
ExpandByPoint may expand this bounding box to include the specified point.
func (*Box2) ExpandByScalar ¶
ExpandByScalar expands this bounding box by the specified scalar.
func (*Box2) ExpandByVector ¶
ExpandByVector expands this bounding box by the specified vector.
func (Box2) IntersectsBox ¶
IntersectsBox returns if other box intersects this one.
func (Box2) MulMat2 ¶
MulMat2 multiplies the specified matrix to the vertices of this bounding box and computes the resulting spanning Box2 of the transformed points
func (*Box2) Set ¶
Set sets this bounding box minimum and maximum coordinates. If either min or max are nil, then corresponding values are set to +/- Infinity.
func (*Box2) SetEmpty ¶
func (b *Box2) SetEmpty()
SetEmpty set this bounding box to empty (min / max +/- Infinity)
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.
func (*Box2) SetFromPoints ¶
SetFromPoints set this bounding box from the specified array of points.
func (*Box2) SetFromRect ¶
SetFromRect set this bounding box from an image.Rectangle
func (Box2) Size ¶
Size calculates the size of this bounding box: the vector from its minimum point to its maximum point.
func (Box2) ToRect ¶
ToRect returns image.Rectangle version of this bbox, using floor for min and Ceil for max.
type Box3 ¶
Box3 represents a 3D bounding box defined by two points: the point with minimum coordinates and the point with maximum coordinates.
func B3Empty ¶
func B3Empty() Box3
B3Empty returns a new Box3 with empty minimum and maximum values.
func (Box3) ClampPoint ¶
ClampPoint returns a new point which is the specified point clamped inside this box.
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) DistToPoint ¶
DistToPoint returns the distance from this box to the specified point.
func (*Box3) ExpandByBox ¶
ExpandByBox may expand this bounding box to include the specified box
func (*Box3) ExpandByPoint ¶
ExpandByPoint may expand this bounding box to include the specified point.
func (*Box3) ExpandByPoints ¶
ExpandByPoints may expand this bounding box from the specified array of points.
func (*Box3) ExpandByScalar ¶
ExpandByScalar expands this bounding box by the specified scalar subtracting from min and adding to max.
func (*Box3) ExpandByVector ¶
ExpandByVector expands this bounding box by the specified vector subtracting from min and adding to max.
func (Box3) GetBoundingSphere ¶
GetBoundingSphere returns a bounding sphere to this bounding box.
func (Box3) IntersectsBox ¶
IntersectsBox returns if other box intersects this one.
func (Box3) MVProjToNDC ¶
MVProjToNDC projects bounding box through given MVP model-view-projection Mat4 with perspective divide to return normalized display coordinates (NDC).
func (Box3) MulMat4 ¶
MulMat4 multiplies the specified matrix to the vertices of this bounding box and computes the resulting spanning Box3 of the transformed points
func (Box3) MulQuat ¶
MulQuat multiplies the specified quaternion to the vertices of this bounding box and computes the resulting spanning Box3 of the transformed points
func (*Box3) Set ¶
Set sets this bounding box minimum and maximum coordinates. If either min or max are nil, then corresponding values are set to +/- Infinity.
func (*Box3) SetEmpty ¶
func (b *Box3) SetEmpty()
SetEmpty set this bounding box to empty (min / max +/- Infinity)
func (*Box3) SetFromCenterAndSize ¶
SetFromCenterAndSize sets this bounding box from a center point and size. Size is a vector from the minimum point to the maximum point.
func (*Box3) SetFromPoints ¶
SetFromPoints sets this bounding box from the specified array of points.
func (Box3) Size ¶
Size calculates the size of this bounding box: the vector from its minimum point to its maximum point.
type Dims ¶
type Dims int32 //enums:enum
Dims is a list of vector dimension (component) names
const DimsN Dims = 4
DimsN is the highest valid value for type Dims, plus one.
func DimsValues ¶
func DimsValues() []Dims
DimsValues returns all possible values for the type Dims.
func (Dims) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Dims) SetString ¶
SetString sets the Dims value from its string representation, and returns an error if the string is invalid.
func (*Dims) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Frustum ¶
type Frustum struct {
Planes [6]Plane
}
Frustum represents a frustum
func NewFrustum ¶
NewFrustum returns a pointer to a new Frustum object made of 6 explicit planes
func NewFrustumFromMatrix ¶
NewFrustumFromMatrix creates and returns a Frustum based on the provided matrix
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 Mat4
type Geom2DInt ¶
Geom2DInt defines a geometry in 2D dots units (int) -- this is just a more convenient format than image.Rectangle for cases where the size and position are independently updated (e.g., Viewport)
func (*Geom2DInt) FitInWindow ¶
FitInWindow returns a position and size for a region (sub-window) within a larger window geom that fits entirely within that window to the extent possible, for the initial "ideal" starting position and size. The position is first adjusted to try to fit the size, and then the size is adjusted to make it fit if it is still too big.
type Line3 ¶
Line3 represents a 3D line segment defined by a start and an end point.
func (*Line3) DistSq ¶
DistSq returns the square of the distance from the start point to the end point.
type Mat2 ¶
type Mat2 struct {
XX, YX, XY, YY, X0, Y0 float32
}
func Translate2D ¶
func (Mat2) ExtractRot ¶
ExtractRot extracts the rotation component from a given matrix
func (Mat2) ExtractScale ¶
ExtractXYScale extracts the X and Y scale factors after undoing any rotation present -- i.e., in the original X, Y coordinates
func (Mat2) IsIdentity ¶
func (Mat2) MulCtr ¶
MulCtr multiplies the Mat2, first subtracting given translation center point from the translation components, and then adding it back in.
func (Mat2) MulFixedAsPt ¶
MulFixedAsPt multiplies the fixed point as a point, including adding translations.
func (Mat2) MulVec2AsPt ¶
MulVec2AsPt multiplies the Vec2 as a point, including adding translations.
func (Mat2) MulVec2AsPtCtr ¶
MulVec2AsPtCtr multiplies the Vec2 as a point relative to given center-point including adding translations.
func (Mat2) MulVec2AsVec ¶
MulVec2AsVec multiplies the Vec2 as a vector without adding translations. This is for directional vectors and not points.
func (*Mat2) SetMulCtr ¶
SetMulCtr sets the matrix to the result of Mat2.MulCtr.
type Mat3 ¶
type Mat3 [9]float32
Mat3 is 3x3 matrix organized internally as column matrix
func (*Mat3) CopyFrom ¶
CopyFrom copies from source matrix into this matrix (a regular = assign does not copy data, just the pointer!)
func (*Mat3) Determinant ¶
Determinant calculates and returns the determinant of this matrix.
func (*Mat3) Inverse ¶
Inverse returns the inverse of this matrix. If the matrix cannot be inverted returns error and sets this matrix to the identity matrix.
func (*Mat3) MulMatrices ¶
MulMatrices sets ths matrix as matrix multiplication a by b (i.e., b*a).
func (*Mat3) MulScalar ¶
MulScalar returns each of this matrix's components multiplied by the specified scalar.
func (*Mat3) MulVec3Array ¶
MulVec3Array multiplies count vectors (i.e., 3 sequential array values per each increment in count) in the array starting at start index by this matrix.
func (*Mat3) ScaleCols ¶
ScaleCols returns matrix with columns multiplied 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.
func (*Mat3) Set ¶
Set sets all the elements of the matrix row by row starting at row1, column1, row1, column2, row1, column3 and so forth.
func (*Mat3) SetFromMat4 ¶
SetFromMat4 sets the matrix elements based on a Mat4.
func (*Mat3) SetIdentity ¶
func (m *Mat3) SetIdentity()
SetIdentity sets this matrix as the identity matrix.
func (*Mat3) SetInverse ¶
SetInverse 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 (*Mat3) SetMulScalar ¶
SetMulScalar multiplies each of this matrix's components by the specified scalar.
func (*Mat3) SetNormalMatrix ¶
SetNormalMatrix set this matrix to the matrix that can transform the normal vectors from the src matrix which is used transform the vertices (e.g., a ModelView matrix). If the src matrix cannot be inverted returns error.
func (*Mat3) SetRotationFromQuat ¶
SetRotationFromQuat sets this matrix as a rotation matrix from the specified quaternion.
func (*Mat3) SetScaleCols ¶
SetScaleCols 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.
type Mat4 ¶
type Mat4 [16]float32
Mat4 is 4x4 matrix organized internally as column matrix.
func NewLookAt ¶
NewLookAt returns Mat4 matrix as view transform matrix with origin at eye, looking at target and using the up vector.
func (*Mat4) CopyFrom ¶
CopyFrom copies from source matrix into this matrix (a regular = assign does not copy data, just the pointer!)
func (*Mat4) Decompose ¶
Decompose updates the position vector, quaternion and scale from this transformation matrix.
func (*Mat4) Determinant ¶
Determinant calculates and returns the determinat of this matrix.
func (*Mat4) ExtractBasis ¶
ExtractBasis returns the x,y,z basis vectors of this matrix.
func (*Mat4) ExtractRotation ¶
ExtractRotation sets this matrix as rotation matrix from the src transformation matrix.
func (*Mat4) GetMaxScaleOnAxis ¶
GetMaxScaleOnAxis returns the maximum scale value of the 3 axes.
func (*Mat4) Inverse ¶
Inverse returns the inverse of this matrix. If the matrix cannot be inverted returns error and sets this matrix to the identity matrix.
func (*Mat4) LookAt ¶
LookAt sets this matrix as view transform matrix with origin at eye, looking at target and using the up vector.
func (*Mat4) MulMatrices ¶
MulMatrices sets this matrix as matrix multiplication a by b (i.e. b*a).
func (*Mat4) MulScalar ¶
SetMulScalar multiplies each element of this matrix by the specified scalar.
func (*Mat4) MulVec3Array ¶
MulVec3Array multiplies count vectors (i.e., 3 sequential array values per each increment in count) in the array starting at start index by this matrix.
func (*Mat4) ScaleCols ¶
ScaleCols returns matrix with first column of this matrix multiplied 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 (*Mat4) Set ¶
func (m *Mat4) Set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 float32)
Set sets all the elements of this matrix row by row starting at row1, column1, row1, column2, row1, column3 and so forth.
func (*Mat4) SetFromMat3 ¶
SetFromMat3 sets the matrix elements based on a Mat3, filling in 0's for missing off-diagonal elements, and 1 on the diagonal.
func (*Mat4) SetFrustum ¶
SetFrustum sets this matrix to a projection frustum matrix bounded by the specified planes.
func (*Mat4) SetIdentity ¶
func (m *Mat4) SetIdentity()
SetIdentity sets this matrix as the identity matrix.
func (*Mat4) SetInverse ¶
SetInverse 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 (*Mat4) SetOrthographic ¶
SetOrthographic sets this matrix to an orthographic projection matrix.
func (*Mat4) SetPerspective ¶
SetPerspective sets this matrix to a perspective projection matrix with the specified field of view in degrees, aspect ratio (width/height) and near and far planes.
func (*Mat4) SetPos ¶
SetPos sets this transformation matrix position fields from the specified vector v.
func (*Mat4) SetRotationAxis ¶
SetRotationAxis sets this matrix to a rotation matrix of the specified angle around the specified axis.
func (*Mat4) SetRotationFromEuler ¶
SetRotationFromEuler set this a matrix as a rotation matrix from the specified euler angles.
func (*Mat4) SetRotationFromQuat ¶
SetRotationFromQuat sets this matrix as a rotation matrix from the specified quaternion.
func (*Mat4) SetRotationX ¶
SetRotationX sets this matrix to a rotation matrix of angle theta around the X axis.
func (*Mat4) SetRotationY ¶
SetRotationY sets this matrix to a rotation matrix of angle theta around the Y axis.
func (*Mat4) SetRotationZ ¶
SetRotationZ sets this matrix to a rotation matrix of angle theta around the Z axis.
func (*Mat4) SetScale ¶
SetScale sets this matrix to a scale transformation matrix using the specified x, y and z values.
func (*Mat4) SetScaleCols ¶
SetScaleCols multiplies 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 (*Mat4) SetTransform ¶
SetTransform sets this matrix to a transformation matrix for the specified position, rotation specified by the quaternion and scale.
func (*Mat4) SetTranslation ¶
SetTranslation sets this matrix to a translation matrix from the specified x, y and z values.
func (*Mat4) SetVkFrustum ¶
SetVkFrustum sets this matrix to a projection frustum matrix bounded by the specified planes. This version is for use with Vulkan, and does the equivalent of GLM_DEPTH_ZERO_ONE in glm and also multiplies the Y axis by -1, preserving the original OpenGL Y-up system. OpenGL provides a "natural" coordinate system for the physical world so it is useful to retain that for the world system and just convert on the way out to the render using this projection matrix.
func (*Mat4) SetVkPerspective ¶
SetVkPerspective sets this matrix to a vulkan appropriate perspective projection matrix, assuming the use of the OpenGL Y-up coordinate system for the geometry points. OpenGL provides a "natural" coordinate system for the physical world so it is useful to retain that for the world system and just convert on the way out to the render using this projection matrix. The specified field of view is in degrees, aspect ratio (width/height) and near and far planes.
type Plane ¶
Plane represents a plane in 3D space by its normal vector and a constant offset. When the the normal vector is the unit vector the offset is the distance from the origin.
func (*Plane) CoplanarPoint ¶
CoplanarPoint returns a point in the plane that is the closest point from the origin.
func (*Plane) DistToPoint ¶
DistToPoint returns the distance of this plane from point.
func (*Plane) DistToSphere ¶
DistToSphere returns the distance of this place from the sphere.
func (*Plane) IntersectLine ¶
IntersectLine calculates the point in the plane which intersets the specified line. Returns false if the line does not intersects the plane.
func (*Plane) IsIntersectionLine ¶
IsIntersectionLine returns the line intersects this plane.
func (*Plane) Normalize ¶
func (p *Plane) Normalize()
Normalize normalizes this plane normal vector and adjusts the offset. Note: will lead to a divide by zero if the plane is invalid.
func (*Plane) SetFromCoplanarPoints ¶
SetFromCoplanarPoints sets this plane from three coplanar points.
func (*Plane) SetFromNormalAndCoplanarPoint ¶
SetFromNormalAndCoplanarPoint sets this plane from a normal vector and a point on the plane.
func (*Plane) SetTranslate ¶
SetTranslate translates this plane in the direction of its normal by offset.
type Quat ¶
Quat is quaternion with X,Y,Z and W components.
func NewQuatAxisAngle ¶
NewQuatAxisAngle returns a new quaternion from given axis and angle rotation (radians).
func NewQuatEuler ¶
NewQuatEuler returns a new quaternion from given Euler angles.
func (*Quat) GenGoSet ¶
GenGoSet returns code to set values in object at given path (var.member etc)
func (*Quat) IsIdentity ¶
IsIdentity returns if this is an identity quaternion.
func (*Quat) NormalizeFast ¶
func (q *Quat) NormalizeFast()
NormalizeFast approximates normalizing this quaternion. Works best when the quaternion is already almost-normalized.
func (*Quat) SetConjugate ¶
func (q *Quat) SetConjugate()
SetConjugate sets this quaternion to its conjugate.
func (*Quat) SetFromAxisAngle ¶
SetFromAxisAngle sets this quaternion with the rotation specified by the given axis and angle.
func (*Quat) SetFromEuler ¶
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 (*Quat) SetFromRotationMatrix ¶
SetFromRotationMatrix sets this quaternion from the specified rotation matrix.
func (*Quat) SetFromUnitVectors ¶
SetFromUnitVectors sets this quaternion to the rotation from vector vFrom to vTo. The vectors must be normalized.
func (*Quat) SetIdentity ¶
func (q *Quat) SetIdentity()
SetIdentity sets this quanternion to the identity quaternion.
func (*Quat) SetInverse ¶
func (q *Quat) SetInverse()
SetInverse sets this quaternion to its inverse.
func (*Quat) Slerp ¶
Slerp sets this quaternion to another quaternion which is the spherically linear interpolation from this quaternion to other using t.
func (*Quat) ToAxisAngle ¶
ToAxisAngle returns the Vec4 holding axis and angle of this Quaternion
type Ray ¶
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) ApplyMat4 ¶
MulMat4 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.
func (*Ray) ClosestPointToPoint ¶
ClosestPointToPoint calculates the point in the ray which is closest to the specified point.
func (*Ray) DistSqToPoint ¶
DistSqToPoint 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) DistSqToSegment ¶
DistSqToSegment returns the smallest squared distance from this ray to the line segment from v0 to v1. If optPointOnRay Vec3 is not nil, it is set with the coordinates of the point on the ray. if optPointOnSegment Vec3 is not nil, it is set with the coordinates of the point on the segment.
func (*Ray) DistToPlane ¶
DistToPlane 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) DistToPoint ¶
DistToPoint 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. If no intersection is found false is returned.
func (*Ray) IntersectPlane ¶
IntersectPlane calculates the point which is the intersection of this ray with the specified plane. If no intersection is found false is returned.
func (*Ray) IntersectSphere ¶
IntersectSphere calculates the point which is the intersection of this ray with the specified sphere. If no intersection is found false is returne.
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 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) IntersectsBox ¶
IntersectsBox returns if this ray intersects the specified box.
func (*Ray) IsIntersectPlane ¶
IsIntersectPlane returns if this ray intersects the specified plane.
func (*Ray) IsIntersectionSphere ¶
IsIntersectionSphere returns if this ray intersects with the specified sphere.
type 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) 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.
func (*Sphere) ContainsPoint ¶
ContainsPoint returns if this sphere contains the specified point.
func (*Sphere) DistToPoint ¶
DistToPoint returns the distance from the sphere surface to the specified point.
func (*Sphere) GetBoundingBox ¶
GetBoundingBox calculates a Box3 which bounds this sphere.
func (*Sphere) IntersectSphere ¶
IntersectSphere returns if other sphere intersects this one.
func (*Sphere) SetFromBox ¶
SetFromBox sets the center and radius of this sphere to surround given box
func (*Sphere) SetFromPoints ¶
SetFromPoints sets this sphere from the specified points array and optional center.
type Spline ¶
type Spline struct {
// contains filtered or unexported fields
}
func (*Spline) InitFromArray ¶
type Triangle ¶
Triangle represents a triangle made of three vertices.
func NewTriangle ¶
NewTriangle returns 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.
func (*Triangle) SetFromPointsAndIndices ¶
SetFromPointsAndIndices sets the triangle's vertices based on the specified points and indices.
type Vec2 ¶
Vec2 is a 2D vector/point with X and Y components.
func V2FromFixed ¶
V2FromFixed returns a new Vec2 from the given fixed.Point26_6.
func V2FromPoint ¶
V2FromPoint returns a new Vec2 from the given image.Point.
func (Vec2) AddScalar ¶
AddScalar adds scalar s to each component of this vector and returns new vector.
func (Vec2) AlmostEqual ¶
AlmostEqual returns whether the vector is almost equal to another vector within the specified tolerance.
func (Vec2) AngleTo ¶
AngleTo returns the angle between this vector and other. Returns angles in range of -PI to PI (not 0 to 2 PI).
func (Vec2) Ceil ¶
Ceil returns vector with mat32.Ceil() applied to each of this vector's components.
func (*Vec2) 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.
func (*Vec2) ClampScalar ¶
ClampScalar sets this vector components to be no less than minVal and not greater than maxVal.
func (Vec2) CosTo ¶
CosTo returns the cosine (normalized dot product) between this vector and other.
func (Vec2) Cross ¶
Cross returns the cross product of this vector with other which is a scalar, equivalent to the Z coord in 3D: X1 * Y2 - X2 Y1
func (Vec2) DistToSquared ¶
DistToSquared returns the distance squared of this point to other.
func (Vec2) Div ¶
Div divides each component of this vector by the corresponding one from other vector and returns resulting vector.
func (Vec2) DivScalar ¶
DivScalar divides each component of this vector by the scalar s and returns resulting vector. If scalar is zero, returns zero.
func (Vec2) Floor ¶
Floor returns vector with mat32.Floor() applied to each of this vector's components.
func (*Vec2) FromArray ¶
FromArray sets this vector's components from the specified array and offset.
func (Vec2) InTriangle ¶
InTriangle returns whether the vector is inside the specified triangle.
func (Vec2) 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 (Vec2) Lerp ¶
Lerp returns vector with each components as the linear interpolated value of alpha between itself and the corresponding other component.
func (Vec2) Mul ¶
Mul multiplies each component of this vector by the corresponding one from other and returns resulting vector.
func (Vec2) MulScalar ¶
MulScalar multiplies each component of this vector by the scalar s and returns resulting vector.
func (*Vec2) Normalize ¶
func (v *Vec2) Normalize()
Normalize normalizes this vector so its length will be 1.
func (Vec2) Round ¶
Round returns vector with mat32.Round() applied to each of this vector's components.
func (*Vec2) SetAddScalar ¶
SetAddScalar sets this to addition with scalar.
func (*Vec2) SetByName ¶
SetByName sets this vector component value by its case insensitive name: "x" or "y".
func (*Vec2) SetCeil ¶
func (v *Vec2) SetCeil()
SetCeil applies mat32.Ceil() to each of this vector's components.
func (*Vec2) SetDivScalar ¶
SetDivScalar sets this to division by scalar.
func (*Vec2) SetFloor ¶
func (v *Vec2) SetFloor()
SetFloor applies mat32.Floor() to each of this vector's components.
func (*Vec2) SetFromVec2i ¶
SetFromVec2i sets from a Vec2i (int32) vector.
func (*Vec2) SetLerp ¶
Lerp sets each of this vector's components to the linear interpolated value of alpha between ifself and the corresponding other component.
func (*Vec2) SetMax ¶
SetMax sets this vector components to the maximum value of itself and other vector.
func (*Vec2) SetMaxScalar ¶
SetMaxScalar sets to max of current value and scalar val
func (*Vec2) SetMin ¶
SetMin sets this vector components to the minimum values of itself and other vector.
func (*Vec2) SetMinPosDim ¶
set the value along a given dimension to min of current val and new val
func (*Vec2) SetMinPosScalar ¶
SetMinPosScalar sets to minpos of current value and scalar val
func (*Vec2) SetMinScalar ¶
SetMinScalar sets to min of current value and scalar val
func (*Vec2) SetMul ¶
SetMul sets this to multiplication with other vector (i.e., *= or times-equals).
func (*Vec2) SetMulScalar ¶
SetMulScalar sets this to multiplication by scalar.
func (*Vec2) SetNegate ¶
func (v *Vec2) SetNegate()
SetNegate negates each of this vector's components.
func (*Vec2) SetNormal ¶
func (v *Vec2) SetNormal()
SetNormal normalizes this vector so its length will be 1.
func (*Vec2) SetSubScalar ¶
SetSubScalar sets this to subtraction of scalar.
func (*Vec2) SetZero ¶
func (v *Vec2) SetZero()
SetZero sets this vector X and Y components to be zero.
func (Vec2) SubScalar ¶
SubScalar subtracts scalar s from each component of this vector and returns new vector.
func (Vec2) ToPointCeil ¶
func (Vec2) ToPointFloor ¶
func (Vec2) ToPointRound ¶
func (Vec2) WindowToNDC ¶
WindowToNDC converts window (pixel) coordinates to normalized display coordinates (NDC), using given window size parameters. The Z depth coordinate (0-1) must be set manually or by reading from framebuffer flipY if true means flip the Y axis (top = 0 for windows vs. bottom = 0 for 3D coords)
type Vec2i ¶
Vec2i is a 2D vector/point with X and Y integer32 components.
func (Vec2i) AddScalar ¶
AddScalar adds scalar s to each component of this vector and returns new vector.
func (*Vec2i) 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.
func (*Vec2i) ClampScalar ¶
ClampScalar sets this vector components to be no less than minVal and not greater than maxVal.
func (Vec2i) Div ¶
Div divides each component of this vector by the corresponding one from other vector and returns resulting vector.
func (Vec2i) DivScalar ¶
DivScalar divides each component of this vector by the scalar s and returns resulting vector. If scalar is zero, returns zero.
func (*Vec2i) FromArray ¶
FromArray sets this vector's components from the specified array and offset.
func (Vec2i) Mul ¶
Mul multiplies each component of this vector by the corresponding one from other and returns resulting vector.
func (Vec2i) MulScalar ¶
MulScalar multiplies each component of this vector by the scalar s and returns resulting vector.
func (*Vec2i) SetAddScalar ¶
SetAddScalar sets this to addition with scalar.
func (*Vec2i) SetByName ¶
SetByName sets this vector component value by its case insensitive name: "x" or "y".
func (*Vec2i) SetDivScalar ¶
SetDivScalar sets this to division by scalar.
func (*Vec2i) SetFromVec2 ¶
SetFromVec2 sets from a Vec2 (float32) vector.
func (*Vec2i) SetMax ¶
SetMax sets this vector components to the maximum value of itself and other vector.
func (*Vec2i) SetMin ¶
SetMin sets this vector components to the minimum values of itself and other vector.
func (*Vec2i) SetMul ¶
SetMul sets this to multiplication with other vector (i.e., *= or times-equals).
func (*Vec2i) SetMulScalar ¶
SetMulScalar sets this to multiplication by scalar.
func (*Vec2i) SetNegate ¶
func (v *Vec2i) SetNegate()
SetNegate negates each of this vector's components.
func (*Vec2i) SetSub ¶
SetSub sets this to subtraction with other vector (i.e., -= or minus-equals).
func (*Vec2i) SetSubScalar ¶
SetSubScalar sets this to subtraction of scalar.
func (*Vec2i) SetZero ¶
func (v *Vec2i) SetZero()
SetZero sets this vector X and Y components to be zero.
type Vec3 ¶
Vec3 is a 3D vector/point with X, Y and Z components.
func BarycoordFromPoint ¶
BarycoordFromPoint returns the barycentric coordinates for the specified point.
func NewEulerAnglesFromMatrix ¶
NewEulerAnglesFromMatrix returns a Vec3 with components as the Euler angles from the specified pure rotation matrix.
func NewVec3Color ¶
NewVec3Color returns a Vec3 from Go standard color.Color (R,G,B components only)
func (Vec3) AddScalar ¶
AddScalar adds scalar s to each component of this vector and returns new vector.
func (*Vec3) AlmostEqual ¶
AlmostEqual returns whether the vector is almost equal to another vector within the specified tolerance.
func (Vec3) AngleTo ¶
AngleTo returns the angle between this vector and other. Returns angles in range of -PI to PI (not 0 to 2 PI).
func (Vec3) Ceil ¶
Ceil returns vector with mat32.Ceil() applied to each of this vector's components.
func (*Vec3) 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.
func (*Vec3) ClampScalar ¶
ClampScalar sets this vector components to be no less than minVal and not greater than maxVal.
func (Vec3) CosTo ¶
CosTo returns the cosine (normalized dot product) between this vector and other.
func (Vec3) DistToSquared ¶
DistToSquared returns the distance squared of this point to other.
func (Vec3) Div ¶
Div divides each component of this vector by the corresponding one from other vector and returns resulting vector.
func (Vec3) DivScalar ¶
DivScalar divides each component of this vector by the scalar s and returns resulting vector. If scalar is zero, returns zero.
func (Vec3) Floor ¶
Floor returns vector with mat32.Floor() applied to each of this vector's components.
func (*Vec3) FromArray ¶
FromArray sets this vector's components from the specified array and offset.
func (*Vec3) GenGoSet ¶
GenGoSet returns code to set values in object at given path (var.member etc)
func (Vec3) 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 (Vec3) Lerp ¶
Lerp returns vector with each components as the linear interpolated value of alpha between itself and the corresponding other component.
func (Vec3) MVProjToNDC ¶
MVProjToNDC project given vector through given MVP model-view-projection Mat4 and do perspective divide to return normalized display coordinates (NDC). w is value for 4th coordinate -- use 1 for positions, 0 for normals.
func (Vec3) Mul ¶
Mul multiplies each component of this vector by the corresponding one from other and returns resulting vector.
func (Vec3) MulMat4AsVec4 ¶
MulMat4AsVec4 returns 3-dim vector multiplied by specified 4x4 matrix using a 4-dim vector with given 4th dimensional value, then reduced back to a 3-dimensional vector. This is somehow different from just straight MulMat4 on the 3-dim vector. Use 0 for normals and 1 for positions as the 4th dim to set.
func (Vec3) MulProjection ¶
MulProjection returns vector multiplied by the projection matrix m
func (Vec3) MulQuat ¶
MulQuat returns vector multiplied by specified quaternion and then by the quaternion inverse. It basically applies the rotation encoded in the quaternion to this vector.
func (Vec3) MulScalar ¶
MulScalar multiplies each component of this vector by the scalar s and returns resulting vector.
func (Vec3) NDCToWindow ¶
NDCToWindow converts normalized display coordinates (NDC) to window (pixel) coordinates, using given window size parameters. near, far are 0, 1 by default (glDepthRange defaults). flipY if true means flip the Y axis (top = 0 for windows vs. bottom = 0 for 3D coords)
func (*Vec3) Normalize ¶
func (v *Vec3) Normalize()
Normalize normalizes this vector so its length will be 1.
func (*Vec3) ProjectOnPlane ¶
ProjectOnPlane returns vector projected on the plane specified by normal vector.
func (*Vec3) ProjectOnVector ¶
ProjectOnVector returns vector projected on other vector.
func (*Vec3) RandomTangents ¶
RandomTangents computes and returns two arbitrary tangents to the vector.
func (*Vec3) Reflect ¶
Reflect returns vector reflected relative to the normal vector (assumed to be already normalized).
func (Vec3) RotateAxisAngle ¶
RotateAxisAngle returns vector rotated around axis by angle.
func (Vec3) Round ¶
Round returns vector with mat32.Round() applied to each of this vector's components.
func (Vec3) SRGBFromLinear ¶
SRGBFromLinear returns an SRGB color space value from a linear source
func (Vec3) SRGBToLinear ¶
SRGBToLinear returns a linear color space value from a SRGB source
func (*Vec3) SetAddScalar ¶
SetAddScalar sets this to addition with scalar.
func (*Vec3) SetByName ¶
SetByName sets this vector component value by its case insensitive name: "x", "y", or "z".
func (*Vec3) SetCeil ¶
func (v *Vec3) SetCeil()
SetCeil applies mat32.Ceil() to each of this vector's components.
func (*Vec3) SetDivScalar ¶
SetDivScalar sets this to division by scalar.
func (*Vec3) SetEulerAnglesFromMatrix ¶
SetEulerAnglesFromMatrix sets this vector components to the Euler angles from the specified pure rotation matrix.
func (*Vec3) SetEulerAnglesFromQuat ¶
SetEulerAnglesFromQuat sets this vector components to the Euler angles from the specified quaternion.
func (*Vec3) SetFloor ¶
func (v *Vec3) SetFloor()
SetFloor applies mat32.Floor() to each of this vector's components.
func (*Vec3) SetFromMatrixCol ¶
SetFromMatrixCol set this vector with the column at index of the m matrix.
func (*Vec3) SetFromMatrixPos ¶
SetFromMatrixPos set this vector from the translation coordinates in the specified transformation matrix.
func (*Vec3) SetFromVec3i ¶
SetFromVec3i sets from a Vec3i (int32) vector.
func (*Vec3) SetFromVec4 ¶
SetFromVec4 sets this vector from a Vec4
func (*Vec3) SetLength ¶
SetLength sets this vector to have the specified length. If the current length is zero, does nothing.
func (*Vec3) SetLerp ¶
SetLerp sets each of this vector's components to the linear interpolated value of alpha between itself and the corresponding other component.
func (*Vec3) SetMax ¶
SetMax sets this vector components to the maximum value of itself and other vector.
func (*Vec3) SetMin ¶
SetMin sets this vector components to the minimum values of itself and other vector.
func (*Vec3) SetMul ¶
SetMul sets this to multiplication with other vector (i.e., *= or times-equals).
func (*Vec3) SetMulMat3 ¶
SetMulMat3 sets vector multiplied by specified 3x3 matrix.
func (*Vec3) SetMulMat4 ¶
SetMulMat4 sets vector multiplied by specified 4x4 matrix.
func (*Vec3) SetMulQuat ¶
SetMulQuat multiplies vector by specified quaternion and then by the quaternion inverse. It basically applies the rotation encoded in the quaternion to this vector.
func (*Vec3) SetMulScalar ¶
SetMulScalar sets this to multiplication by scalar.
func (*Vec3) SetNegate ¶
func (v *Vec3) SetNegate()
SetNegate negates each of this vector's components.
func (*Vec3) SetNormal ¶
func (v *Vec3) SetNormal()
SetNormal normalizes this vector so its length will be 1.
func (*Vec3) SetRotateAxisAngle ¶
SetRotateAxisAngle sets vector rotated around axis by angle.
func (*Vec3) SetSubScalar ¶
SetSubScalar sets this to subtraction of scalar.
func (*Vec3) SetZero ¶
func (v *Vec3) SetZero()
SetZero sets this vector X, Y and Z components to be zero.
type Vec3i ¶
Vec3i is a 3D vector/point with X, Y and Z int32 components.
func (Vec3i) AddScalar ¶
AddScalar adds scalar s to each component of this vector and returns new vector.
func (*Vec3i) 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.
func (*Vec3i) ClampScalar ¶
ClampScalar sets this vector components to be no less than minVal and not greater than maxVal.
func (Vec3i) Div ¶
Div divides each component of this vector by the corresponding one from other vector and returns resulting vector.
func (Vec3i) DivScalar ¶
DivScalar divides each component of this vector by the scalar s and returns resulting vector. If scalar is zero, returns zero.
func (*Vec3i) FromArray ¶
FromArray sets this vector's components from the specified array and offset
func (Vec3i) Mul ¶
Mul multiplies each component of this vector by the corresponding one from other and returns resulting vector.
func (Vec3i) MulScalar ¶
MulScalar multiplies each component of this vector by the scalar s and returns resulting vector.
func (*Vec3i) SetAddScalar ¶
SetAddScalar sets this to addition with scalar.
func (*Vec3i) SetByName ¶
SetByName sets this vector component value by its case insensitive name: "x", "y", or "z".
func (*Vec3i) SetDivScalar ¶
SetDivScalar sets this to division by scalar.
func (*Vec3i) SetFromVec3 ¶
SetFromVec3 sets from a Vec3 (float32) vector.
func (*Vec3i) SetMax ¶
SetMax sets this vector components to the maximum value of itself and other vector.
func (*Vec3i) SetMin ¶
SetMin sets this vector components to the minimum values of itself and other vector.
func (*Vec3i) SetMul ¶
SetMul sets this to multiplication with other vector (i.e., *= or times-equals).
func (*Vec3i) SetMulScalar ¶
SetMulScalar sets this to multiplication by scalar.
func (*Vec3i) SetNegate ¶
func (v *Vec3i) SetNegate()
SetNegate negates each of this vector's components.
func (*Vec3i) SetSub ¶
SetSub sets this to subtraction with other vector (i.e., -= or minus-equals).
func (*Vec3i) SetSubScalar ¶
SetSubScalar sets this to subtraction of scalar.
func (*Vec3i) SetZero ¶
func (v *Vec3i) SetZero()
SetZero sets this vector X, Y and Z components to be zero.
type Vec4 ¶
Vec4 is a vector/point in homogeneous coordinates with X, Y, Z and W components.
func NewVec4Color ¶
NewVec4Color returns a Vec4 from Go standard color.Color (full R,G,B,A components)
func (Vec4) AddScalar ¶
AddScalar adds scalar s to each component of this vector and returns new vector.
func (*Vec4) AlmostEqual ¶
AlmostEqual returns whether the vector is almost equal to another vector within the specified tolerance.
func (Vec4) Ceil ¶
Ceil returns vector with mat32.Ceil() applied to each of this vector's components.
func (*Vec4) 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.
func (*Vec4) ClampScalar ¶
ClampScalar sets this vector components to be no less than minVal and not greater than maxVal.
func (Vec4) Div ¶
Div divides each component of this vector by the corresponding one from other vector and returns resulting vector.
func (Vec4) DivScalar ¶
DivScalar divides each component of this vector by the scalar s and returns resulting vector. If scalar is zero, returns zero.
func (Vec4) Floor ¶
Floor returns vector with mat32.Floor() applied to each of this vector's components.
func (*Vec4) FromArray ¶
FromArray sets this vector's components from the specified array and offset
func (Vec4) 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 (Vec4) Lerp ¶
Lerp returns vector with each components as the linear interpolated value of alpha between itself and the corresponding other component.
func (Vec4) Mul ¶
Mul multiplies each component of this vector by the corresponding one from other and returns resulting vector.
func (Vec4) MulScalar ¶
MulScalar multiplies each component of this vector by the scalar s and returns resulting vector.
func (*Vec4) Normalize ¶
func (v *Vec4) Normalize()
Normalize normalizes this vector so its length will be 1.
func (Vec4) PerspDiv ¶
PerspDiv returns the 3-vector of normalized display coordinates (NDC) from given 4-vector By dividing by the 4th W component
func (Vec4) Round ¶
Round returns vector with mat32.Round() applied to each of this vector's components.
func (Vec4) SRGBFromLinear ¶
SRGBFromLinear returns an SRGB color space value from a linear source
func (Vec4) SRGBToLinear ¶
SRGBToLinear returns a linear color space value from a SRGB source
func (*Vec4) SetAddScalar ¶
SetAddScalar sets this to addition with scalar.
func (*Vec4) SetAxisAngleFromQuat ¶
SetAxisAngleFromQuat 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 (*Vec4) 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 (*Vec4) SetByName ¶
SetByName sets this vector component value by its case insensitive name: "x", "y", "z" or "w".
func (*Vec4) SetCeil ¶
func (v *Vec4) SetCeil()
SetCeil applies mat32.Ceil() to each of this vector's components.
func (*Vec4) SetDivScalar ¶
SetDivScalar sets this to division by scalar.
func (*Vec4) SetFloor ¶
func (v *Vec4) SetFloor()
SetFloor applies mat32.Floor() to each of this vector's components.
func (*Vec4) SetFromVec2 ¶
SetFromVec2 sets this vector from a Vec2 with 0,1 for Z,W
func (*Vec4) SetFromVec3 ¶
SetFromVec3 sets this vector from a Vec3 and W
func (*Vec4) SetLength ¶
SetLength sets this vector to have the specified length. If the current length is zero, does nothing.
func (*Vec4) SetLerp ¶
SetLerp sets each of this vector's components to the linear interpolated value of alpha between ifself and the corresponding other component.
func (*Vec4) SetMax ¶
SetMax sets this vector components to the maximum value of itself and other vector.
func (*Vec4) SetMin ¶
SetMin sets this vector components to the minimum values of itself and other vector.
func (*Vec4) SetMul ¶
SetMul sets this to multiplication with other vector (i.e., *= or times-equals).
func (*Vec4) SetMulScalar ¶
SetMulScalar sets this to multiplication by scalar.
func (*Vec4) SetNegate ¶
func (v *Vec4) SetNegate()
SetNegate negates each of this vector's components.
func (*Vec4) SetNormal ¶
func (v *Vec4) SetNormal()
SetNormal normalizes this vector so its length will be 1.
func (*Vec4) SetSubScalar ¶
SetSubScalar sets this to subtraction of scalar.
func (*Vec4) SetZero ¶
func (v *Vec4) SetZero()
SetZero sets this vector X, Y and Z components to be zero and W to be one.