render

package
v0.0.0-...-f96937a Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSTL

func CreateSTL(path string, r Renderer) error

CreateSTL renders an SDF3 as an STL file using a Renderer.

func NewOctreeRenderer

func NewOctreeRenderer(s sdf.SDF3, meshCells int) *octree

func Poly

func Poly(p *sdf.Polygon, path string) error

Poly outputs a polygon as a 2D DXF file.

func RenderDXF

func RenderDXF(
	s sdf.SDF2,
	meshCells int,
	path string,
)

RenderDXF renders an SDF2 as a DXF file. (uses quadtree sampling)

func RenderDXFSlow

func RenderDXFSlow(
	s sdf.SDF2,
	meshCells int,
	path string,
)

RenderDXFSlow renders an SDF2 as a DXF file. (uses uniform grid sampling)

func RenderSVG

func RenderSVG(
	s sdf.SDF2,
	meshCells int,
	path string,
	lineStyle string,
) error

RenderSVG renders an SDF2 as an SVG file. (uses quadtree sampling)

func RenderSVGSlow

func RenderSVGSlow(
	s sdf.SDF2,
	meshCells int,
	path string,
	lineStyle string,
) error

RenderSVGSlow renders an SDF2 as an SVG file. (uses uniform grid sampling)

func SaveDXF

func SaveDXF(path string, mesh []*line) error

SaveDXF writes line segments to a DXF file.

func SaveSVG

func SaveSVG(path, lineStyle string, mesh []*line) error

SaveSVG writes line segments to an SVG file.

func WriteDXF

func WriteDXF(wg *sync.WaitGroup, path string) (chan<- *line, error)

WriteDXF writes a stream of line segments to a DXF file.

func WriteSVG

func WriteSVG(wg *sync.WaitGroup, path, lineStyle string) (chan<- *line, error)

WriteSVG writes a stream of line segments to an SVG file.

Types

type DXF

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

DXF is a dxf drawing object.

func NewDXF

func NewDXF(name string) *DXF

NewDXF returns an empty dxf drawing object.

func (*DXF) Line

func (d *DXF) Line(p0, p1 sdf.V2)

Line adds a line to a dxf drawing object.

func (*DXF) Lines

func (d *DXF) Lines(s sdf.V2Set)

Lines adds a set of lines to a dxf drawing object.

func (*DXF) Points

func (d *DXF) Points(s sdf.V2Set, r float64)

Points adds a set of points to a dxf drawing object.

func (*DXF) Save

func (d *DXF) Save() error

Save writes a dxf drawing object to a file.

func (*DXF) Triangle

func (d *DXF) Triangle(t Triangle2)

Triangle adds a triangle to a dxf drawing object.

type EdgeI

type EdgeI [2]int

EdgeI is a 2d/3d edge referencing a list of vertices.

type PNG

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

PNG is a png image object.

func NewPNG

func NewPNG(name string, bb sdf.Box2, pixels sdf.V2i) (*PNG, error)

NewPNG returns an empty PNG object.

func (*PNG) Image

func (d *PNG) Image() *image.RGBA

Image returns the rendered image instead of writing it to a file

func (*PNG) Line

func (d *PNG) Line(p0, p1 sdf.V2)

Line adds a line to a png object.

func (*PNG) Lines

func (d *PNG) Lines(s sdf.V2Set)

Lines adds a set of lines line to a png object.

func (*PNG) RenderSDF2

func (d *PNG) RenderSDF2(s sdf.SDF2)

RenderSDF2 renders a 2d signed distance field as gray scale.

func (*PNG) RenderSDF2MinMax

func (d *PNG) RenderSDF2MinMax(s sdf.SDF2, dmin, dmax float64)

RenderSDF2MinMax renders a 2d signed distance field as gray scale (with defined min/max levels).

func (*PNG) Save

func (d *PNG) Save() error

Save saves a png object to a file.

func (*PNG) Triangle

func (d *PNG) Triangle(t Triangle2)

Triangle adds a triangle to a png object.

type Renderer

type Renderer interface {
	ReadTriangles(t []Triangle3) (int, error)
}

type SVG

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

SVG represents an SVG renderer.

func NewSVG

func NewSVG(filename, lineStyle string) *SVG

NewSVG returns an SVG renderer.

func (*SVG) Line

func (s *SVG) Line(p0, p1 sdf.V2)

Line outputs a line to the SVG file.

func (*SVG) Save

func (s *SVG) Save() error

Save closes the SVG file.

type Triangle2

type Triangle2 [3]sdf.V2

Triangle2 is a 2D triangle

func (Triangle2) Circumcenter

func (t Triangle2) Circumcenter() (sdf.V2, error)

Circumcenter returns the circumcenter of a triangle.

type Triangle3

type Triangle3 struct {
	V [3]r3.Vec
}

Triangle3 is a 3D triangle

func NewTriangle3

func NewTriangle3(a, b, c r3.Vec) *Triangle3

NewTriangle3 returns a new 3D triangle.

func (*Triangle3) Degenerate

func (t *Triangle3) Degenerate(tolerance float64) bool

Degenerate returns true if the triangle is degenerate.

func (*Triangle3) Normal

func (t *Triangle3) Normal() r3.Vec

Normal returns the normal vector to the plane defined by the 3D triangle.

type TriangleISet

type TriangleISet []triangleI

TriangleISet is a set of triangles defined by vertice indices.

func Delaunay2d

func Delaunay2d(vs sdf.V2Set) (TriangleISet, error)

Delaunay2d returns the delaunay triangulation of a 2d point set.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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