ray

package
v0.0.0-...-1c48c43 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2017 License: MIT Imports: 3 Imported by: 5

Documentation

Overview

Package ray provides an implementation of a ray in 3D space, and intersections with surfaces

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Intersection

type Intersection struct {
	Point     *maths.Vec3
	Incoming  *Ray
	Material  int
	Distance  float64
	U, V      float64
	Normal    *maths.Vec3
	SurfaceOx *maths.Vec3
	SurfaceOy *maths.Vec3
}

Intersection represents a point on a surface struck by a ray

type Ray

type Ray struct {
	Start     maths.Vec3
	Direction maths.Vec3
	Depth     int
	Inverse   [3]float64
}

Ray is defined by its start, direction and depth which indicates how many materials it has passed through

func New

func New(start maths.Vec3, direction maths.Vec3, depth int) *Ray

New returns new ray

func (*Ray) Init

func (r *Ray) Init()

Init fills the Inverse field of ray

func (*Ray) String

func (r *Ray) String() string

String returns the string representation of the ray in the form of "<start> -> <direction>"

Jump to

Keyboard shortcuts

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