Documentation ¶
Overview ¶
Package geom contains geometry related functionality
Copyright 2015 Markus Dittrich Licensed under BSD license, see LICENSE file for details
Package geom contains geometry related functionality ¶
Copyright 2015 Markus Dittrich Licensed under BSD license, see LICENSE file for details
Index ¶
Constants ¶
const ( GEOM_EPSILON = 1e-12 GEOM_EPSILON_2 = 1e-24 )
these epsilon is used for geometrical comparison. Anything smaller than that is assumed to be identical. FIXME: This is currently chosen arbitrarily and requires more thinking.
Variables ¶
This section is empty.
Functions ¶
func Intersect ¶
Intersect tests for ray triangle intersections. Possible return values are
0: triangle and ray segment intersect, in this case hitPoint contains the location of the intersection point 1: triangle and ray intersect but ray segment does not reach the triangle 2: triangle and ray do not intersect 3: ray and triangle are co-planar 4: triangle is degenerate
NOTE: This function was adapted from Dan Sunday <http://geomalgorithms.com/a06-_intersect-2.html#intersect3D_RayTriangle()>
Types ¶
type Mesh ¶
type Mesh []MeshElem
Mesh is a collection of MeshElements
func CreateRect ¶
CreateRect is a helper function creating a rectangular Mesh consisting of 12 individual MeshElem. The rectangle dimensions are specified by providing the coordinates of the lower left and upper right vertex
type MeshElem ¶
type MeshElem struct {
A, B, C vec.Vec3 // triangle vertices
U, V vec.Vec3 // u, v coordinates of mesh element
N, NN vec.Vec3 // normal and normalized normal vectors
}
MeshElem describes a single triangular mesh element which may be part of a larger Mesh object.
func NewMeshElem ¶
NewMeshElem creates a new MeshElem and also properly computes the additional data members. NOTE: NewMeshElem assumes that v1, v2, v3 are not colinear, otherwise the function will panic