Documentation ¶
Index ¶
- Variables
- type BT
- type ErrCoincidentVerticies
- type Intersection
- type Triangle
- func (t Triangle) BT(origin, u int, buf *BT) *BT
- func (t *Triangle) Intersection(l line.Line) Intersection
- func (t *Triangle) Intersections(l line.Line) []float64
- func (t *Triangle) Intersector() *TriangleIntersector
- func (t *Triangle) LineIntersection(l line.Line) (float64, bool)
- func (t *Triangle) Normal() d3.V
- func (t *Triangle) Validate() error
- type TriangleIntersector
Constants ¶
This section is empty.
Variables ¶
var Small = 1e-6
Functions ¶
This section is empty.
Types ¶
type BT ¶
BT is a triangle expressed barycentrically
type ErrCoincidentVerticies ¶
type ErrCoincidentVerticies struct{}
ErrCoincidentVerticies indicates that a Triangle has at least 2 identical points.
func (ErrCoincidentVerticies) Error ¶
func (ErrCoincidentVerticies) Error() string
Error fulfils the error interface
type Intersection ¶
Intersection of a line an a triangle. The U and V values indicate the coordinate on the triangle and T indicates the point on the line. Does indicates if there was any intersection. If a line intersects a triangle and a transformation is applied to both, the Intersection will still give the correct values.
type Triangle ¶
Triangle in 3D
func (*Triangle) Intersection ¶
func (t *Triangle) Intersection(l line.Line) Intersection
Intersection returns the intersection point if there is one and bool indicating if there was an intersection.
func (*Triangle) Intersections ¶
Intersections returns the intersection as a []float64
func (*Triangle) Intersector ¶
func (t *Triangle) Intersector() *TriangleIntersector
Intersector creates a TriangleIntersector that caches some of the computation for finding the intersections between the triangle and a line.
func (*Triangle) LineIntersection ¶
LineIntersection returns the intersection point if there is one and bool indicating if there was an intersection.
type TriangleIntersector ¶
TriangleIntersector expresses a triangle as a point and 2 vectors which is the first step of computing line intersections.
func (*TriangleIntersector) Intersection ¶
func (t *TriangleIntersector) Intersection(l line.Line) Intersection
Intersection checks if the given line intersects the triangle.
func (*TriangleIntersector) LineIntersection ¶
func (t *TriangleIntersector) LineIntersection(l line.Line) (float64, bool)
LineIntersection checks if the line intersects the triangle. It can only intersect once so the return is a float and a bool. The float indicates where the intersection occured and the bool indicates if there was an intersection.
func (*TriangleIntersector) RawIntersection ¶
func (t *TriangleIntersector) RawIntersection(l line.Line) Intersection
RawIntersection saves overhead by doing all the calculation in place rather than calling functions. For raytracing it was shown to be a significant improvement.