Documentation ¶
Index ¶
- type Axis
- type ConvexHull
- type Face
- type HalfEdge
- type HalfEdgeMesh
- type QuickHull
- type Vector
- func (v Vector) Abs() Vector
- func (v Vector) Add(ov Vector) Vector
- func (v Vector) ApproxEqual(ov Vector) bool
- func (v Vector) Cmp(ov Vector) int
- func (v Vector) Cross(ov Vector) Vector
- func (v Vector) Distance(ov Vector) float64
- func (v Vector) Dot(ov Vector) float64
- func (v Vector) IsUnit() bool
- func (v Vector) LargestComponent() Axis
- func (v Vector) Mul(m float64) Vector
- func (v Vector) Norm() float64
- func (v Vector) Norm2() float64
- func (v Vector) Normalize() Vector
- func (v Vector) Ortho() Vector
- func (v Vector) SmallestComponent() Axis
- func (v Vector) String() string
- func (v Vector) Sub(ov Vector) Vector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConvexHull ¶
type ConvexHull struct { Vertices []Vector Indices []int // contains filtered or unexported fields }
func (ConvexHull) Triangles ¶
func (hull ConvexHull) Triangles() [][3]Vector
type Face ¶
type Face struct {
HalfEdge int // Index of a bounding HalfEdge
}
Face of a half edge. See: https://www.openmesh.org/media/Documentations/OpenMesh-6.3-Documentation/a00010.html
type HalfEdge ¶
type HalfEdge struct { EndVertex int // Index of end vertex Opp int // Index of opposite HalfEdge Face int // Index of Face it belongs to Next int // Index of next HalfEdge }
HalfEdge is a half edge. See: https://www.openmesh.org/media/Documentations/OpenMesh-6.3-Documentation/a00010.html
type HalfEdgeMesh ¶
HalfEdgeMesh is a mesh consisting of half edges. See: https://www.openmesh.org/media/Documentations/OpenMesh-6.3-Documentation/a00010.html
type QuickHull ¶
type QuickHull struct {
// contains filtered or unexported fields
}
QuickHull can be used to calculate the convex hull of a point cloud. See: https://en.wikipedia.org/wiki/Quickhull
func (*QuickHull) ConvexHull ¶
func (qh *QuickHull) ConvexHull(pointCloud []Vector, ccw bool, useOriginalIndices bool, epsilon float64) ConvexHull
ConvexHull calculates the convex hull of the given point cloud using the Quickhull algorithm. If epsilon is <= 0 a default value will be used.
func (*QuickHull) ConvexHullAsMesh ¶
func (qh *QuickHull) ConvexHullAsMesh(pointCloud []Vector, epsilon float64) HalfEdgeMesh
ConvexHull calculates the convex hull of the given point cloud using the Quickhull algorithm and returns it as a HalfEdgeMesh. If epsilon is <= 0 a default value will be used.
type Vector ¶
type Vector struct {
X, Y, Z float64
Data interface{}
}
Vector represents a point in ℝ³.
func (Vector) ApproxEqual ¶
ApproxEqual reports whether v and ov are equal within a small epsilon.
func (Vector) Cmp ¶
Cmp compares v and ov lexicographically and returns:
-1 if v < ov 0 if v == ov +1 if v > ov
This method is based on C++'s std::lexicographical_compare. Two entities are compared element by element with the given operator. The first mismatch defines which is less (or greater) than the other. If both have equivalent values they are lexicographically equal.
func (Vector) LargestComponent ¶
LargestComponent returns the axis that represents the largest component in this vector.
func (Vector) Ortho ¶
Ortho returns a unit vector that is orthogonal to v. Ortho(-v) = -Ortho(v) for all v.
func (Vector) SmallestComponent ¶
SmallestComponent returns the axis that represents the smallest component in this vector.