Documentation
ΒΆ
Index ΒΆ
- Constants
- Variables
- func Degrees(radians float64) float64
- func Median(items []float64) float64
- func ParseFloats(items []string) []float64
- func Radians(degrees float64) float64
- func SaveBinarySTL(path string, mesh *Mesh) error
- type Axis
- type BooleanShape
- type Box
- type ClipFilter
- type Cone
- type Cube
- type Cylinder
- type Direction
- type EmptyShape
- type Filter
- type Function
- type Hit
- type Matrix
- func Frustum(l, r, b, t, n, f float64) Matrix
- func Identity() Matrix
- func LookAt(eye, center, up Vector) Matrix
- func Orthographic(l, r, b, t, n, f float64) Matrix
- func Perspective(fovy, aspect, near, far float64) Matrix
- func Rotate(v Vector, a float64) Matrix
- func Scale(v Vector) Matrix
- func Translate(v Vector) Matrix
- func (a Matrix) Determinant() float64
- func (m Matrix) Frustum(l, r, b, t, n, f float64) Matrix
- func (a Matrix) Inverse() Matrix
- func (a Matrix) Mul(b Matrix) Matrix
- func (a Matrix) MulBox(box Box) Box
- func (a Matrix) MulDirection(b Vector) Vector
- func (a Matrix) MulPosition(b Vector) Vector
- func (a Matrix) MulPositionW(b Vector) Vector
- func (a Matrix) MulRay(b Ray) Ray
- func (m Matrix) Orthographic(l, r, b, t, n, f float64) Matrix
- func (m Matrix) Perspective(fovy, aspect, near, far float64) Matrix
- func (m Matrix) Rotate(v Vector, a float64) Matrix
- func (m Matrix) Scale(v Vector) Matrix
- func (m Matrix) Translate(v Vector) Matrix
- func (a Matrix) Transpose() Matrix
- type Mesh
- func (m *Mesh) BoundingBox() Box
- func (m *Mesh) Compile()
- func (m *Mesh) Contains(v Vector, f float64) bool
- func (m *Mesh) FitInside(box Box, anchor Vector)
- func (m *Mesh) Intersect(r Ray) Hit
- func (m *Mesh) MoveTo(position, anchor Vector)
- func (m *Mesh) Paths() Paths
- func (m *Mesh) SaveBinarySTL(path string) error
- func (m *Mesh) Transform(matrix Matrix)
- func (m *Mesh) UnitCube()
- func (m *Mesh) UpdateBoundingBox()
- func (m *Mesh) Voxelize(size float64) []*Cube
- type Node
- type Op
- type OutlineCone
- type OutlineCylinder
- type OutlineSphere
- type Path
- type Paths
- func (p Paths) BoundingBox() Box
- func (p Paths) Chop(step float64) Paths
- func (p Paths) Filter(f Filter) Paths
- func (p Paths) Print()
- func (p Paths) Simplify(threshold float64) Paths
- func (p Paths) String() string
- func (p Paths) ToSVG(width, height float64) string
- func (p Paths) Transform(matrix Matrix) Paths
- func (p Paths) WriteToPNG(path string, width, height float64)
- func (p Paths) WriteToSVG(path string, width, height float64) error
- func (p Paths) WriteToTXT(path string) error
- type Plane
- type Ray
- type STLHeader
- type STLTriangle
- type Scene
- func (s *Scene) Add(shape Shape)
- func (s *Scene) Compile()
- func (s *Scene) Intersect(r Ray) Hit
- func (s *Scene) Paths() Paths
- func (s *Scene) Render(eye, center, up Vector, width, height, fovy, near, far, step float64) Paths
- func (s *Scene) RenderWithMatrix(matrix Matrix, eye Vector, width, height, step float64) Paths
- func (s *Scene) Visible(eye, point Vector) bool
- type Shape
- func NewBooleanShape(op Op, shapes ...Shape) Shape
- func NewDifference(shapes ...Shape) Shape
- func NewFunction(function func(x, y float64) float64, box Box, direction Direction) Shape
- func NewIntersection(shapes ...Shape) Shape
- func NewTransformedOutlineCone(eye, up, v0, v1 Vector, radius float64) Shape
- func NewTransformedOutlineCylinder(eye, up, v0, v1 Vector, radius float64) Shape
- func NewTransformedShape(s Shape, m Matrix) Shape
- type Sphere
- type TransformedShape
- type Tree
- type Triangle
- type Vector
- func (a Vector) Add(b Vector) Vector
- func (a Vector) AddScalar(b float64) Vector
- func (a Vector) Cross(b Vector) Vector
- func (a Vector) Distance(b Vector) float64
- func (a Vector) DistanceSquared(b Vector) float64
- func (a Vector) Div(b Vector) Vector
- func (a Vector) DivScalar(b float64) Vector
- func (a Vector) Dot(b Vector) float64
- func (a Vector) Length() float64
- func (a Vector) LengthSquared() float64
- func (a Vector) Max(b Vector) Vector
- func (a Vector) Min(b Vector) Vector
- func (a Vector) MinAxis() Vector
- func (a Vector) MinComponent() float64
- func (a Vector) Mul(b Vector) Vector
- func (a Vector) MulScalar(b float64) Vector
- func (a Vector) Normalize() Vector
- func (p Vector) SegmentDistance(v Vector, w Vector) float64
- func (a Vector) Sub(b Vector) Vector
- func (a Vector) SubScalar(b float64) Vector
Constants ΒΆ
View Source
const EPS = 1e-9
View Source
const INF = 1e9
Variables ΒΆ
View Source
var ClipBox = Box{Vector{-1, -1, -1}, Vector{1, 1, 1}}
View Source
var NoHit = Hit{nil, INF}
Functions ΒΆ
func ParseFloats ΒΆ
func SaveBinarySTL ΒΆ
Types ΒΆ
type BooleanShape ΒΆ
func (*BooleanShape) BoundingBox ΒΆ
func (s *BooleanShape) BoundingBox() Box
func (*BooleanShape) Compile ΒΆ
func (s *BooleanShape) Compile()
func (*BooleanShape) Intersect ΒΆ
func (s *BooleanShape) Intersect(r Ray) Hit
func (*BooleanShape) Paths ΒΆ
func (s *BooleanShape) Paths() Paths
type Box ΒΆ
type Box struct {
Min, Max Vector
}
func BoxForShapes ΒΆ
func BoxForTriangles ΒΆ
func BoxForVectors ΒΆ
type ClipFilter ΒΆ
type Cone ΒΆ
func (*Cone) BoundingBox ΒΆ
type Cube ΒΆ
func (*Cube) BoundingBox ΒΆ
type EmptyShape ΒΆ
type EmptyShape struct {
}
func (*EmptyShape) BoundingBox ΒΆ
func (s *EmptyShape) BoundingBox() Box
func (*EmptyShape) Compile ΒΆ
func (s *EmptyShape) Compile()
func (*EmptyShape) Intersect ΒΆ
func (s *EmptyShape) Intersect(r Ray) Hit
func (*EmptyShape) Paths ΒΆ
func (s *EmptyShape) Paths() Paths
type Function ΒΆ
func (*Function) BoundingBox ΒΆ
type Matrix ΒΆ
type Matrix struct {
// contains filtered or unexported fields
}
func Orthographic ΒΆ
func Perspective ΒΆ
func (Matrix) Determinant ΒΆ
func (Matrix) MulDirection ΒΆ
func (Matrix) MulPosition ΒΆ
func (Matrix) MulPositionW ΒΆ
func (Matrix) Orthographic ΒΆ
func (Matrix) Perspective ΒΆ
type Mesh ΒΆ
func LoadBinarySTL ΒΆ
func (*Mesh) BoundingBox ΒΆ
func (*Mesh) SaveBinarySTL ΒΆ
func (*Mesh) UpdateBoundingBox ΒΆ
func (m *Mesh) UpdateBoundingBox()
type OutlineCone ΒΆ
func NewOutlineCone ΒΆ
func NewOutlineCone(eye, up Vector, radius, height float64) *OutlineCone
func (*OutlineCone) Paths ΒΆ
func (c *OutlineCone) Paths() Paths
type OutlineCylinder ΒΆ
func NewOutlineCylinder ΒΆ
func NewOutlineCylinder(eye, up Vector, radius, z0, z1 float64) *OutlineCylinder
func (*OutlineCylinder) Paths ΒΆ
func (c *OutlineCylinder) Paths() Paths
type OutlineSphere ΒΆ
func NewOutlineSphere ΒΆ
func NewOutlineSphere(eye, up, center Vector, radius float64) *OutlineSphere
func (*OutlineSphere) Paths ΒΆ
func (s *OutlineSphere) Paths() Paths
type Paths ΒΆ
type Paths []Path
func (Paths) BoundingBox ΒΆ
func (Paths) WriteToPNG ΒΆ
func (Paths) WriteToTXT ΒΆ
type Plane ΒΆ
func (*Plane) IntersectMesh ΒΆ
type STLTriangle ΒΆ
type STLTriangle struct {
V1, V2, V3 [3]float32
// contains filtered or unexported fields
}
type Shape ΒΆ
type Shape interface {
Compile()
BoundingBox() Box
Contains(Vector, float64) bool
Intersect(Ray) Hit
Paths() Paths
}
func NewBooleanShape ΒΆ
func NewDifference ΒΆ
func NewFunction ΒΆ
func NewIntersection ΒΆ
func NewTransformedShape ΒΆ
type Sphere ΒΆ
func (*Sphere) BoundingBox ΒΆ
type TransformedShape ΒΆ
func (*TransformedShape) BoundingBox ΒΆ
func (s *TransformedShape) BoundingBox() Box
func (*TransformedShape) Intersect ΒΆ
func (s *TransformedShape) Intersect(r Ray) Hit
func (*TransformedShape) Paths ΒΆ
func (s *TransformedShape) Paths() Paths
type Triangle ΒΆ
func NewTriangle ΒΆ
func (*Triangle) BoundingBox ΒΆ
func (*Triangle) UpdateBoundingBox ΒΆ
func (t *Triangle) UpdateBoundingBox()
type Vector ΒΆ
type Vector struct {
X, Y, Z float64
}
func LatLngToXYZ ΒΆ
func RandomUnitVector ΒΆ
func RandomUnitVector() Vector
func (Vector) DistanceSquared ΒΆ
func (Vector) LengthSquared ΒΆ
func (Vector) MinComponent ΒΆ
Click to show internal directories.
Click to hide internal directories.