Documentation
¶
Index ¶
- Constants
- func Clamp(v, min, max float64) float64
- func Multiply3x3by3x1(m Matrix, v vector3.Float64) vector3.Float64
- func ToNormal(inEulerAngle vector3.Float64) vector3.Float64
- type AABB
- func (aabb AABB) Center() vector3.Float64
- func (aabb AABB) ClosestPoint(v vector3.Float64) vector3.Float64
- func (aabb AABB) Contains(p vector3.Float64) bool
- func (aabb *AABB) EncapsulateBounds(b AABB)
- func (aabb *AABB) EncapsulatePoint(p vector3.Float64)
- func (aabb *AABB) EncapsulateTri(t Tri)
- func (aabb *AABB) Expand(amount float64)
- func (aabb AABB) Max() vector3.Float64
- func (aabb AABB) Min() vector3.Float64
- func (aabb *AABB) SetMinMax(min, max vector3.Float64)
- func (aabb AABB) Size() vector3.Float64
- type CollapsableMesh
- type Line
- type Material
- type Matrix
- type Mesh
- func EmptyMesh() Mesh
- func MeshFromView(view MeshView) Mesh
- func NewLineStripMesh(v3Data map[string][]vector3.Float64, v2Data map[string][]vector2.Float64, ...) Mesh
- func NewMesh(indices []int, v3Data map[string][]vector3.Float64, ...) Mesh
- func NewPointCloud(v3Data map[string][]vector3.Float64, v2Data map[string][]vector2.Float64, ...) Mesh
- func NewTexturedMesh(triangles []int, vertices []vector3.Float64, normals []vector3.Float64, ...) Mesh
- func (m Mesh) Append(other Mesh) Mesh
- func (m Mesh) AttributeLength() int
- func (m Mesh) BoundingBox(atr string) AABB
- func (m Mesh) CalculateFlatNormals() Mesh
- func (m Mesh) CalculateSmoothNormals() Mesh
- func (m Mesh) CenterFloat3Attribute(atr string) Mesh
- func (m Mesh) Float1Attributes() []string
- func (m Mesh) Float2Attributes() []string
- func (m Mesh) Float3Attributes() []string
- func (m Mesh) HasFloat1Attribute(atr string) bool
- func (m Mesh) HasFloat2Attribute(atr string) bool
- func (m Mesh) HasFloat3Attribute(atr string) bool
- func (m Mesh) HasVertexAttribute(atr string) bool
- func (m Mesh) LineStrip(i int) Line
- func (m Mesh) Materials() []MeshMaterial
- func (m Mesh) ModifyFloat1Attribute(atr string, f func(i int, v float64) float64) Mesh
- func (m Mesh) ModifyFloat1AttributeParallel(atr string, f func(i int, v float64) float64) Mesh
- func (m Mesh) ModifyFloat1AttributeParallelWithPoolSize(atr string, size int, f func(i int, v float64) float64) Mesh
- func (m Mesh) ModifyFloat2Attribute(atr string, f func(i int, v vector2.Float64) vector2.Float64) Mesh
- func (m Mesh) ModifyFloat2AttributeParallel(atr string, f func(i int, v vector2.Float64) vector2.Float64) Mesh
- func (m Mesh) ModifyFloat2AttributeParallelWithPoolSize(atr string, size int, f func(i int, v vector2.Float64) vector2.Float64) Mesh
- func (m Mesh) ModifyFloat3Attribute(atr string, f func(i int, v vector3.Float64) vector3.Float64) Mesh
- func (m Mesh) ModifyFloat3AttributeParallel(atr string, f func(i int, v vector3.Float64) vector3.Float64) Mesh
- func (m Mesh) ModifyFloat3AttributeParallelWithPoolSize(atr string, size int, f func(i int, v vector3.Float64) vector3.Float64) Mesh
- func (m Mesh) PrimitiveCount() int
- func (m Mesh) RemoveUnusedIndices() Mesh
- func (m Mesh) Rotate(q Quaternion) Mesh
- func (m Mesh) RotateAttribute3D(attribute string, q Quaternion) Mesh
- func (m Mesh) Scale(origin, amount vector3.Float64) Mesh
- func (m Mesh) ScaleAttribute3D(attribute string, origin, amount vector3.Float64) Mesh
- func (m Mesh) ScanFloat1Attribute(atr string, f func(i int, v float64)) Mesh
- func (m Mesh) ScanFloat1AttributeParallel(atr string, f func(i int, v float64)) Mesh
- func (m Mesh) ScanFloat1AttributeParallelWithPoolSize(atr string, size int, f func(i int, v float64)) Mesh
- func (m Mesh) ScanFloat2Attribute(atr string, f func(i int, v vector2.Float64)) Mesh
- func (m Mesh) ScanFloat2AttributeParallel(atr string, f func(i int, v vector2.Float64)) Mesh
- func (m Mesh) ScanFloat2AttributeParallelWithPoolSize(atr string, size int, f func(i int, v vector2.Float64)) Mesh
- func (m Mesh) ScanFloat3Attribute(atr string, f func(i int, v vector3.Float64)) Mesh
- func (m Mesh) ScanFloat3AttributeParallel(atr string, f func(i int, v vector3.Float64)) Mesh
- func (m Mesh) ScanFloat3AttributeParallelWithPoolSize(atr string, size int, f func(i int, v vector3.Float64)) Mesh
- func (m Mesh) ScanPrimitives(f func(i int, p Primitive)) Mesh
- func (m Mesh) ScanPrimitivesParallel(f func(i int, p Primitive)) Mesh
- func (m Mesh) ScanPrimitivesParallelWithPoolSize(size int, f func(i int, p Primitive)) Mesh
- func (m Mesh) SetFloat1Attribute(atr string, data []float64) Mesh
- func (m Mesh) SetFloat2Attribute(atr string, data []vector2.Float64) Mesh
- func (m Mesh) SetFloat3Attribute(atr string, data []vector3.Float64) Mesh
- func (m Mesh) SetMaterial(mat Material) Mesh
- func (m Mesh) SliceByPlaneWithAttribute(plane geometry.Plane, atr string) (Mesh, Mesh)
- func (m Mesh) SmoothLaplacian(iterations int, smoothingFactor float64) Mesh
- func (m Mesh) SplitOnUniqueMaterials() []Mesh
- func (m Mesh) Topology() Topology
- func (m Mesh) Translate(v vector3.Float64) Mesh
- func (m Mesh) TranslateAttribute3D(attribute string, v vector3.Float64) Mesh
- func (m Mesh) Tri(i int) Tri
- func (m Mesh) Unweld() Mesh
- func (m Mesh) VertexNeighborTable() VertexLUT
- func (m Mesh) View() MeshView
- func (m Mesh) WeldByFloat3Attribute(attribute string, decimalPlace int) Mesh
- type MeshMaterial
- type MeshView
- type Point
- type Primitive
- type Quaternion
- type ScopedPrimitive
- type Topology
- type Tri
- func (t Tri) BoundingBox(atr string) AABB
- func (t Tri) Bounds() AABB
- func (t Tri) ClosestPoint(atr string, p vector3.Float64) vector3.Float64
- func (t Tri) L1(atr string) geometry.Line3D
- func (t Tri) L2(atr string) geometry.Line3D
- func (t Tri) L3(atr string) geometry.Line3D
- func (t Tri) P1() int
- func (t Tri) P1Vec3Attr(atr string) vector3.Float64
- func (t Tri) P2() int
- func (t Tri) P2Vec3Attr(atr string) vector3.Float64
- func (t Tri) P3() int
- func (t Tri) P3Vec3Attr(atr string) vector3.Float64
- func (t Tri) Plane(attr string) geometry.Plane
- func (t Tri) PointInSide(p vector3.Float64) bool
- func (t Tri) Scope(atr string) ScopedPrimitive
- func (t Tri) UniqueVertices() bool
- type VectorInt
- type VertexLUT
- func (vLUT VertexLUT) AddLookup(from, to int)
- func (vLUT VertexLUT) Count(v int) int
- func (vLUT VertexLUT) Link(v1, v2 int)
- func (vLUT VertexLUT) Lookup(v int) map[int]struct{}
- func (vLUT VertexLUT) Remove(v int) map[int]struct{}
- func (vLUT VertexLUT) RemoveLink(v1, v2 int)
- func (vLUT VertexLUT) RemoveLookup(from, to int)
- func (vLUT VertexLUT) RemoveVertex(v int)
Constants ¶
const ( PositionAttribute = "Position" NormalAttribute = "Normal" ColorAttribute = "Color" TexCoordAttribute = "TexCoord" ClassAttribute = "Class" IntensityAttribute = "Intensity" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AABB ¶
type AABB struct {
// contains filtered or unexported fields
}
func NewAABBFromPoints ¶
func (*AABB) EncapsulateBounds ¶
func (*AABB) EncapsulatePoint ¶
func (*AABB) EncapsulateTri ¶
type CollapsableMesh ¶
type CollapsableMesh struct {
// contains filtered or unexported fields
}
func NewCollapsableMesh ¶
func NewCollapsableMesh(m Mesh) CollapsableMesh
func (*CollapsableMesh) CollapseTri ¶
func (cm *CollapsableMesh) CollapseTri(tri int)
func (CollapsableMesh) ToMesh ¶
func (cm CollapsableMesh) ToMesh() Mesh
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
func (Line) BoundingBox ¶
func (Line) ClosestPoint ¶
func (Line) Scope ¶
func (l Line) Scope(attribute string) ScopedPrimitive
type Material ¶
type Material struct {
Name string
// Account for light that is scattered about the entire scene
AmbientColor color.Color
// The main color
DiffuseColor color.Color
// Color seen where the surface is shiny and mirror like
SpecularColor color.Color
// Typically between 0 - 1000, with a high value resulting in a tight,
// concentrated highlight
//
// Defines the focus of the specular highlight
SpecularHighlight float64
// Index of refraction, between 0.001 to 10, 1.0 means light does not bend
// as it passes through the object
OpticalDensity float64
// Specifies how much this material dissolves into the background. A factor
// of 0.0 is fully opaque. A factor of 1.0 is completely transparent.
Transparency float64
ColorTextureURI *string
NormalTextureURI *string
SpecularTextureURI *string
}
Material is just a clone of obj's MTL format at the moment cause man this problem scares me.
func DefaultColorMaterial ¶
func DefaultMaterial ¶
func DefaultMaterial() Material
type Mesh ¶
type Mesh struct {
// contains filtered or unexported fields
}
func EmptyMesh ¶
func EmptyMesh() Mesh
Creates a new triangle mesh with no vertices or attribute data
func MeshFromView ¶
func NewLineStripMesh ¶
func NewPointCloud ¶
func NewTexturedMesh ¶
func (Mesh) AttributeLength ¶
func (Mesh) BoundingBox ¶
func (Mesh) CalculateFlatNormals ¶
func (Mesh) CalculateSmoothNormals ¶
func (Mesh) CenterFloat3Attribute ¶
func (Mesh) Float1Attributes ¶
func (Mesh) Float2Attributes ¶
func (Mesh) Float3Attributes ¶
func (Mesh) HasFloat1Attribute ¶
func (Mesh) HasFloat2Attribute ¶
func (Mesh) HasFloat3Attribute ¶
func (Mesh) HasVertexAttribute ¶
func (Mesh) Materials ¶
func (m Mesh) Materials() []MeshMaterial
func (Mesh) ModifyFloat1Attribute ¶
func (Mesh) ModifyFloat1AttributeParallel ¶
func (Mesh) ModifyFloat1AttributeParallelWithPoolSize ¶
func (Mesh) ModifyFloat2Attribute ¶
func (Mesh) ModifyFloat2AttributeParallel ¶
func (Mesh) ModifyFloat2AttributeParallelWithPoolSize ¶
func (Mesh) ModifyFloat3Attribute ¶
func (Mesh) ModifyFloat3AttributeParallel ¶
func (Mesh) ModifyFloat3AttributeParallelWithPoolSize ¶
func (Mesh) PrimitiveCount ¶
func (Mesh) RemoveUnusedIndices ¶
func (Mesh) Rotate ¶
func (m Mesh) Rotate(q Quaternion) Mesh
func (Mesh) RotateAttribute3D ¶
func (m Mesh) RotateAttribute3D(attribute string, q Quaternion) Mesh
func (Mesh) ScaleAttribute3D ¶
func (Mesh) ScanFloat1Attribute ¶
func (Mesh) ScanFloat1AttributeParallel ¶
func (Mesh) ScanFloat1AttributeParallelWithPoolSize ¶
func (Mesh) ScanFloat2Attribute ¶
func (Mesh) ScanFloat2AttributeParallel ¶
func (Mesh) ScanFloat2AttributeParallelWithPoolSize ¶
func (Mesh) ScanFloat3Attribute ¶
func (Mesh) ScanFloat3AttributeParallel ¶
func (Mesh) ScanFloat3AttributeParallelWithPoolSize ¶
func (Mesh) ScanPrimitivesParallel ¶
func (Mesh) ScanPrimitivesParallelWithPoolSize ¶
func (Mesh) SetFloat2Attribute ¶
func (Mesh) SetFloat3Attribute ¶
func (Mesh) SetMaterial ¶
func (Mesh) SliceByPlaneWithAttribute ¶
func (Mesh) SmoothLaplacian ¶
func (Mesh) SplitOnUniqueMaterials ¶
SplitOnUniqueMaterials generates a mesh per material,
func (Mesh) TranslateAttribute3D ¶
func (Mesh) Unweld ¶
Unweld duplicates all vertex data such that no two primitive indices share any one vertex
func (Mesh) VertexNeighborTable ¶
func (Mesh) View ¶
View exposes the underlying data to be modified. Using this breaks the immutable design of the system, but required for some mesh processing.
Modifying the data stored in the mesh found here will directly update the mesh, and side-steps any type of validation we could have done previously.
If you make changes to this view, assume the mesh and all ancestors of said mesh have just become garbage.
type MeshMaterial ¶
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
func (Point) BoundingBox ¶
func (Point) ClosestPoint ¶
func (Point) Scope ¶
func (p Point) Scope(attribute string) ScopedPrimitive
type Quaternion ¶
type Quaternion struct {
// contains filtered or unexported fields
}
Quaternion is a 4 component imaginary number thingy for rotating 3D meshes.
func NewQuaternion ¶
func NewQuaternion(v vector3.Float64, w float64) Quaternion
NewQuaternion creates a quaternion
func QuaternionZero ¶
func QuaternionZero() Quaternion
QuaternionZero returns a quaternion with 0 for all it's components
func UnitQuaternionFromTheta ¶
func UnitQuaternionFromTheta(theta float64, v vector3.Float64) Quaternion
UnitQuaternionFromTheta takes a vector and angle and builds a unit quaternion in the form (cos(theta/2.0), sin(theta/2.0))
Resources Used:
https://www.youtube.com/watch?v=mHVwd8gYLnI https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation
type ScopedPrimitive ¶
type Tri ¶
type Tri struct {
// contains filtered or unexported fields
}
Tri provides utility functions to a specific underlying mesh
func (Tri) BoundingBox ¶
func (Tri) P1 ¶
P1 is the first point on our triangle, which is an index to the vertices array of a mesh
func (Tri) P2 ¶
P2 is the second point on our triangle, which is an index to the vertices array of a mesh
func (Tri) P3 ¶
P3 is the third point on our triangle, which is an index to the vertices array of a mesh
func (Tri) PointInSide ¶
https://gdbooks.gitbooks.io/3dcollisions/content/Chapter4/point_in_triangle.html
func (Tri) Scope ¶
func (t Tri) Scope(atr string) ScopedPrimitive
func (Tri) UniqueVertices ¶
Valid determines whether or not the contains 3 unique vertices.