Documentation ¶
Overview ¶
math 的增强功能
Index ¶
- func Abs(x int) int
- func AbsInt16(x int16) int16
- func AntiClockwise(v1 Vector2, v2 Vector2) bool
- func Between(x int, start int, end int) bool
- func BetweenInt16(x int16, start int16, end int16) bool
- func DegAngle(v1 Vector2, v2 Vector2) float64
- func GetDistance(a Vector3, b Vector3) float64
- type Axis
- type Vector2
- type Vector3
- func (v Vector3) Abs() Vector3
- func (v Vector3) Add(ov Vector3) Vector3
- func (v Vector3) Angle(ov Vector3) s1.Angle
- func (v Vector3) ApproxEqual(ov Vector3) bool
- func (v *Vector3) Clone() Vector3
- func (v Vector3) Cmp(ov Vector3) int
- func (v Vector3) Cross(ov Vector3) Vector3
- func (v Vector3) Distance(ov Vector3) float64
- func (v Vector3) Dot(ov Vector3) float64
- func (v Vector3) IsUnit() bool
- func (v Vector3) LargestComponent() Axis
- func (v Vector3) Mul(m float64) Vector3
- func (v Vector3) Norm() float64
- func (v Vector3) Norm2() float64
- func (v Vector3) Normalize() Vector3
- func (v Vector3) Ortho() Vector3
- func (v Vector3) SmallestComponent() Axis
- func (v Vector3) String() string
- func (v Vector3) Sub(ov Vector3) Vector3
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BetweenInt16 ¶
判断当前数字是否在范围中,前包后不包 eg between(1,1,3) true eg between(3,1,3) false
Types ¶
type Vector3 ¶
type Vector3 struct {
X, Y, Z float64
}
Vector3 represents a point in ℝ³.
func (Vector3) ApproxEqual ¶
ApproxEqual reports whether v and ov are equal within a small epsilon.
func (Vector3) Cmp ¶
Cmp compares v and ov lexicographically and returns:
-1 if v < ov 0 if v == ov +1 if v > ov
This method is based on C++'s std::lexicographical_compare. Two entities are compared element by element with the given operator. The first mismatch defines which is less (or greater) than the other. If both have equivalent values they are lexicographically equal.
func (Vector3) LargestComponent ¶
LargestComponent returns the axis that represents the largest component in this Vector3.
func (Vector3) Ortho ¶
Ortho returns a unit Vector3 that is orthogonal to v. Ortho(-v) = -Ortho(v) for all v.
func (Vector3) SmallestComponent ¶
SmallestComponent returns the axis that represents the smallest component in this Vector3.