render

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create3MF

func Create3MF(filename string, r Renderer) error

Create3MF saves Renderer stream to a 3MF file type. This function is in experimental stage and may not work properly for large models.

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

NewOctreeRenderer returns a Marching Cubes implementation using octree cube sampling. As of May 2022 this implementation leaks the todo cube slice which may impact performance for complex shapes rendered at high resolutions. This is because it is much faster this way and simpler. Ideally the todo slice should be a queue or circular buffer.

Types

type Renderer

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

type Triangle2

type Triangle2 [3]r2.Vec

Triangle2 is a 2D triangle

type Triangle3

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

Triangle3 is a 3D triangle

func RenderAll

func RenderAll(r Renderer) ([]Triangle3, error)

RenderAll reads the full contents of a Renderer and returns the slice read. It does not return error on io.EOF, like the io.RenderAll implementation.

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.

Jump to

Keyboard shortcuts

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