Documentation ¶
Overview ¶
Package geo provides basic geometric constructs
Index ¶
- Variables
- type Onb
- type Ray
- type Vec3
- func (v Vec3) Add(w Vec3) Vec3
- func (v Vec3) Axis(a int) float64
- func (v Vec3) Cross(w Vec3) Vec3
- func (v Vec3) DivS(t float64) Vec3
- func (v Vec3) Dot(w Vec3) float64
- func (v Vec3) Length() float64
- func (v Vec3) LengthSquared() float64
- func (v Vec3) Mul(w Vec3) Vec3
- func (v Vec3) MulS(t float64) Vec3
- func (v Vec3) NearZero() bool
- func (v Vec3) Neg() Vec3
- func (v Vec3) Reflect(n Vec3) Vec3
- func (v Vec3) Refract(n Vec3, indexOfRefraction float64) Vec3
- func (v Vec3) Sub(w Vec3) Vec3
- func (v Vec3) Unit() Vec3
Constants ¶
This section is empty.
Variables ¶
var ( // ZeroVector is a vector with the length of 0 ZeroVector = Vec3{} )
Functions ¶
This section is empty.
Types ¶
type Onb ¶ added in v0.0.7
Onb is an Orthonormal Basis
func BuildOnbFromVec3 ¶ added in v0.0.7
BuildOnbFromVec3 creates an Orthonormal Basis from the given vector
type Vec3 ¶
Vec3 is a 3 dimensional vector
func RandomCosineDirection ¶ added in v0.0.7
func RandomCosineDirection() Vec3
RandomCosineDirection generates a random vector similar to RandomUnitVector in that the length is always 1. But with a different distribution as it is generated by two random angles.
func RandomInHemisphere ¶
RandomInHemisphere creates a random Vec3 that is shorter than 1. And in the same general direction as given normal.
func RandomInUnitDisc ¶
func RandomInUnitDisc() Vec3
RandomInUnitDisc creates a random Vec3 that is shorter than 1 And that has a Z value of 0
func RandomInUnitSphere ¶
func RandomInUnitSphere() Vec3
RandomInUnitSphere creates a random Vec3 that is shorter than 1
func RandomUnitVector ¶
func RandomUnitVector() Vec3
RandomUnitVector creates a random Vec3 that has the length of 1
func RandomVec3 ¶
RandomVec3 creates a random Vec3 within the given interval
func (Vec3) Add ¶
Add returns a Vec3 that has all values added with corresponding value in given w Vec3
func (Vec3) LengthSquared ¶
LengthSquared return the length squared of the vector
func (Vec3) Mul ¶
Mul returns a Vec3 that has all values multiplied with corresponding value in given w Vec3
func (Vec3) Refract ¶
Refract returns the refraction vector given the normal n and the index of refraction of the material