private function triBoxOverlap_loc(boxCenter, boxHalfwidth, triNodes) result(overlaps)
This routine checks for triangle box overlap
this routine is conversion of c-code tribox3.c triBoxOverlap function.
use separating axis theorem to test overlap between triangle and box
need to test for overlap in these directions:
1) the {x,y,z}-directions (actually, since we use the AABB of the triangle
we do not even need to test these)
2) normal of the triangle
3) separating axis test. crossproduct(edge from tri, {x,y,z}-directin)
this gives 3x3=9 more 7tests
This code is available at:
http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/code/tribox3.txt
Arguments
Type
Intent
Optional
Attributes
Name
real(kind=rk),
intent(in)
::
boxCenter(3)
box center
real(kind=rk),
intent(in)
::
boxHalfwidth(3)
halfwidth of the box
real(kind=rk),
intent(in)
::
triNodes(3,3)
nodes of the triangle
1st index denote x,y,z coordinates and
2nd index denote nodes
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.