primitive

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AABB

type AABB struct {
	Min, Max math.Vector
}

AABB an axis aligned bounding box

func NewAABB

func NewAABB(vs ...math.Vector) AABB

NewAABB computes a new axis aligned bounding box of given vertices

func (*AABB) Add

func (aabb *AABB) Add(aabb2 AABB)

Add adds a given aabb to the current aabb

func (AABB) Eq

func (aabb AABB) Eq(aabb2 AABB) bool

Eq checks if two aabbs are equal

func (*AABB) Intersect

func (aabb *AABB) Intersect(aabb2 AABB) bool

Intersect checks if the two given AABBs share an intersection. If the two AABBs only share a single vertex or a 2D plane, then it is also considered as an intersection and returns true.

type Face

type Face interface {
	Normal() math.Vector
	AABB() AABB
	Vertices(func(v *Vertex) bool)
	Triangles(func(t *Triangle) bool)
}

type Halfedge

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

Halfedge holds a halfedge representation.

func (*Halfedge) Cotan

func (he *Halfedge) Cotan() float64

func (*Halfedge) DihedralAngle

func (he *Halfedge) DihedralAngle() float64

func (*Halfedge) Vec

func (he *Halfedge) Vec() math.Vector

type Polygon

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

Polygon is a polygon that contains multiple vertices.

func NewPolygon

func NewPolygon(vs ...*Vertex) (*Polygon, error)

func (*Polygon) AABB

func (p *Polygon) AABB() AABB

func (*Polygon) Normal

func (p *Polygon) Normal() math.Vector

func (*Polygon) Triangles

func (p *Polygon) Triangles(iter func(t *Triangle) bool)

func (*Polygon) Vertices

func (p *Polygon) Vertices(iter func(v *Vertex) bool)

type Quad

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

Quad is a quadrilateral that contains four vertices

func NewQuad

func NewQuad(v1, v2, v3, v4 *Vertex) *Quad

func (*Quad) AABB

func (q *Quad) AABB() AABB

func (*Quad) Normal

func (q *Quad) Normal() math.Vector

func (*Quad) Triangles

func (q *Quad) Triangles(f func(*Triangle) bool)

func (*Quad) Vertices

func (q *Quad) Vertices(f func(v *Vertex) bool)

type Triangle

type Triangle struct {
	V1, V2, V3 Vertex
	// contains filtered or unexported fields
}

Triangle is a triangle that contains three vertices.

func NewTriangle

func NewTriangle(v1, v2, v3 *Vertex) *Triangle

func (*Triangle) AABB

func (t *Triangle) AABB() AABB

func (*Triangle) Normal

func (t *Triangle) Normal() math.Vector

func (*Triangle) Triangles

func (t *Triangle) Triangles(f func(*Triangle) bool)

func (*Triangle) Vertices

func (t *Triangle) Vertices(f func(v *Vertex) bool)

type Vertex

type Vertex struct {
	Pos math.Vector
	UV  math.Vector
	Nor math.Vector
	Col color.RGBA
}

Vertex is a vertex that contains the necessary information for describing a mesh.

func NewRandomVertex

func NewRandomVertex() *Vertex

func (*Vertex) AABB

func (v *Vertex) AABB() AABB

Jump to

Keyboard shortcuts

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