geom

package
v0.0.0-...-99d09c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2015 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package geom contains geometry related functionality

Copyright 2015 Markus Dittrich Licensed under BSD license, see LICENSE file for details

Copyright 2015 Markus Dittrich Licensed under BSD license, see LICENSE file for details

Index

Constants

View Source
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

func Intersect(start, disp vec.Vec3, m *MeshElem) (vec.Vec3, int)

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

func CreateRect(llc, urc vec.Vec3) Mesh

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

func NewMeshElem(v1, v2, v3 vec.Vec3) *MeshElem

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL