Documentation ¶
Index ¶
- func LoadSTL(path string) ([]*sdf.Triangle3, error)
- func Poly(p *sdf.Polygon, path string) error
- func SaveDXF(path string, mesh []*sdf.Line2) error
- func SaveSTL(path string, mesh []*sdf.Triangle3) error
- func SaveSVG(path, lineStyle string, mesh []*sdf.Line2) 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 ToTriangles(s sdf.SDF3, r Render3) []*sdf.Triangle3
- type DXF
- type DualContouring2D
- type EdgeI
- type MarchingCubesOctree
- type MarchingCubesUniform
- type MarchingSquaresQuadtree
- type MarchingSquaresUniform
- type PNG
- type Render2
- type Render3
- type STLHeader
- type STLTriangle
- type SVG
- 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.
func (*DualContouring2D) Info ¶
func (r *DualContouring2D) Info(s sdf.SDF2) string
Info returns a string describing the rendered area.
func (*DualContouring2D) Render ¶
func (r *DualContouring2D) Render(s sdf.SDF2, output sdf.Line2Writer)
Render produces a 2d line mesh over the bounding area of an sdf2.
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.
func (*MarchingCubesOctree) Info ¶
func (r *MarchingCubesOctree) Info(s sdf.SDF3) string
Info returns a string describing the rendered volume.
func (*MarchingCubesOctree) Render ¶
func (r *MarchingCubesOctree) Render(s sdf.SDF3, output sdf.Triangle3Writer)
Render produces a 3d triangle mesh over the bounding volume of an sdf3.
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.
func (*MarchingCubesUniform) Info ¶
func (r *MarchingCubesUniform) Info(s sdf.SDF3) string
Info returns a string describing the rendered volume.
func (*MarchingCubesUniform) Render ¶
func (r *MarchingCubesUniform) Render(s sdf.SDF3, output sdf.Triangle3Writer)
Render produces a 3d triangle mesh over the bounding volume of an sdf3.
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.
func (*MarchingSquaresQuadtree) Info ¶
func (r *MarchingSquaresQuadtree) Info(s sdf.SDF2) string
Info returns a string describing the rendered area.
func (*MarchingSquaresQuadtree) Render ¶
func (r *MarchingSquaresQuadtree) Render(s sdf.SDF2, output sdf.Line2Writer)
Render produces a 2d line mesh over the bounding area of an sdf2.
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 sdf.Line2Writer)
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 sdf.Triangle3Writer) 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 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.