tuple

package
v0.0.0-...-8cfed74 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tuple

type Tuple struct {
	X float64
	Y float64
	Z float64
	W float64
}

Tuple is set of coordinates

func Point

func Point(x, y, z float64) Tuple

Point returns a new point

func Vector

func Vector(x, y, z float64) Tuple

Vector returns a new vector

func (*Tuple) Add

func (t *Tuple) Add(t2 Tuple) Tuple

Add returns t1 + t2

func (*Tuple) CrossProduct

func (t *Tuple) CrossProduct(t2 Tuple) Tuple

CrossProduct returns the vector product of two vectors

func (*Tuple) Divide

func (t *Tuple) Divide(n float64) Tuple

Divide returns the result of dividing a tuple by a number

func (*Tuple) DotProduct

func (t *Tuple) DotProduct(t2 Tuple) float64

DotProduct returns the scalar product of two vectors

func (*Tuple) Equals

func (t *Tuple) Equals(t2 Tuple) bool

Equals reports whether two tuples are the same

func (*Tuple) Magnitude

func (t *Tuple) Magnitude() float64

Magnitude returns the magnitude of a vector

func (*Tuple) Multiply

func (t *Tuple) Multiply(n float64) Tuple

Multiply returns the product of a tuple and a number

func (*Tuple) Negate

func (t *Tuple) Negate() Tuple

Negate returns the negation of a tuple

func (*Tuple) Normalize

func (t *Tuple) Normalize() Tuple

Normalize converts a vector to a unit vector

func (*Tuple) Reflect

func (t *Tuple) Reflect(normal Tuple) Tuple

Reflect returns the vector after it reflects with respect to the given normal

func (*Tuple) Subtract

func (t *Tuple) Subtract(t2 Tuple) Tuple

Subtract returns t1 - t2

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL