Documentation ¶
Index ¶
- Variables
- func Add3(t1, t2, t3 Tuple4, out *Tuple4)
- func AddPtr(t1, t2 Tuple4, t3 *Tuple4)
- func AddPtr2(t1, t2 *Tuple4, t3 *Tuple4)
- func AddPtr3(t1, t2, t3, out *Tuple4)
- func Cofactor3x3(m1 Mat3x3, row, col int) float64
- func Cofactor4x4(m1 Mat4x4, row, col int) float64
- func Cross2(a *Tuple4, b *Tuple4, c *Tuple4)
- func CrossProduct(f1, f2, out *Tuple4)
- func DP(v1 *Tuple4, v2 *Tuple4) float64
- func Determinant2x2(m1 Mat2x2) float64
- func Determinant3x3(m1 Mat3x3) float64
- func Determinant4x4(m1 Mat4x4) float64
- func Dot(t1 Tuple4, t2 Tuple4) float64
- func DotProduct(v1 *Tuple4, v2 *Tuple4, result *Tuple4)
- func DotPtr(t1 *Tuple4, t2 *Tuple4) float64
- func Eq(a, b float64) bool
- func Equals(m1, m2 Mat4x4) bool
- func Equals2x2(m1, m2 Mat2x2) bool
- func Equals3x3(m1, m2 Mat3x3) bool
- func HadamardPtr(t1 *Tuple4, t2 *Tuple4, out *Tuple4)
- func IsInvertible(m1 Mat4x4) bool
- func Magnitude(t1 Tuple4) float64
- func MagnitudePtr(t1 *Tuple4) float64
- func Minor3x3(m1 Mat3x3, row, col int) float64
- func Minor4x4(m1 Mat4x4, row, col int) float64
- func MultiplyByScalarPtr(t1 Tuple4, scalar float64, out *Tuple4)
- func MultiplyByTuplePtr(m *Mat4x4, f2 *Tuple4, _f4 *Tuple4)
- func MultiplyByTupleUsingPointers(m1 *Mat4x4, t, out *Tuple4)
- func MultiplyByTupleUsingValues(m1 Mat4x4, t Tuple4, out *Tuple4)
- func NegatePtr(t1 Tuple4, out *Tuple4)
- func NormalizePtr(t1 *Tuple4, out *Tuple4)
- func NormalizePtr2(t1 Tuple4, out *Tuple4)
- func SubPtr(t1, t2 Tuple4, out *Tuple4)
- func TransformRayPtr(r Ray, m1 Mat4x4, out *Ray)
- func TupleEquals(t1, t2 Tuple4) bool
- func TupleXYZEq(t1, t2 Tuple4) bool
- type Mat2x2
- type Mat3x3
- type Mat4x4
- func Inverse(m1 Mat4x4) Mat4x4
- func Multiply(m1 Mat4x4, m2 Mat4x4) Mat4x4
- func New4x4() Mat4x4
- func NewIdentityMatrix() Mat4x4
- func NewMat4x4(elems []float64) Mat4x4
- func RotateX(radians float64) Mat4x4
- func RotateY(radians float64) Mat4x4
- func RotateZ(radians float64) Mat4x4
- func Scale(x, y, z float64) Mat4x4
- func Translate(x, y, z float64) Mat4x4
- func Transpose(m1 Mat4x4) Mat4x4
- type Ray
- type Tuple4
- func Add(t1, t2 Tuple4) Tuple4
- func Cross(t1 Tuple4, t2 Tuple4) Tuple4
- func DivideByScalar(t1 Tuple4, scalar float64) Tuple4
- func Hadamard(t1 Tuple4, t2 Tuple4) Tuple4
- func MultiplyByScalar(t1 Tuple4, scalar float64) Tuple4
- func MultiplyByTuple(m1 Mat4x4, t Tuple4) Tuple4
- func Negate(t1 Tuple4) Tuple4
- func NewColor(r, g, b float64) Tuple4
- func NewPoint(x, y, z float64) Tuple4
- func NewTuple() Tuple4
- func NewTupleOf(x, y, z, w float64) Tuple4
- func NewVector(x, y, z float64) Tuple4
- func Normalize(t1 Tuple4) Tuple4
- func Sub(t1, t2 Tuple4) Tuple4
- func T4F32(x, y, z float32, w float64) Tuple4
- func (t Tuple4) Add(t2 Tuple4) Tuple4
- func (t *Tuple4) AddNoRet(t2 Tuple4)
- func (t *Tuple4) AddNoRetPtr(t2 *Tuple4)
- func (t Tuple4) Get(row int) float64
- func (t Tuple4) IsPoint() bool
- func (t Tuple4) IsVector() bool
- func (t Tuple4) Multiply(scalar float64) Tuple4
- func (t Tuple4) ResetPoint() Tuple4
- func (t Tuple4) ResetVector() Tuple4
Constants ¶
This section is empty.
Variables ¶
var Epsilon = 0.01
var IdentityMatrix = identity.Matrix
var Right = NewVector(1, 0, 0)
var Up = NewVector(0, 1, 0)
Functions ¶
func Cofactor3x3 ¶
Cofactor3x3 may change the sign of the computed minor of the passed matrix
func Cofactor4x4 ¶
Cofactor4x4 may change the sign of the computed minor of the passed matrix
func CrossProduct ¶
func CrossProduct(f1, f2, out *Tuple4)
func Determinant2x2 ¶
Determinant2x2 returns A-D minus B-C for a [A,B] [C,D] Matrix.
func Determinant3x3 ¶
Determinant3x3 takes the first row of the passed matrix, summing the colvalue * Cofactor of the same col
func Dot ¶
Dot product is the sum of the products of the corresponding entries of the two sequences of numbers a product is simply put the result of a multiplication. The dot product of two tuples is simply t1.x * t2.x + t1.y * t2.y + t1.z * t2.z + t1[3] * t2[3]
func DotProduct ¶
func HadamardPtr ¶
func IsInvertible ¶
func Magnitude ¶
Magnitude measures the length of the passed vector. It's basically pythagoras sqrt(x2 + y2 + z2 + w2)
func MagnitudePtr ¶
func Minor3x3 ¶
Minor3x3 computes the submatrix at row/col and returns the determinant of the computed matrix.
func Minor4x4 ¶
Minor4x4 computes the submatrix at row/col and returns the determinant of the computed matrix.
func MultiplyByScalarPtr ¶
func MultiplyByTuplePtr ¶
func NormalizePtr ¶
func NormalizePtr2 ¶
func TransformRayPtr ¶
func TupleEquals ¶
func TupleXYZEq ¶
Types ¶
type Mat2x2 ¶
type Mat2x2 [4]float64
func Submatrix3x3 ¶
Submatrix3x3 extracts the 2x2 submatrix after deleting row and col from the passed 3x3
type Mat3x3 ¶
type Mat3x3 [9]float64
func Submatrix4x4 ¶
Submatrix4x4 extracts the 3x3 submatrix after deleting row and col from the passed 4x4
type Mat4x4 ¶
type Mat4x4 [16]float64
func NewIdentityMatrix ¶
func NewIdentityMatrix() Mat4x4
type Ray ¶
func NewEmptyRay ¶
func NewEmptyRay() Ray
type Tuple4 ¶
type Tuple4 [4]float64
func DivideByScalar ¶
func MultiplyByScalar ¶
func MultiplyByTuple ¶
func NewTupleOf ¶
func Normalize ¶
Normalize measures the length (magnitude) of the passed Vector. Each component in t1 is then divided my the magnitude in order to Normalize it to unit (1) size.