Documentation ¶
Overview ¶
Package vec3 provides utility functions to work with vectors.
Index ¶
- func Dot(v1 *Vec3Impl, v2 *Vec3Impl) float64
- func Equals(v0, v1 *Vec3Impl) bool
- type Vec3Impl
- func Add(v1 *Vec3Impl, args ...*Vec3Impl) *Vec3Impl
- func Cross(v1 *Vec3Impl, v2 *Vec3Impl) *Vec3Impl
- func DeNAN(v *Vec3Impl) *Vec3Impl
- func Div(v1 *Vec3Impl, v2 *Vec3Impl) *Vec3Impl
- func Lerp(v0, v1 *Vec3Impl, t float64) *Vec3Impl
- func Max3(v0 *Vec3Impl, v1 *Vec3Impl, v2 *Vec3Impl) *Vec3Impl
- func Min3(v0 *Vec3Impl, v1 *Vec3Impl, v2 *Vec3Impl) *Vec3Impl
- func Mul(v1 *Vec3Impl, v2 *Vec3Impl) *Vec3Impl
- func RandomCosineDirection(random *fastrandom.LCG) *Vec3Impl
- func RandomToSphere(radius float64, distanceSquared float64, random *fastrandom.LCG) *Vec3Impl
- func ScalarDiv(v1 *Vec3Impl, t float64) *Vec3Impl
- func ScalarMul(v1 *Vec3Impl, t float64) *Vec3Impl
- func Sub(v1 *Vec3Impl, args ...*Vec3Impl) *Vec3Impl
- func UnitVector(v *Vec3Impl) *Vec3Impl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Vec3Impl ¶
Vec3Impl defines a vector with its position and colour.
func RandomCosineDirection ¶
func RandomCosineDirection(random *fastrandom.LCG) *Vec3Impl
RandomCosineDirection returns a vector with a random cosine direction.
func RandomToSphere ¶
func RandomToSphere(radius float64, distanceSquared float64, random *fastrandom.LCG) *Vec3Impl
RandomToSphere returns a new random sphere of the given radius at the given distance.
func UnitVector ¶
UnitVector returns a unit vector representation of the supplied vector.
func (*Vec3Impl) MakeUnitVector ¶
func (v *Vec3Impl) MakeUnitVector()
MakeUnitVector transform the vector into its unit representation.
func (*Vec3Impl) SquaredLength ¶
SquaredLength returns the squared length of this vector.
Click to show internal directories.
Click to hide internal directories.