Documentation ¶
Index ¶
- type Ray
- type Vector
- func (v1 Vector) Add(v2 Vector) Vector
- func (v1 Vector) Cross(v2 Vector) Vector
- func (v1 Vector) Dot(v2 Vector) float64
- func (v Vector) Length() float64
- func (v Vector) Normalize() Vector
- func (v Vector) Reflect(normal Vector) Vector
- func (v Vector) Scale(s float64) Vector
- func (v Vector) String() string
- func (v1 Vector) Sub(v2 Vector) Vector
- func (p1 Vector) VectorTo(p2 Vector) Vector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ray ¶
Ray represents a ray in 3D space. A ray has an origin and direction
func (Ray) OffsetOrigin ¶
OffsetOrigin computes a new Ray similar to r with the only difference being its origin is slightly offset in the direction of r. Argument is optional and the default value offset is 0.0001
func (Ray) PointOnRay ¶
PointOnRay computes the point on Ray r that is a of distance t from its origin
func (Ray) ReflectRay ¶
ReflectRay calculates the reflected ray at a collison point over a normal vector
type Vector ¶
type Vector struct {
X, Y, Z float64
}
Vector represents a vector or point in 3d space
Click to show internal directories.
Click to hide internal directories.