Back to index

salome-med  6.5.0
Classes | Namespaces
TransformedTriangle.hxx File Reference

OVERVIEW of how the class works : (details can be found in the documentation of each method) More...

#include "INTERPKERNELDefines.hxx"
#include <vector>
#include "Log.hxx"
#include "TransformedTriangleInline.hxx"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


 Class representing the bounding box of a number of points. More...


namespace  INTERP_TEST
namespace  INTERP_KERNEL

Detailed Description

OVERVIEW of how the class works : (details can be found in the documentation of each method)

Constructor : The constructor takes as arguments three pointers to double[3] vectors holding the transformed coordinates of the corners of the triangle. It copies their coordinates and then proceeds to pre-calculating certain entities used in the intersection calculation : the double products, triple products and the values of the function E (Grandy, [53]).

calculateIntersectionVolume() : This is the only method in the public interface. It calculates the volume under the intersection polygons between the triangle and the unit tetrahedron, as described in Grandy, pp. 435-447. It does this by first calculating the intersection polygons A and B, with the method calculateIntersectionPolygons(). It then calculates the barycenter of each polygon in calculatePolygonBarycenter(), and sorts their points in a circular order around the barycenter in sortIntersecionPolygon(). The sorting is done with STL sort, using the order defined in the class ProjectedCentralCircularSortOrder. The volume under each polygon is then calculated with calculateVolumeUnderPolygon(), which implements formula [34] in Grandy.

calculateIntersectionPolygons() : This method goes through all the possible ways in which the triangle can intersect the tetrahedron and tests for these types of intersections in accordance with the formulas described in Grandy. These tests are implemented in the test* - methods. The formulas in the article are stated for one case each only, while the calculation must take into account all cases. To this end, a number of tables, implemented as static const arrays of different types, are used. The tables mainly contain values of the different enumeration types described at the beginning of the class interface. For example, the formula Grandy gives for the segment-halfstrip intersection tests ([30]) is for use with the halfstrip above the zx edge. For the other two halfstrips (above the xy and yz edges), other double products are used, which are stored in the table DP_FOR_HALFSTRIP_INTERSECTION. This allows us to treat all the edges equally, avoiding switch() - statements. It is the careful choice of order of the enumeration types that makes this possible. Notably, there is a correspondance between the TetraEdge type and the DoubleProduct type (see Grandy, table III) that is used throughout the code, permitting statements such as DoubleProduct(some_edge) to work. When an intersection point has been detected it is calculated with a corresponding calc* - method in the cases where it is not known directly. It is then added to the polygon A and/or B as necessary.

OPTIMIZE : If OPTIMIZE is defined, a large number of methods will be prefixed with inline and some optimizations concerning the tests with zero double products will be used.

Definition in file TransformedTriangle.hxx.