Documentation ¶
Index ¶
- func Poly(p *sdf.Polygon, path string) error
- func SaveDXF(path string, mesh []*Line) error
- func SaveSTL(path string, mesh []*Triangle3) error
- func SaveSVG(path, lineStyle string, mesh []*Line) error
- func To3MF(s sdf.SDF3, path string, r Render3)
- func ToDXF(s sdf.SDF2, path string, r Render2)
- func ToSTL(s sdf.SDF3, path string, r Render3)
- func ToSVG(s sdf.SDF2, path string, r Render2)
- func Write3MF(wg *sync.WaitGroup, path string) (chan<- []*Triangle3, error)
- func WriteDXF(wg *sync.WaitGroup, path string) (chan<- []*Line, error)
- func WriteSTL(wg *sync.WaitGroup, path string) (chan<- []*Triangle3, error)
- func WriteSVG(wg *sync.WaitGroup, path, lineStyle string) (chan<- []*Line, error)
- type DXF
- type DualContouring2D
- type EdgeI
- type Line
- type MarchingCubesOctree
- type MarchingCubesUniform
- type MarchingSquaresQuadtree
- type MarchingSquaresUniform
- type PNG
- type Render2
- type Render3
- type STLHeader
- type STLTriangle
- type SVG
- type Triangle2
- type Triangle3
- type TriangleI
- type TriangleIByIndex
- type TriangleISet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DXF ¶
type DXF struct {
// contains filtered or unexported fields
}
DXF is a dxf drawing object.
type DualContouring2D ¶
type DualContouring2D struct {
// contains filtered or unexported fields
}
DualContouring2D renders is a 2D dual contouring renderer.
func NewDualContouring2D ¶
func NewDualContouring2D(meshCells int) *DualContouring2D
NewDualContouring2D returns a Render2 object.
type Line ¶
Line is a 2d line segment defined with 2 points.
func (Line) Degenerate ¶
Degenerate returns true if the line is degenerate.
type MarchingCubesOctree ¶
type MarchingCubesOctree struct {
// contains filtered or unexported fields
}
MarchingCubesOctree renders using marching cubes with octree space sampling.
func NewMarchingCubesOctree ¶
func NewMarchingCubesOctree(meshCells int) *MarchingCubesOctree
NewMarchingCubesOctree returns a Render3 object.
type MarchingCubesUniform ¶
type MarchingCubesUniform struct {
// contains filtered or unexported fields
}
MarchingCubesUniform renders using marching cubes with uniform space sampling.
func NewMarchingCubesUniform ¶
func NewMarchingCubesUniform(meshCells int) *MarchingCubesUniform
NewMarchingCubesUniform returns a Render3 object.
type MarchingSquaresQuadtree ¶
type MarchingSquaresQuadtree struct {
// contains filtered or unexported fields
}
MarchingSquaresQuadtree renders using marching squares with quadtree area sampling.
func NewMarchingSquaresQuadtree ¶
func NewMarchingSquaresQuadtree(meshCells int) *MarchingSquaresQuadtree
NewMarchingSquaresQuadtree returns a Render2 object.
type MarchingSquaresUniform ¶
type MarchingSquaresUniform struct {
// contains filtered or unexported fields
}
MarchingSquaresUniform renders using marching squares with uniform area sampling.
func NewMarchingSquaresUniform ¶
func NewMarchingSquaresUniform(meshCells int) *MarchingSquaresUniform
NewMarchingSquaresUniform returns a Render2 object.
func (*MarchingSquaresUniform) Info ¶
func (r *MarchingSquaresUniform) Info(s sdf.SDF2) string
Info returns a string describing the rendered area.
func (*MarchingSquaresUniform) Render ¶
func (r *MarchingSquaresUniform) Render(s sdf.SDF2, output chan<- []*Line)
Render produces a 2d line mesh over the bounding area of an sdf2.
func (*MarchingSquaresUniform) ToArray ¶
func (r *MarchingSquaresUniform) ToArray(s sdf.SDF2) array
Render produces a 2d line mesh over the bounding area of an sdf2.
type PNG ¶
type PNG struct {
// contains filtered or unexported fields
}
PNG is a png image object.
func (*PNG) RenderSDF2 ¶
RenderSDF2 renders a 2d signed distance field as gray scale.
func (*PNG) RenderSDF2MinMax ¶
RenderSDF2MinMax renders a 2d signed distance field as gray scale (with defined min/max levels).
type Render3 ¶
type Render3 interface { Render(sdf3 sdf.SDF3, output chan<- []*Triangle3) Info(sdf3 sdf.SDF3) string }
Render3 renders a 3D triangle mesh over the bounding volume of an sdf3.
type STLHeader ¶
type STLHeader struct { Count uint32 // Number of triangles // contains filtered or unexported fields }
STLHeader defines the STL file header.
type STLTriangle ¶
type STLTriangle struct {
Normal, Vertex1, Vertex2, Vertex3 [3]float32
// contains filtered or unexported fields
}
STLTriangle defines the triangle data within an STL file.
type SVG ¶
type SVG struct {
// contains filtered or unexported fields
}
SVG represents an SVG renderer.
type Triangle2 ¶
Triangle2 is a 2D triangle
func (Triangle2) Circumcenter ¶
Circumcenter returns the circumcenter of a triangle.
type Triangle3 ¶
Triangle3 is a 3D triangle
func NewTriangle3 ¶
NewTriangle3 returns a new 3D triangle.
func (*Triangle3) Degenerate ¶
Degenerate returns true if the triangle is degenerate.
type TriangleI ¶
type TriangleI [3]int
TriangleI is a 2d/3d triangle referencing a list of vertices.
type TriangleIByIndex ¶
type TriangleIByIndex []TriangleI
TriangleIByIndex sorts triangles by index.
func (TriangleIByIndex) Len ¶
func (a TriangleIByIndex) Len() int
func (TriangleIByIndex) Less ¶
func (a TriangleIByIndex) Less(i, j int) bool
func (TriangleIByIndex) Swap ¶
func (a TriangleIByIndex) Swap(i, j int)
type TriangleISet ¶
type TriangleISet []TriangleI
TriangleISet is a set of triangles defined by vertice indices.
func Delaunay2d ¶
func Delaunay2d(vs v2.VecSet) (TriangleISet, error)
Delaunay2d returns the delaunay triangulation of a 2d point set.
func Delaunay2dSlow ¶
func Delaunay2dSlow(vs v2.VecSet) (TriangleISet, error)
Delaunay2dSlow returns the delaunay triangulation of a 2d point set. This is a slow reference implementation for testing faster algorithms. See: Computational Geometry, Joseph O'Rourke, 2nd edition, Code 5.1
func (TriangleISet) Canonical ¶
func (ts TriangleISet) Canonical() []TriangleI
Canonical converts a triangle set to it's canonical form. This common form is used to facilitate comparison between the results of different implementations.
func (TriangleISet) Equals ¶
func (ts TriangleISet) Equals(s TriangleISet) bool
Equals tests two triangle sets for equality.