aboutsummaryrefslogtreecommitdiff
path: root/ray.go
blob: a3f78f8a16955ed0d868a9ae58e93690183f4666 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11

package main

// Ray contains a ray data
type Ray struct {
	origin, direction Vec3D
}

// PointAt computes ray position at a time
func (ray Ray) PointAt(time float64) Vec3D {
	return AddVec3D(ray.origin, ScalarProduct(time, ray.direction))
}