Documentation ¶
Index ¶
- Variables
- func Clamp(value float64, min float64, max float64) float64
- func DiscardIfTooClose(t float64) float64
- func Distance(pointA *Vector3, pointB *Vector3) float64
- func GetNearestInFront(t1 float64, t2 float64) float64
- type LightRay
- type Matrix
- type Vector3
- func (v *Vector3) Abs() float64
- func (v *Vector3) Add(v2 *Vector3) *Vector3
- func (v *Vector3) AsMap() map[string]float64
- func (v *Vector3) Cross(v2 *Vector3) *Vector3
- func (v *Vector3) Differ(v2 *Vector3) bool
- func (v *Vector3) Divide(k float64) *Vector3
- func (v *Vector3) Dot(v2 *Vector3) float64
- func (v *Vector3) Equal(v2 *Vector3) bool
- func (v *Vector3) GreaterOrEqual(v2 *Vector3) bool
- func (v *Vector3) LesserOrEqual(v2 *Vector3) bool
- func (v *Vector3) Multiply(k float64) *Vector3
- func (v *Vector3) Normalized() *Vector3
- func (v *Vector3) Print()
- func (v *Vector3) Reflect(normal *Vector3) *Vector3
- func (v *Vector3) String() string
- func (v *Vector3) Subtract(v2 *Vector3) *Vector3
Constants ¶
This section is empty.
Variables ¶
var ( // UnitX is the unit vector in the X axis UnitX = Vector3{X: 1.0, Y: 0.0, Z: 0.0} // UnitY is the unit vector in the Y axis UnitY = Vector3{X: 0.0, Y: 1.0, Z: 0.0} // UnitZ is the unit vector in the Z axis UnitZ = Vector3{X: 0.0, Y: 0.0, Z: 1.0} )
Functions ¶
func DiscardIfTooClose ¶
DiscardIfTooClose returns t if t is greater than a threshold. Otherwise, it returns math.MaxFloat64
func GetNearestInFront ¶
GetNearestInFront returns the minimum of t1 and t2 so long as it is greater than a threshold. If neither is, it returns math.MaxFloat64
Types ¶
type Matrix ¶
type Matrix struct {
// contains filtered or unexported fields
}
Matrix represents a 4x4 matrix
func (*Matrix) ComposeMatrix ¶
ComposeMatrix composes the two matrices multiplying them
func (*Matrix) MultiplyPoint ¶
MultiplyPoint returns point multiplied by the matrix
func (*Matrix) MultiplyVector ¶
MultiplyVector returns vector multiplied by the matrix
type Vector3 ¶
Vector3 holds three floats that represent X Y and Z space. It holds both 3D vectors and 3D points.
func VectorFromMap ¶
VectorFromMap returns the vector defined in the map
func (*Vector3) Differ ¶
Differ returns true if the vectors are not the same within a margin of error.
func (*Vector3) Divide ¶
Divide returns a vector result of dividing all the values in the vector by k
func (*Vector3) GreaterOrEqual ¶
GreaterOrEqual returns true if the first vector is greater or equal in the three axes.
func (*Vector3) LesserOrEqual ¶
LesserOrEqual returns true if the first vector is smaller or equal in the three axes.
func (*Vector3) Multiply ¶
Multiply returns a vector result of multiplying all the values in the vector by k
func (*Vector3) Normalized ¶
Normalized returns the normalized 3D vector