Documentation ¶
Overview ¶
Math ¶
Math types and utility functions.
V2 ¶
Basic Vector2 type with Scalar components. Methods never modify their caller.
V3 ¶
Same as V2, with the addition of a Z component.
Index ¶
- func Clamp[T numeric](v, min, max T) T
- func Max[T numeric](v, max T) T
- func Min[T numeric](v, min T) T
- type Scalar
- type V2
- func (a V2) Add(b V2) V2
- func (a V2) AngleTo(b V2) Scalar
- func (a V2) Clamp(min V2, max V2) V2
- func (a V2) DistanceTo(b V2) Scalar
- func (a V2) Div(b V2) (c V2)
- func (a V2) Dot(b V2) Scalar
- func (a V2) Equals(b V2) bool
- func (a V2) Length() Scalar
- func (a V2) Lerp(b V2, t Scalar) (c V2)
- func (a V2) Mul(b V2) V2
- func (a V2) Normalize() (res V2)
- func (a V2) Scale(amt Scalar) V2
- func (a V2) Sub(b V2) V2
- func (a V2) Trunc() V2
- type V3
- func (a V3) Add(b V3) V3
- func (a V3) AngleTo(b V3) Scalar
- func (a V3) Clamp(min V3, max V3) V3
- func (a V3) DistanceTo(b V3) Scalar
- func (a V3) Div(b V3) (c V3)
- func (a V3) Dot(b V3) Scalar
- func (a V3) Equals(b V3) bool
- func (a V3) Length() Scalar
- func (a V3) Lerp(b V3, t Scalar) (c V3)
- func (a V3) Mul(b V3) V3
- func (a V3) Normalize() (res V3)
- func (a V3) Scale(amt Scalar) V3
- func (a V3) Sub(b V3) V3
- func (a V3) Trunc() V3
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Scalar ¶
type Scalar = float64
Underlying type for all math data structures. Allows this package to use float32 or integer types if wanted.
const (
Epsilon Scalar = 0.000001
)
type V2 ¶
func (V2) DistanceTo ¶
Calculate the distance between 'a' and 'b'
type V3 ¶
func (V3) DistanceTo ¶
Click to show internal directories.
Click to hide internal directories.