Documentation ¶
Index ¶
- Constants
- Variables
- type AABB
- type IntersectsAABB
- type IntersectsRay
- type IntersectsTriangle
- type MeshReader
- type MeshWriter
- type OBJReader
- func (r *OBJReader) GetFace(index int) []int
- func (r *OBJReader) GetFacePatch(index int) int
- func (r *OBJReader) GetNumberOfFaceEdges() int
- func (r *OBJReader) GetNumberOfFaces() int
- func (r *OBJReader) GetNumberOfPatches() int
- func (r *OBJReader) GetNumberOfVertices() int
- func (r *OBJReader) GetPatch(index int) string
- func (r *OBJReader) GetVertex(index int) Vector
- func (r *OBJReader) Read() error
- type OBJWriter
- type Ray
- type Triangle
- type Vector
- func (v Vector) Abs() Vector
- func (v Vector) Add(w Vector) Vector
- func (v Vector) AddScalar(s float64) Vector
- func (v Vector) AngleTo(w Vector) float64
- func (v Vector) Cross(w Vector) Vector
- func (v Vector) Div(w Vector) Vector
- func (v Vector) DivScalar(s float64) Vector
- func (v Vector) Dot(w Vector) float64
- func (v Vector) IntersectsAABB(query AABB) bool
- func (v Vector) Inv() Vector
- func (v Vector) Mag() float64
- func (v Vector) Mul(w Vector) Vector
- func (v Vector) MulScalar(s float64) Vector
- func (v Vector) Sub(w Vector) Vector
- func (v Vector) SubScalar(s float64) Vector
- func (v Vector) Unit() Vector
Constants ¶
const ( PrefixVertex = "v" PrefixFace = "f" PrefixGroup = "g" )
Variables ¶
var ( ErrInvalidVertex = errors.New("invalid vertex") ErrInvalidFace = errors.New("invalid face") )
var (
ErrNonManifold = errors.New("non-manifold mesh")
)
Functions ¶
This section is empty.
Types ¶
type AABB ¶
Axis aligned bounding box.
func NewAABBFromBounds ¶
Construct an AABB from its min/max bounds.
func NewAABBFromVectors ¶
Construct an AABB from a slice of vectors.
func (AABB) IntersectsAABB ¶
Implement the IntersectsAABB interface.
type IntersectsAABB ¶
type IntersectsRay ¶
type IntersectsTriangle ¶
type MeshReader ¶
type MeshReader interface { Read() error GetNumberOfVertices() int GetNumberOfFaces() int GetNumberOfFaceEdges() int GetNumberOfPatches() int GetVertex(int) Vector GetFace(int) []int GetFacePatch(int) int GetPatch(int) string }
Generic mesh reader interface.
type MeshWriter ¶
type MeshWriter interface { Write() error SetVertices([]Vector) SetFaces([][]int) SetFacePatches([]int) SetPatches([]string) }
Generic mesh writer interface.
type OBJReader ¶
type OBJReader struct {
// contains filtered or unexported fields
}
OBJReader manages parsing an OBJ (WaveFront) file. This supports both ASCII and GZIP ASCII files.
func NewOBJReader ¶
Construct an OBJ reader from an io.Reader interface.
func ReadOBJFromPath ¶
Read an OBJ file from a file path.
func (*OBJReader) GetFacePatch ¶
Get a face patch by index.
func (*OBJReader) GetNumberOfFaceEdges ¶
Get the number of face edges.
func (*OBJReader) GetNumberOfFaces ¶
Get the number of faces.
func (*OBJReader) GetNumberOfPatches ¶
Get the number of patches.
func (*OBJReader) GetNumberOfVertices ¶
Get the number of vertices.
type OBJWriter ¶
type OBJWriter struct {
// contains filtered or unexported fields
}
OBJReader manages writing an OBJ (WaveFront) file.
func NewOBJWriter ¶
Construct an OBJWriter from an io.Writer interface.
func (*OBJWriter) SetFacePatches ¶
Set the face patches to write.
func (*OBJWriter) SetPatches ¶
Set the patches to write.
func (*OBJWriter) SetVertices ¶
Set the vertices to write.
type Ray ¶
Ray in three-dimensional Cartesian space.
func (Ray) IntersectsAABB ¶
Implement the IntersectsAABB interface.
func (Ray) IntersectsTriangle ¶
Implement the IntersectsTriangle interface.
type Triangle ¶
Triangle in three-dimension Cartesian space.
func NewTriangle ¶
Construct a Triangle from its vertices.
func (Triangle) IntersectsAABB ¶
Implement the IntersectsAABB interface.
func (Triangle) IntersectsRay ¶
Implement the IntersectsRay interface.
type Vector ¶
type Vector [3]float64
Cartesian vector in three-dimensional space.
func NewVectorFromArray ¶
Construct a Vector from an array.
func (Vector) IntersectsAABB ¶
Implement the IntersectsAABB interface.