Versions in this module Expand all Collapse all v0 v0.0.1 Aug 22, 2021 Changes in this version + type BasePattern struct + func (s *BasePattern) SetTransform(m M4) + func (s *BasePattern) Transform() M4 + type BoundsT struct + Max Tuple + Min Tuple + func Bounds() *BoundsT + func UpdateTransformedBounds(object Object, boundingBox *BoundsT) *BoundsT + func (b *BoundsT) LocalIntersect(ray RayT, object Object) []IntersectionT + func (b *BoundsT) String() string + func (b *BoundsT) UpdateBounds(p Tuple) + type CSGOperation int + const CSGDifference + const CSGIntersection + const CSGUnion + type CSGT struct + Left Object + Operation CSGOperation + Right Object + func CSG(operation CSGOperation, left, right Object) *CSGT + func (c *CSGT) Bounds() *BoundsT + func (c *CSGT) FilterIntersections(xs []IntersectionT) []IntersectionT + func (c *CSGT) Includes(other Object) bool + func (c *CSGT) LocalIntersect(ray RayT) []IntersectionT + func (c *CSGT) LocalNormalAt(objectPoint Tuple, hit *IntersectionT) Tuple + func (c *CSGT) SetMaterial(material MaterialT) Object + func (c *CSGT) SetParent(parent Object) Object + func (c *CSGT) SetTransform(m M4) Object + type CameraT struct + FieldOfView float64 + HSize int + HalfHeight float64 + HalfWidth float64 + NumWorkers int + PixelSize float64 + Transform M4 + VSize int + func Camera(hsize, vsize int, fov float64) *CameraT + func (c *CameraT) RayForPixel(px, py int) RayT + func (c *CameraT) Render(world *WorldT) *Canvas + type Canvas struct + func NewCanvas(width, height int) *Canvas + func (c *Canvas) At(x, y int) color.Color + func (c *Canvas) Bounds() image.Rectangle + func (c *Canvas) ColorModel() color.Model + func (c *Canvas) PixelAt(x, y int) Tuple + func (c *Canvas) ToPPM() string + func (c *Canvas) WritePNGFile(filename string) error + func (c *Canvas) WritePPMFile(filename string) error + func (c *Canvas) WritePixel(x, y int, color Tuple) + type CheckersPatternT struct + func CheckersPattern(a, b Tuple) *CheckersPatternT + func (s *CheckersPatternT) LocalPatternAt(localPoint Tuple) Tuple + type Comps struct + EyeVector Tuple + Inside bool + N1 float64 + N2 float64 + NormalVector Tuple + Object Object + OverPoint Tuple + Point Tuple + ReflectVector Tuple + T float64 + UnderPoint Tuple + func (c *Comps) Schlick() float64 + type ConeT struct + Closed bool + Maximum float64 + Minimum float64 + func Cone() *ConeT + func (c *ConeT) Bounds() *BoundsT + func (c *ConeT) Includes(other Object) bool + func (c *ConeT) LocalIntersect(ray RayT) []IntersectionT + func (c *ConeT) LocalNormalAt(objectPoint Tuple, hit *IntersectionT) Tuple + func (c *ConeT) SetMaterial(material MaterialT) Object + func (c *ConeT) SetParent(parent Object) Object + func (c *ConeT) SetTransform(m M4) Object + type CubeT struct + func Cube() *CubeT + func (c *CubeT) Bounds() *BoundsT + func (c *CubeT) Includes(other Object) bool + func (c *CubeT) LocalIntersect(ray RayT) []IntersectionT + func (c *CubeT) LocalNormalAt(objectPoint Tuple, hit *IntersectionT) Tuple + func (c *CubeT) SetMaterial(material MaterialT) Object + func (c *CubeT) SetParent(parent Object) Object + func (c *CubeT) SetTransform(m M4) Object + type CylinderT struct + Closed bool + Maximum float64 + Minimum float64 + func Cylinder() *CylinderT + func (c *CylinderT) Bounds() *BoundsT + func (c *CylinderT) Includes(other Object) bool + func (c *CylinderT) LocalIntersect(ray RayT) []IntersectionT + func (c *CylinderT) LocalNormalAt(objectPoint Tuple, hit *IntersectionT) Tuple + func (c *CylinderT) SetMaterial(material MaterialT) Object + func (c *CylinderT) SetParent(parent Object) Object + func (c *CylinderT) SetTransform(m M4) Object + type GradientPatternT struct + func GradientPattern(a, b Tuple) *GradientPatternT + func (s *GradientPatternT) LocalPatternAt(localPoint Tuple) Tuple + type GroupT struct + Children []Object + func Group(shapes ...Object) *GroupT + func (g *GroupT) AddChild(shapes ...Object) + func (g *GroupT) Bounds() *BoundsT + func (g *GroupT) Includes(other Object) bool + func (g *GroupT) LocalIntersect(ray RayT) []IntersectionT + func (g *GroupT) LocalNormalAt(objectPoint Tuple, hit *IntersectionT) Tuple + func (g *GroupT) SetMaterial(material MaterialT) Object + func (g *GroupT) SetParent(parent Object) Object + func (g *GroupT) SetTransform(m M4) Object + type IntersectionT struct + Object Object + T float64 + U float64 + V float64 + func Hit(xs []IntersectionT) *IntersectionT + func Intersect(object Object, ray RayT) []IntersectionT + func Intersection(t float64, object Object) IntersectionT + func IntersectionWithUV(t float64, object Object, u, v float64) IntersectionT + func Intersections(args ...IntersectionT) []IntersectionT + func (hit *IntersectionT) NormalAt(worldPoint Tuple) Tuple + func (i *IntersectionT) PrepareComputations(ray RayT, xs []IntersectionT) *Comps + type M2 [2]Tuple + func (m M2) Determinant() float64 + func (m M2) Equal(other M2) bool + func (m M2) Get(row, col int) float64 + type M3 [3]Tuple + func (m M3) Cofactor(row, col int) float64 + func (m M3) Determinant() float64 + func (m M3) Equal(other M3) bool + func (m M3) Get(row, col int) float64 + func (m M3) Minor(row, col int) float64 + func (m M3) Submatrix(row, col int) M2 + type M4 [4]Tuple + func M4Identity() M4 + func RotationX(radians float64) M4 + func RotationY(radians float64) M4 + func RotationZ(radians float64) M4 + func Scaling(x, y, z float64) M4 + func Shearing(xy, xz, yx, yz, zx, zy float64) M4 + func Translation(x, y, z float64) M4 + func ViewTransform(from, to, up Tuple) M4 + func (m M4) Cofactor(row, col int) float64 + func (m M4) Column(col int) Tuple + func (m M4) Determinant() float64 + func (m M4) Equal(other M4) bool + func (m M4) Get(row, col int) float64 + func (m M4) Inverse() M4 + func (m M4) Invertible() bool + func (m M4) Minor(row, col int) float64 + func (m M4) Mult(other M4) M4 + func (m M4) MultTuple(other Tuple) Tuple + func (m M4) RotateX(radians float64) M4 + func (m M4) RotateY(radians float64) M4 + func (m M4) RotateZ(radians float64) M4 + func (m M4) Scale(x, y, z float64) M4 + func (m M4) Shear(xy, xz, yx, yz, zx, zy float64) M4 + func (m M4) Submatrix(row, col int) M3 + func (m M4) Translate(x, y, z float64) M4 + func (m M4) Transpose() M4 + type MaterialT struct + Ambient float64 + Color Tuple + Diffuse float64 + Pattern Pattern + Reflective float64 + RefractiveIndex float64 + Shininess float64 + Specular float64 + Transparency float64 + func Material() MaterialT + type Object interface + Bounds func() *BoundsT + Includes func(other Object) bool + LocalIntersect func(ray RayT) []IntersectionT + LocalNormalAt func(localPoint Tuple, hit *IntersectionT) Tuple + Material func() *MaterialT + Parent func() Object + SetMaterial func(material MaterialT) Object + SetParent func(parent Object) Object + SetTransform func(m M4) Object + Transform func() M4 + type Pattern interface + LocalPatternAt func(localPoint Tuple) Tuple + SetTransform func(m M4) + Transform func() M4 + type PlaneT struct + func Plane() *PlaneT + func (p *PlaneT) Bounds() *BoundsT + func (p *PlaneT) Includes(other Object) bool + func (p *PlaneT) LocalIntersect(ray RayT) []IntersectionT + func (p *PlaneT) LocalNormalAt(objectPoint Tuple, hit *IntersectionT) Tuple + func (p *PlaneT) SetMaterial(material MaterialT) Object + func (p *PlaneT) SetParent(parent Object) Object + func (p *PlaneT) SetTransform(m M4) Object + type PointLightT struct + func PointLight(position Tuple, intensity Tuple) *PointLightT + type RayT struct + Direction Tuple + Origin Tuple + func Ray(origin, direction Tuple) RayT + func (r RayT) Position(t float64) Tuple + func (r RayT) Transform(m M4) RayT + type RingPatternT struct + func RingPattern(a, b Tuple) *RingPatternT + func (s *RingPatternT) LocalPatternAt(localPoint Tuple) Tuple + type Shape struct + func (s *Shape) Material() *MaterialT + func (s *Shape) Parent() Object + func (s *Shape) Transform() M4 + type SmoothTriangleT struct + N1 Tuple + N2 Tuple + N3 Tuple + func SmoothTriangle(p1, p2, p3, n1, n2, n3 Tuple) *SmoothTriangleT + func (s *SmoothTriangleT) Bounds() *BoundsT + func (s *SmoothTriangleT) Includes(other Object) bool + func (s *SmoothTriangleT) LocalIntersect(ray RayT) []IntersectionT + func (s *SmoothTriangleT) LocalNormalAt(objectPoint Tuple, hit *IntersectionT) Tuple + func (s *SmoothTriangleT) SetMaterial(material MaterialT) Object + func (s *SmoothTriangleT) SetParent(parent Object) Object + func (s *SmoothTriangleT) SetTransform(m M4) Object + type SphereT struct + func GlassSphere() *SphereT + func Sphere() *SphereT + func (s *SphereT) Bounds() *BoundsT + func (s *SphereT) Includes(other Object) bool + func (s *SphereT) LocalIntersect(ray RayT) []IntersectionT + func (s *SphereT) LocalNormalAt(objectPoint Tuple, hit *IntersectionT) Tuple + func (s *SphereT) SetMaterial(material MaterialT) Object + func (s *SphereT) SetParent(parent Object) Object + func (s *SphereT) SetTransform(m M4) Object + type StripePatternT struct + func StripePattern(a, b Tuple) *StripePatternT + func (s *StripePatternT) LocalPatternAt(localPoint Tuple) Tuple + type TriangleT struct + E1 Tuple + E2 Tuple + N1 Tuple + N2 Tuple + N3 Tuple + Normal Tuple + P1 Tuple + P2 Tuple + P3 Tuple + func Triangle(p1, p2, p3 Tuple) *TriangleT + func (t *TriangleT) Bounds() *BoundsT + func (t *TriangleT) Includes(other Object) bool + func (t *TriangleT) LocalIntersect(ray RayT) []IntersectionT + func (t *TriangleT) LocalNormalAt(objectPoint Tuple, hit *IntersectionT) Tuple + func (t *TriangleT) SetMaterial(material MaterialT) Object + func (t *TriangleT) SetParent(parent Object) Object + func (t *TriangleT) SetTransform(m M4) Object + type Tuple [4]float64 + func Color(red, green, blue float64) Tuple + func Lighting(material *MaterialT, object Object, light *PointLightT, point Tuple, ...) Tuple + func NormalToWorld(object Object, normal Tuple) Tuple + func PatternAt(pattern Pattern, object Object, worldPoint Tuple) Tuple + func Point(x, y, z float64) Tuple + func Vector(x, y, z float64) Tuple + func WorldToObject(object Object, point Tuple) Tuple + func (t Tuple) Add(other Tuple) Tuple + func (t Tuple) Alpha() float64 + func (t Tuple) Blue() float64 + func (t Tuple) Cross(other Tuple) Tuple + func (t Tuple) DivScalar(f float64) Tuple + func (t Tuple) Dot(other Tuple) float64 + func (t Tuple) Equal(other Tuple) bool + func (t Tuple) Green() float64 + func (t Tuple) HadamardProduct(other Tuple) Tuple + func (t Tuple) IsPoint() bool + func (t Tuple) IsVector() bool + func (t Tuple) Magnitude() float64 + func (t Tuple) MultScalar(f float64) Tuple + func (t Tuple) Negate() Tuple + func (t Tuple) Normalize() Tuple + func (t Tuple) Red() float64 + func (t Tuple) Reflect(normal Tuple) Tuple + func (t Tuple) Sub(other Tuple) Tuple + func (t Tuple) W() float64 + func (t Tuple) X() float64 + func (t Tuple) Y() float64 + func (t Tuple) Z() float64 + type WorldT struct + Lights []*PointLightT + Objects []Object + func DefaultWorld() *WorldT + func World() *WorldT + func (w *WorldT) ColorAt(ray RayT, remaining int) Tuple + func (w *WorldT) IntersectWorld(ray RayT) []IntersectionT + func (w *WorldT) IsShadowed(point Tuple, light *PointLightT) bool + func (w *WorldT) ReflectedColor(comps *Comps, remaining int) Tuple + func (w *WorldT) RefractedColor(comps *Comps, remaining int) Tuple + func (w *WorldT) ShadeHit(comps *Comps, remaining int) Tuple