primitives

package
v0.0.0-...-3efc401 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UnitVector = Vector{1, 1, 1}
)

Functions

This section is empty.

Types

type BoundingBox

type BoundingBox struct {
	MinV, MaxV Vector
}

func (*BoundingBox) Hit

func (b *BoundingBox) Hit(r *Ray, tMin, tMax float64) (bool, Hit)

type Camera

type Camera struct {
	// contains filtered or unexported fields
}

func NewCamera

func NewCamera(LookFrom, LookAt Vector, vFov, aspect, aperture float64) Camera

func (*Camera) RayAt

func (c *Camera) RayAt(s, t float64, rnd *rand.Rand) Ray

type Glass

type Glass struct {
	C        Vector
	RefIndex float64
}

func (Glass) Bounce

func (d Glass) Bounce(input Ray, hit Hit) (bool, Ray)

func (Glass) Color

func (m Glass) Color() Vector

type Hit

type Hit struct {
	T         float64
	P, Normal Vector
	Material
}

type Hitable

type Hitable interface {
	Hit(r Ray, tMin float64, tMax float64) (bool, Hit)
}

type Lambertian

type Lambertian struct {
	C Vector
}

func (Lambertian) Bounce

func (l Lambertian) Bounce(input Ray, hit Hit) (bool, Ray)

func (Lambertian) Color

func (l Lambertian) Color() Vector

type Material

type Material interface {
	Bounce(input Ray, hit Hit) (bool, Ray)
	Color() Vector
}

type Metal

type Metal struct {
	C    Vector
	Fuzz float64
}

func (Metal) Bounce

func (m Metal) Bounce(input Ray, hit Hit) (bool, Ray)

func (Metal) Color

func (m Metal) Color() Vector

type Ray

type Ray struct {
	Origin, Direction Vector
}

func (Ray) Point

func (r Ray) Point(t float64) Vector

type Sphere

type Sphere struct {
	Center Vector
	Radius float64
	Material
}

func (*Sphere) Hit

func (s *Sphere) Hit(r Ray, tMin, tMax float64) (bool, Hit)

type Triangle

type Triangle struct {
	V0, V1, V2 Vector
	Material
}

func (*Triangle) Hit

func (tr *Triangle) Hit(r Ray, tMin float64, tMax float64) (bool, Hit)

type Vector

type Vector struct {
	X, Y, Z float64
}

func VectorInUnitSphere

func VectorInUnitSphere() Vector

func (Vector) Add

func (v Vector) Add(o Vector) Vector

func (Vector) AddScalar

func (v Vector) AddScalar(t float64) Vector

func (Vector) Cross

func (v Vector) Cross(o Vector) Vector

func (Vector) DivideScalar

func (v Vector) DivideScalar(t float64) Vector

func (Vector) Dot

func (v Vector) Dot(o Vector) float64

func (Vector) Length

func (v Vector) Length() float64

func (Vector) Multiply

func (v Vector) Multiply(o Vector) Vector

func (Vector) MultiplyScalar

func (v Vector) MultiplyScalar(t float64) Vector

func (Vector) Normalize

func (v Vector) Normalize() Vector

func (Vector) Reflect

func (v Vector) Reflect(n Vector) Vector

func (Vector) Refract

func (v Vector) Refract(o Vector, n float64) (bool, Vector)

func (Vector) SquaredLength

func (v Vector) SquaredLength() float64

func (Vector) Subtract

func (v Vector) Subtract(o Vector) Vector

type World

type World struct {
	// contains filtered or unexported fields
}

func (*World) Add

func (w *World) Add(h Hitable)

func (*World) Hit

func (w *World) Hit(r Ray, tMin float64, tMax float64) (bool, Hit)

Jump to

Keyboard shortcuts

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