mesh

package
v0.0.0-...-3218f21 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2016 License: MIT, MIT Imports: 5 Imported by: 0

README

go-mesh

A modular, idiomatic library for working with 3D triangle meshes in Go.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDontIntersect = errors.New("No intersection found")
	ErrCoplanar      = errors.New("The triangles are coplanar")
)

Functions

func IsCoplanar

func IsCoplanar(err error) bool

func IsDontIntersect

func IsDontIntersect(err error) bool

func IsFormat

func IsFormat(err error) bool

func IsSize

func IsSize(err error) bool

Types

type ArrayBuffer

type ArrayBuffer []Triangle

func (*ArrayBuffer) ConvertFrom

func (this *ArrayBuffer) ConvertFrom(mesh Mesh)

func (*ArrayBuffer) NumTriangles

func (this *ArrayBuffer) NumTriangles() int

type Box

type Box struct {
	LowerBound, UpperBound vec3.T
}

func BoxTriangle

func BoxTriangle(tri Triangle) *Box

func BoxTriangles

func BoxTriangles(tris ...Triangle) *Box

func (*Box) AddBox

func (this *Box) AddBox(other *Box)

func (*Box) Center

func (this *Box) Center() vec3.T

func (*Box) ExpandToCube

func (this *Box) ExpandToCube() *Box

func (*Box) Intersects

func (this *Box) Intersects(other *Box) bool

func (*Box) IntersectsXY

func (this *Box) IntersectsXY(z float64) bool

type BoxedTriangle

type BoxedTriangle struct {
	*Triangle
	*Box
}

type Face

type Face [3]uint16

type IndexBuffer

type IndexBuffer struct {
	Vertices []vec3.T
	Faces    []Face
}

func (*IndexBuffer) ConvertFrom

func (this *IndexBuffer) ConvertFrom(mesh Mesh)

func (*IndexBuffer) NumTriangles

func (this *IndexBuffer) NumTriangles() int

type Line

type Line [2]vec3.T

func (Line) SameSide

func (this Line) SameSide(p0, p1 vec3.T) bool

type Mesh

type Mesh interface {
	NumTriangles() int

	ConvertFrom(Mesh)
	// contains filtered or unexported methods
}

type Octree

type Octree struct {
	*Box
	// contains filtered or unexported fields
}

func NewOctree

func NewOctree(levels uint, box *Box) *Octree

func (*Octree) Insert

func (this *Octree) Insert(tri *BoxedTriangle)

type Plane

type Plane struct {
	Normal vec3.T
	Offset float64
}

func (Plane) IntersectLine

func (this Plane) IntersectLine(line Line) *vec3.T

func (Plane) IntersectTriangle

func (this Plane) IntersectTriangle(tri Triangle) []vec3.T

func (Plane) TriangleCrosses

func (this Plane) TriangleCrosses(tri Triangle) bool

type StlFile

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

StlFile reads from an existing .stl file or creates a new one if it doesn't exist.

func NewStlFile

func NewStlFile(filepath string) (*StlFile, error)

func (*StlFile) ConvertFrom

func (this *StlFile) ConvertFrom(mesh Mesh)

func (*StlFile) NumTriangles

func (this *StlFile) NumTriangles() int

type Triangle

type Triangle [3]vec3.T

func (Triangle) ContainsPoint

func (this Triangle) ContainsPoint(pt vec3.T) bool

http://www.blackpawn.com/texts/pointinpoly/

func (Triangle) IntersectTriangle

func (this Triangle) IntersectTriangle(other Triangle) (*Line, error)

func (Triangle) Plane

func (this Triangle) Plane() Plane

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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