Version: 6.3.1
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends

INTERP_KERNEL.TransformedTriangle Class Reference

Class representing one of the faces of the triangulated source polyhedron after having been transformed with the affine transform that takes the target tetrahedron to the unit tetrahedron. More...

#include <TransformedTriangle.hxx>

Inheritance diagram for INTERP_KERNEL.TransformedTriangle:
Inheritance graph

Public Types

enum  TetraCorner {
  O = 0, X, Y, Z,
  NO_TET_CORNER
}
 

Corners of tetrahedron.

More...
enum  TetraEdge {
  OX = 0, OY, OZ, XY,
  YZ, ZX, H01, H10,
  NO_TET_EDGE
}
 

Edges of tetrahedron.

More...
enum  TetraFacet {
  OYZ = 0, OZX, OXY, XYZ,
  NO_TET_FACET
}
 

Facets (faces) of tetrahedron.

More...
enum  TriCorner { P = 0, Q, R, NO_TRI_CORNER }
 

Corners of triangle.

More...
enum  TriSegment { PQ = 0, QR, RP, NO_TRI_SEGMENT }
 

Segments (edges) of triangle.

More...
enum  IntersectionPolygon { A = 0, B, NO_INTERSECTION_POLYGONS }
 

Intersection polygons.

More...
enum  DoubleProduct {
  C_YZ = 0, C_ZX, C_XY, C_ZH,
  C_XH, C_YH, C_01, C_10,
  NO_DP
}
 

Double products NB : order corresponds to TetraEdges (Grandy, table III)

More...

Public Member Functions

 TransformedTriangle (double *p, double *q, double *r)
 Constructor.
 ~TransformedTriangle ()
 Destructor.
double calculateIntersectionVolume ()
 Calculates the volume of intersection between the triangle and the unit tetrahedron.
void dumpCoords () const
 Prints the coordinates of the triangle to std.cout.
const doublegetCorner (TriCorner corner) const
const std::vector< double * > & getPolygonA () const
double getVolume () const

Protected Member Functions

 TransformedTriangle ()
void calculateIntersectionPolygons ()
 Calculates the intersection polygons A and B, performing the intersection tests and storing the corresponding points in the vectors _polygonA and _polygonB.
void calculatePolygonBarycenter (const IntersectionPolygon poly, double *barycenter)
 Calculates the barycenters of the given intersection polygon.
void sortIntersectionPolygon (const IntersectionPolygon poly, const double *barycenter)
 Sorts the given intersection polygon in circular order around its barycenter.
double calculateVolumeUnderPolygon (IntersectionPolygon poly, const double *barycenter)
 Calculates the volume between the given polygon and the z = 0 plane.
bool isTriangleInPlaneOfFacet (const TetraFacet facet) const
 Checks if the triangle lies in the plane of a given facet.
bool isTriangleParallelToFacet (const TetraFacet facet) const
 Checks if the triangle is parallel to the given facet.
int isTriangleInclinedToFacet (const TetraFacet facet) const
 Checks if the triangle is not perpedicular to the given facet.
bool isTriangleBelowTetraeder () const
 Determines whether the triangle is below the z-plane.
bool testSurfaceEdgeIntersection (const TetraEdge edge) const
void calcIntersectionPtSurfaceEdge (const TetraEdge edge, double *pt) const
 Calculates the point of intersection between the given edge of the tetrahedron and the triangle PQR.
bool testSegmentFacetIntersection (const TriSegment seg, const TetraFacet facet) const
void calcIntersectionPtSegmentFacet (const TriSegment seg, const TetraFacet facet, double *pt) const
 Calculates the point of intersection between the given segment of the triangle and the given facet of the tetrahedron.
bool testSegmentEdgeIntersection (const TriSegment seg, const TetraEdge edge) const
 Tests if the given segment of the triangle intersects the given edge of the tetrahedron (Grandy, eq.
void calcIntersectionPtSegmentEdge (const TriSegment seg, const TetraEdge edge, double *pt) const
 Calculates the point of intersection between the given segment of the triangle and the given edge of the tetrahedron.
bool testSegmentCornerIntersection (const TriSegment seg, const TetraCorner corner) const
 Tests if the given segment of the triangle intersects the given corner of the tetrahedron.
bool testSurfaceRayIntersection (const TetraCorner corner) const
bool testSegmentHalfstripIntersection (const TriSegment seg, const TetraEdge edg)
 Tests if the given segment of the triangle intersects the half-strip above the given edge of the h = 0 plane.
void calcIntersectionPtSegmentHalfstrip (const TriSegment seg, const TetraEdge edge, double *pt) const
 Calculates the point of intersection between the given segment of the triangle and the halfstrip above the given edge of the tetrahedron.
bool testSegmentRayIntersection (const TriSegment seg, const TetraCorner corner) const
 Tests if the given segment of triangle PQR intersects the ray pointing in the upwards z - direction from the given corner of the tetrahedron.
bool testCornerInTetrahedron (const TriCorner corner) const
bool testCornerOnXYZFacet (const TriCorner corner) const
bool testCornerAboveXYZFacet (const TriCorner corner) const
bool testTriangleSurroundsEdge (const TetraEdge edge) const
 Tests if the triangle PQR surrounds the axis on which the given edge of the tetrahedron lies.
bool testEdgeIntersectsTriangle (const TetraEdge edge) const
bool testFacetSurroundsSegment (const TriSegment seg, const TetraFacet facet) const
bool testSegmentIntersectsFacet (const TriSegment seg, const TetraFacet facet) const
bool testSegmentIntersectsHPlane (const TriSegment seg) const
bool testSurfaceAboveCorner (const TetraCorner corner) const
bool testTriangleSurroundsRay (const TetraCorner corner) const
void resetNearZeroCoordinates ()
bool areDoubleProductsConsistent (const TriSegment seg) const
 Checks if the double products for a given segment are consistent, as defined by Grandy, [46].
void preCalculateDoubleProducts (void)
 Pre-calculates all double products for this triangle, and stores them internally.
void resetDoubleProducts (const TriSegment seg, const TetraCorner corner)
double calculateDistanceCornerSegment (const TetraCorner corner, const TriSegment seg) const
 Calculate the shortest distance between a tetrahedron corner and a triangle segment.
void preCalculateTripleProducts (void)
 Pre-calculates all triple products for the tetrahedron with respect to this triangle, and stores them internally.
double calculateAngleEdgeTriangle (const TetraEdge edge) const
 Calculates the angle between an edge of the tetrahedron and the triangle.
double calcStableC (const TriSegment seg, const DoubleProduct dp) const
double calcStableT (const TetraCorner corner) const
double calcUnstableC (const TriSegment seg, const DoubleProduct dp) const
double calcTByDevelopingRow (const TetraCorner corner, const int row=1, const bool project=false) const
 Calculates triple product associated with the given corner of tetrahedron, developing the determinant by the given row.
void preCalculateTriangleSurroundsEdge ()
 Calls TransformedTriangle.testTriangleSurroundsEdge for edges OX to ZX and stores the result in member variable array_triangleSurroundsEdgeCache.

Protected Attributes

double _coords [15]
 Array holding the coordinates of the triangle's three corners order : [ p_x, p_y, p_z, p_h, p_H, q_x, q_y, q_z, q_h, q_H, r_x, r_y, r_z, r_h, r_H ].
bool _is_double_products_calculated
 Flag showing whether the double products have been calculated yet.
bool _is_triple_products_calculated
 Flag showing whether the triple products have been calculated yet.
double _doubleProducts [24]
 Array containing the 24 double products.
double _tripleProducts [4]
 Array containing the 4 triple products.
std::vector< double * > _polygonA
 Vector holding the points of the intersection polygon A.
std::vector< double * > _polygonB
 Vector holding the points of the intersection polygon B.
double _barycenterA [3]
 Array holding the coordinates of the barycenter of the polygon A This point is calculated in calculatePolygonBarycenter.
bool _validTP [4]
 Array holding the coordinates of the barycenter of the polygon B This point is calculated in calculatePolygonBarycenter.
double _volume
 calculated volume for use of UnitTetraIntersectionBary
bool _triangleSurroundsEdgeCache [NO_TET_EDGE]
 Array holding results of the test testTriangleSurroundsEdge() for all the edges.

Static Protected Attributes

static const int DP_OFFSET_1 [8] = {1, 2, 0, 2, 0, 1, 4, 1}
 Table with first coordinate (a) used to calculate double product c^pq_ab = p_a * q_b - p_b * q_a (index to be used : DoubleProduct)
static const int DP_OFFSET_2 [8] = {2, 0, 1, 3, 3, 3, 0, 4}
 Table with second coordinate (b) used to calculate double product c^pq_ab = p_a * q_b - p_b * q_a (index to be used : DoubleProduct)
static const int COORDINATE_FOR_DETERMINANT_EXPANSION [12]
 Coordinates used to calculate triple products by the expanding one of the three rows of the determinant (index to be used : 3*Corner + row)
static const DoubleProduct DP_FOR_DETERMINANT_EXPANSION [12]
 Double products used to calculate triple products by expanding one of the three rows of the determinant (index to be used : 3*Corner + row)
static const long double MACH_EPS = std::numeric_limits<double>::epsilon()
 The machine epsilon, used in precision corrections.
static const long double MULT_PREC_F = 4.0 * TransformedTriangle::MACH_EPS
 4.0 * the machine epsilon, represents the precision of multiplication when performing corrections corrections ( f in Grandy )
static const long double THRESHOLD_F = 500.0
 Threshold for resetting double and triple products to zero; ( F / f in Grandy )
static const double TRIPLE_PRODUCT_ANGLE_THRESHOLD = 0.1
 Threshold for what is considered a small enough angle to warrant correction of triple products by Grandy, [57].
static const DoubleProduct DP_FOR_SEG_FACET_INTERSECTION [12]
 Correspondance between facets and double products.
static const double SIGN_FOR_SEG_FACET_INTERSECTION [12]
 Signs associated with entries in DP_FOR_SEGMENT_FACET_INTERSECTION.
static const double COORDS_TET_CORNER [12]
 Coordinates of corners of tetrahedron.
static const int DP_INDEX [12]
 Indices to use in tables DP_FOR_SEG_FACET_INTERSECTION and SIGN_FOR_SEG_FACET_INTERSECTION for the calculation of the coordinates (x,y,z) of the intersection points for Segment-Facet and Segment-Edge intersections.
static const TetraCorner CORNERS_FOR_EDGE [12]
 Correspondance edge - corners.
static const TetraFacet FACET_FOR_EDGE [12]
 Correspondance edge - facets.
static const TetraEdge EDGES_FOR_CORNER [12]
 Correspondance corners - edges.
static const DoubleProduct DP_FOR_HALFSTRIP_INTERSECTION [12]
 Double products to use in halfstrip intersection tests.
static const DoubleProduct DP_SEGMENT_RAY_INTERSECTION [21]
 Double products to use in segment-ray test.

Friends

class INTERP_TEST::TransformedTriangleTest
class INTERP_TEST::TransformedTriangleIntersectTest

Detailed Description

Class representing one of the faces of the triangulated source polyhedron after having been transformed with the affine transform that takes the target tetrahedron to the unit tetrahedron.

It contains the logic for calculating the volume of intersection between the triangle and the unit tetrahedron.

See also:
TransformedTriangle.hxx

Reference : J. Grandy, "Conservative Remapping and Region Overlays by Intersecting Arbitrary Polyhedra", Journal of Computational Physics (1999)


Member Enumeration Documentation

Corners of tetrahedron.

Enumerator:
O 
X 
Y 
Z 
NO_TET_CORNER 

Edges of tetrahedron.

Enumerator:
OX 
OY 
OZ 
XY 
YZ 
ZX 
H01 
H10 
NO_TET_EDGE 

Facets (faces) of tetrahedron.

Enumerator:
OYZ 
OZX 
OXY 
XYZ 
NO_TET_FACET 

Corners of triangle.

Enumerator:
P 
Q 
R 
NO_TRI_CORNER 

Segments (edges) of triangle.

Enumerator:
PQ 
QR 
RP 
NO_TRI_SEGMENT 

Intersection polygons.

Enumerator:
A 
B 
NO_INTERSECTION_POLYGONS 

Double products NB : order corresponds to TetraEdges (Grandy, table III)

Enumerator:
C_YZ 
C_ZX 
C_XY 
C_ZH 
C_XH 
C_YH 
C_01 
C_10 
NO_DP 

Constructor & Destructor Documentation

INTERP_KERNEL.TransformedTriangle::TransformedTriangle ( double p,
double q,
double r 
)

Constructor.

The coordinates are copied to the internal member variables

Parameters:
parray of three doubles containing coordinates of P
qarray of three doubles containing coordinates of Q
rarray of three doubles containing coordinates of R

References INTERP_KERNEL.TransformedTriangle._coords, INTERP_KERNEL.TransformedTriangle.P, INTERP_KERNEL.TransformedTriangle.preCalculateDoubleProducts(), INTERP_KERNEL.TransformedTriangle.preCalculateTriangleSurroundsEdge(), INTERP_KERNEL.TransformedTriangle.preCalculateTripleProducts(), INTERP_KERNEL.TransformedTriangle.Q, INTERP_KERNEL.TransformedTriangle.R, and INTERP_KERNEL.TransformedTriangle.resetNearZeroCoordinates().

INTERP_KERNEL.TransformedTriangle::~TransformedTriangle ( )

Destructor.

Deallocates the memory used to store the points of the polygons. This memory is allocated in calculateIntersectionPolygons().

References INTERP_KERNEL.TransformedTriangle._polygonA, INTERP_KERNEL.TransformedTriangle._polygonB, and Med_Gen_test.it.

INTERP_KERNEL.TransformedTriangle.TransformedTriangle ( ) [protected]

Member Function Documentation

double INTERP_KERNEL.TransformedTriangle::calculateIntersectionVolume ( )
void INTERP_KERNEL.TransformedTriangle::dumpCoords ( ) const

Prints the coordinates of the triangle to std.cout.

References INTERP_KERNEL.TransformedTriangle._coords, and INTERP_KERNEL.vToStr().

const double* INTERP_KERNEL.TransformedTriangle.getCorner ( TriCorner  corner) const
const std::vector<double*>& INTERP_KERNEL.TransformedTriangle.getPolygonA ( ) const
double INTERP_KERNEL.TransformedTriangle.getVolume ( ) const
void INTERP_KERNEL.TransformedTriangle::calculateIntersectionPolygons ( ) [protected]

Calculates the intersection polygons A and B, performing the intersection tests and storing the corresponding points in the vectors _polygonA and _polygonB.

Postcondition:
_polygonA contains the intersection polygon A and _polygonB contains the intersection polygon B.

References INTERP_KERNEL.TransformedTriangle._coords, INTERP_KERNEL.TransformedTriangle._polygonA, INTERP_KERNEL.TransformedTriangle._polygonB, INTERP_KERNEL.TransformedTriangle.C_YZ, INTERP_KERNEL.TransformedTriangle.calcIntersectionPtSegmentEdge(), INTERP_KERNEL.TransformedTriangle.calcIntersectionPtSegmentFacet(), INTERP_KERNEL.TransformedTriangle.calcIntersectionPtSegmentHalfstrip(), INTERP_KERNEL.TransformedTriangle.calcIntersectionPtSurfaceEdge(), INTERP_KERNEL.TransformedTriangle.calcStableC(), INTERP_KERNEL.TransformedTriangle.COORDS_TET_CORNER, INTERP_KERNEL.copyVector3(), INTERP_KERNEL.TransformedTriangle.DP_FOR_HALFSTRIP_INTERSECTION, INTERP_KERNEL.TransformedTriangle.DP_FOR_SEG_FACET_INTERSECTION, INTERP_KERNEL.TransformedTriangle.DP_SEGMENT_RAY_INTERSECTION, INTERP_KERNEL.TransformedTriangle.EDGES_FOR_CORNER, INTERP_KERNEL.epsilonEqual(), LOG, INTERP_KERNEL.TransformedTriangle.NO_DP, INTERP_KERNEL.TransformedTriangle.NO_TET_CORNER, INTERP_KERNEL.TransformedTriangle.NO_TET_FACET, INTERP_KERNEL.TransformedTriangle.NO_TRI_CORNER, INTERP_KERNEL.TransformedTriangle.NO_TRI_SEGMENT, INTERP_KERNEL.TransformedTriangle.O, INTERP_KERNEL.TransformedTriangle.OX, INTERP_KERNEL.TransformedTriangle.OYZ, INTERP_KERNEL.TransformedTriangle.P, INTERP_KERNEL.TransformedTriangle.PQ, INTERP_KERNEL.TransformedTriangle.testCornerAboveXYZFacet(), INTERP_KERNEL.TransformedTriangle.testCornerInTetrahedron(), INTERP_KERNEL.TransformedTriangle.testCornerOnXYZFacet(), INTERP_KERNEL.TransformedTriangle.testSegmentCornerIntersection(), INTERP_KERNEL.TransformedTriangle.testSegmentEdgeIntersection(), INTERP_KERNEL.TransformedTriangle.testSegmentFacetIntersection(), INTERP_KERNEL.TransformedTriangle.testSegmentHalfstripIntersection(), INTERP_KERNEL.TransformedTriangle.testSegmentRayIntersection(), INTERP_KERNEL.TransformedTriangle.testSurfaceEdgeIntersection(), INTERP_KERNEL.TransformedTriangle.testSurfaceRayIntersection(), INTERP_KERNEL.vToStr(), INTERP_KERNEL.TransformedTriangle.X, INTERP_KERNEL.TransformedTriangle.XY, INTERP_KERNEL.TransformedTriangle.XYZ, and INTERP_KERNEL.TransformedTriangle.ZX.

void INTERP_KERNEL.TransformedTriangle::calculatePolygonBarycenter ( const IntersectionPolygon  poly,
double barycenter 
) [protected]

Calculates the barycenters of the given intersection polygon.

Precondition:
the intersection polygons have been calculated with calculateIntersectionPolygons()
Parameters:
polyone of the two intersection polygons
barycenterarray of three doubles where barycenter is stored

References INTERP_KERNEL.TransformedTriangle._polygonA, INTERP_KERNEL.TransformedTriangle._polygonB, INTERP_KERNEL.TransformedTriangle.A, LOG, TestMedCorba2.m, and INTERP_KERNEL.vToStr().

void INTERP_KERNEL.TransformedTriangle::sortIntersectionPolygon ( const IntersectionPolygon  poly,
const double barycenter 
) [protected]

Sorts the given intersection polygon in circular order around its barycenter.

Precondition:
the intersection polygons have been calculated with calculateIntersectionPolygons()
Postcondition:
the vertices in _polygonA and _polygonB are sorted in circular order around their respective barycenters
Parameters:
polyone of the two intersection polygons
barycenterarray of three doubles with the coordinates of the barycenter

References INTERP_KERNEL.TransformedTriangle._polygonA, INTERP_KERNEL.TransformedTriangle._polygonB, INTERP_KERNEL.TransformedTriangle.A, INTERP_KERNEL.TransformedTriangle.isTriangleInclinedToFacet(), LOG, INTERP_KERNEL.TransformedTriangle.OXY, INTERP_KERNEL.TransformedTriangle.OZX, medClient_test.type, INTERP_KERNEL.vToStr(), INTERP_KERNEL.TransformedTriangle.XY, and INTERP_KERNEL.TransformedTriangle.YZ.

double INTERP_KERNEL.TransformedTriangle::calculateVolumeUnderPolygon ( IntersectionPolygon  poly,
const double barycenter 
) [protected]

Calculates the volume between the given polygon and the z = 0 plane.

Precondition:
the intersection polygones have been calculated with calculateIntersectionPolygons(), and they have been sorted in circular order with sortIntersectionPolygons(void)
Parameters:
polyone of the two intersection polygons
barycenterarray of three doubles with the coordinates of the barycenter
Returns:
the volume between the polygon and the z = 0 plane

References INTERP_KERNEL.TransformedTriangle._polygonA, INTERP_KERNEL.TransformedTriangle._polygonB, INTERP_KERNEL.TransformedTriangle.A, LOG, and TestMedCorba2.m.

bool INTERP_KERNEL.TransformedTriangle::isTriangleInPlaneOfFacet ( const TetraFacet  facet) const [protected]

Checks if the triangle lies in the plane of a given facet.

Parameters:
facetone of the facets of the tetrahedron
Returns:
true if PQR lies in the plane of the facet, false if not

References INTERP_KERNEL.TransformedTriangle._coords, INTERP_KERNEL.TransformedTriangle.NO_TRI_CORNER, and INTERP_KERNEL.TransformedTriangle.P.

bool INTERP_KERNEL.TransformedTriangle::isTriangleParallelToFacet ( const TetraFacet  facet) const [protected]

Checks if the triangle is parallel to the given facet.

Parameters:
facetone of the facets of the unit tetrahedron
Returns:
true if triangle is parallel to facet, false if not

References INTERP_KERNEL.TransformedTriangle._coords, INTERP_KERNEL.TransformedTriangle.P, INTERP_KERNEL.TransformedTriangle.Q, and INTERP_KERNEL.TransformedTriangle.R.

int INTERP_KERNEL.TransformedTriangle::isTriangleInclinedToFacet ( const TetraFacet  facet) const [protected]

Checks if the triangle is not perpedicular to the given facet.

Parameters:
facetone of the facets of the unit tetrahedron
Returns:
zero if the triangle is perpendicular to the facet, else 1 or -1 depending on the sign of cross product of facet edges

References INTERP_KERNEL.TransformedTriangle._coords, INTERP_KERNEL.TransformedTriangle.P, INTERP_KERNEL.TransformedTriangle.Q, and INTERP_KERNEL.TransformedTriangle.R.

bool INTERP_KERNEL.TransformedTriangle::isTriangleBelowTetraeder ( ) const [protected]

Determines whether the triangle is below the z-plane.

Returns:
true if the z-coordinate of the three corners of the triangle are all less than 0, false otherwise.

References INTERP_KERNEL.TransformedTriangle._coords, INTERP_KERNEL.TransformedTriangle.NO_TRI_CORNER, and INTERP_KERNEL.TransformedTriangle.P.

bool TransformedTriangle::testSurfaceEdgeIntersection ( const TetraEdge  edge) const [protected]
void INTERP_KERNEL.TransformedTriangle::calcIntersectionPtSurfaceEdge ( const TetraEdge  edge,
double pt 
) const [protected]

Calculates the point of intersection between the given edge of the tetrahedron and the triangle PQR.

(Grandy, eq [22])

Precondition:
testSurfaceEdgeIntersection(edge) returns true
Parameters:
edgeedge of tetrahedron
ptarray of three doubles in which to store the coordinates of the intersection point

References INTERP_KERNEL.TransformedTriangle.calcStableT(), INTERP_KERNEL.TransformedTriangle.COORDS_TET_CORNER, INTERP_KERNEL.TransformedTriangle.CORNERS_FOR_EDGE, INTERP_KERNEL.TransformedTriangle.H01, and LOG.

bool TransformedTriangle::testSegmentFacetIntersection ( const TriSegment  seg,
const TetraFacet  facet 
) const [protected]
void INTERP_KERNEL.TransformedTriangle::calcIntersectionPtSegmentFacet ( const TriSegment  seg,
const TetraFacet  facet,
double pt 
) const [protected]

Calculates the point of intersection between the given segment of the triangle and the given facet of the tetrahedron.

(Grandy, eq. [23])

Precondition:
testSurfaceEdgeIntersection(seg, facet) returns true
Parameters:
segsegment of the triangle
facetfacet of the tetrahedron
ptarray of three doubles in which to store the coordinates of the intersection point

References INTERP_KERNEL.TransformedTriangle.calcStableC(), INTERP_KERNEL.TransformedTriangle.DP_FOR_SEG_FACET_INTERSECTION, INTERP_KERNEL.TransformedTriangle.DP_INDEX, LOG, TestMedCorba7.s, and INTERP_KERNEL.TransformedTriangle.SIGN_FOR_SEG_FACET_INTERSECTION.

bool INTERP_KERNEL.TransformedTriangle::testSegmentEdgeIntersection ( const TriSegment  seg,
const TetraEdge  edge 
) const [protected]

Tests if the given segment of the triangle intersects the given edge of the tetrahedron (Grandy, eq.

[20] If the OPTIMIZE is defined, it does not do the test the double product that should be zero.

Parameters:
segsegment of the triangle
edgeedge of tetrahedron
Returns:
true if the segment intersects the edge

References TestMedCorba5.c1, TestMedCorba5.c2, INTERP_KERNEL.TransformedTriangle.calcStableC(), INTERP_KERNEL.TransformedTriangle.DP_FOR_SEG_FACET_INTERSECTION, INTERP_KERNEL.TransformedTriangle.FACET_FOR_EDGE, INTERP_KERNEL.TransformedTriangle.SIGN_FOR_SEG_FACET_INTERSECTION, and INTERP_KERNEL.TransformedTriangle.testSegmentIntersectsFacet().

void INTERP_KERNEL.TransformedTriangle::calcIntersectionPtSegmentEdge ( const TriSegment  seg,
const TetraEdge  edge,
double pt 
) const [protected]

Calculates the point of intersection between the given segment of the triangle and the given edge of the tetrahedron.

(Grandy, eq. [25])

Precondition:
testSegmentEdgeIntersection(seg, edge) returns true
Parameters:
segsegment of the triangle
edgeedge of the tetrahedron
ptarray of three doubles in which to store the coordinates of the intersection point

References INTERP_KERNEL.TransformedTriangle.calcStableC(), INTERP_KERNEL.TransformedTriangle.DP_FOR_SEG_FACET_INTERSECTION, INTERP_KERNEL.TransformedTriangle.DP_INDEX, INTERP_KERNEL.TransformedTriangle.H01, INTERP_KERNEL.TransformedTriangle.OXY, INTERP_KERNEL.TransformedTriangle.OYZ, INTERP_KERNEL.TransformedTriangle.OZX, TestMedCorba7.s, INTERP_KERNEL.TransformedTriangle.SIGN_FOR_SEG_FACET_INTERSECTION, and INTERP_KERNEL.TransformedTriangle.XYZ.

bool INTERP_KERNEL.TransformedTriangle::testSegmentCornerIntersection ( const TriSegment  seg,
const TetraCorner  corner 
) const [protected]

Tests if the given segment of the triangle intersects the given corner of the tetrahedron.

(Grandy, eq. [21]). If OPTIMIZE is defined, the double products that should be zero are not verified.

Parameters:
segsegment of the triangle
cornercorner of the tetrahedron
Returns:
true if the segment intersects the corner

References INTERP_KERNEL.TransformedTriangle.OXY, INTERP_KERNEL.TransformedTriangle.OYZ, INTERP_KERNEL.TransformedTriangle.OZX, INTERP_KERNEL.TransformedTriangle.testSegmentIntersectsFacet(), and INTERP_KERNEL.TransformedTriangle.XYZ.

bool TransformedTriangle::testSurfaceRayIntersection ( const TetraCorner  corner) const [protected]
bool INTERP_KERNEL.TransformedTriangle::testSegmentHalfstripIntersection ( const TriSegment  seg,
const TetraEdge  edge 
) [protected]
void INTERP_KERNEL.TransformedTriangle::calcIntersectionPtSegmentHalfstrip ( const TriSegment  seg,
const TetraEdge  edge,
double pt 
) const [protected]

Calculates the point of intersection between the given segment of the triangle and the halfstrip above the given edge of the tetrahedron.

(Grandy, eq. [31])

Precondition:
testSegmentHalfstripIntersection(seg, edge) returns true
Parameters:
segsegment of the triangle
edgeedge of the tetrahedron defining the halfstrip
ptarray of three doubles in which to store the coordinates of the intersection point

References INTERP_KERNEL.TransformedTriangle.calcStableC(), INTERP_KERNEL.TransformedTriangle.COORDS_TET_CORNER, INTERP_KERNEL.TransformedTriangle.CORNERS_FOR_EDGE, INTERP_KERNEL.TransformedTriangle.DP_FOR_HALFSTRIP_INTERSECTION, INTERP_KERNEL.epsilonEqualRelative(), INTERP_KERNEL.TransformedTriangle.H01, LOG, and INTERP_KERNEL.TransformedTriangle.OZ.

bool INTERP_KERNEL.TransformedTriangle::testSegmentRayIntersection ( const TriSegment  seg,
const TetraCorner  corner 
) const [protected]

Tests if the given segment of triangle PQR intersects the ray pointing in the upwards z - direction from the given corner of the tetrahedron.

(Grandy eq. [29]) If OPTIMIZE is defined, the double product that should be zero is not verified.

Parameters:
segsegment of the triangle PQR
cornercorner of the tetrahedron on the h = 0 facet (X, Y, or Z)
Returns:
true if the upwards ray from the corner intersects the segment.

References INTERP_KERNEL.TransformedTriangle.calcStableC(), INTERP_KERNEL.TransformedTriangle.DP_SEGMENT_RAY_INTERSECTION, LOG, INTERP_KERNEL.TransformedTriangle.OYZ, INTERP_KERNEL.TransformedTriangle.OZX, INTERP_KERNEL.TransformedTriangle.testSegmentIntersectsFacet(), INTERP_KERNEL.TransformedTriangle.testSegmentIntersectsHPlane(), INTERP_KERNEL.TransformedTriangle.X, INTERP_KERNEL.TransformedTriangle.Y, and INTERP_KERNEL.TransformedTriangle.Z.

bool TransformedTriangle::testCornerInTetrahedron ( const TriCorner  corner) const [protected]
bool TransformedTriangle::testCornerOnXYZFacet ( const TriCorner  corner) const [protected]
bool TransformedTriangle::testCornerAboveXYZFacet ( const TriCorner  corner) const [protected]
bool INTERP_KERNEL.TransformedTriangle::testTriangleSurroundsEdge ( const TetraEdge  edge) const [protected]

Tests if the triangle PQR surrounds the axis on which the given edge of the tetrahedron lies.

Parameters:
edgeedge of tetrahedron
Returns:
true if PQR surrounds edge, false if not (see Grandy, eq. [53])

References INTERP_KERNEL.TransformedTriangle.calcStableC(), LOG, INTERP_KERNEL.TransformedTriangle.PQ, INTERP_KERNEL.TransformedTriangle.QR, and INTERP_KERNEL.TransformedTriangle.RP.

bool TransformedTriangle::testEdgeIntersectsTriangle ( const TetraEdge  edge) const [protected]
bool TransformedTriangle::testFacetSurroundsSegment ( const TriSegment  seg,
const TetraFacet  facet 
) const [protected]
bool TransformedTriangle::testSegmentIntersectsFacet ( const TriSegment  seg,
const TetraFacet  facet 
) const [protected]
bool TransformedTriangle::testSegmentIntersectsHPlane ( const TriSegment  seg) const [protected]
bool TransformedTriangle::testSurfaceAboveCorner ( const TetraCorner  corner) const [protected]
bool TransformedTriangle::testTriangleSurroundsRay ( const TetraCorner  corner) const [protected]
void INTERP_KERNEL.TransformedTriangle::resetNearZeroCoordinates ( ) [protected]
bool INTERP_KERNEL.TransformedTriangle::areDoubleProductsConsistent ( const TriSegment  seg) const [protected]

Checks if the double products for a given segment are consistent, as defined by Grandy, [46].

Parameters:
segSegment for which to check consistency of double products
Returns:
true if the double products are consistent, false if not

References INTERP_KERNEL.TransformedTriangle._doubleProducts, INTERP_KERNEL.TransformedTriangle.C_XH, INTERP_KERNEL.TransformedTriangle.C_XY, INTERP_KERNEL.TransformedTriangle.C_YH, INTERP_KERNEL.TransformedTriangle.C_YZ, INTERP_KERNEL.TransformedTriangle.C_ZH, INTERP_KERNEL.TransformedTriangle.C_ZX, and LOG.

void INTERP_KERNEL.TransformedTriangle::preCalculateDoubleProducts ( void  ) [protected]
void TransformedTriangle::resetDoubleProducts ( const TriSegment  seg,
const TetraCorner  corner 
) [protected]
double INTERP_KERNEL.TransformedTriangle::calculateDistanceCornerSegment ( const TetraCorner  corner,
const TriSegment  seg 
) const [protected]

Calculate the shortest distance between a tetrahedron corner and a triangle segment.

Parameters:
cornercorner of the tetrahedron
segsegment of the triangle
Returns:
shortest distance from the corner to the segment

References INTERP_KERNEL.TransformedTriangle._coords, INTERP_KERNEL.TransformedTriangle.COORDS_TET_CORNER, INTERP_KERNEL.cross(), and INTERP_KERNEL.dot().

void INTERP_KERNEL.TransformedTriangle::preCalculateTripleProducts ( void  ) [protected]
double INTERP_KERNEL.TransformedTriangle::calculateAngleEdgeTriangle ( const TetraEdge  edge) const [protected]

Calculates the angle between an edge of the tetrahedron and the triangle.

Parameters:
edgeedge of the tetrahedron
Returns:
angle between triangle and edge

References INTERP_KERNEL.TransformedTriangle._coords, INTERP_KERNEL.cross(), INTERP_KERNEL.dot(), INTERP_KERNEL.norm(), med_test1.normal, INTERP_KERNEL.TransformedTriangle.P, INTERP_KERNEL.TransformedTriangle.Q, and INTERP_KERNEL.TransformedTriangle.R.

double TransformedTriangle::calcStableC ( const TriSegment  seg,
const DoubleProduct  dp 
) const [protected]
double TransformedTriangle::calcStableT ( const TetraCorner  corner) const [protected]
double TransformedTriangle::calcUnstableC ( const TriSegment  seg,
const DoubleProduct  dp 
) const [protected]
double INTERP_KERNEL.TransformedTriangle::calcTByDevelopingRow ( const TetraCorner  corner,
const int  row = 1,
const bool  project = false 
) const [protected]

Calculates triple product associated with the given corner of tetrahedron, developing the determinant by the given row.

The triple product gives the signed volume of the tetrahedron between this corner and the triangle PQR. If the flag project is true, one coordinate is projected out in order to eliminate errors in the intersection point calculation due to cancellation.

Precondition:
double products have already been calculated
Parameters:
cornercorner for which the triple product is calculated
rowrow (1 <= row <= 3) used to calculate the determinant
projectindicates whether or not to perform projection as inidicated in Grandy, p.446
Returns:
triple product associated with corner (see Grandy, [50]-[52])

References INTERP_KERNEL.TransformedTriangle._coords, INTERP_KERNEL.TransformedTriangle.calcStableC(), INTERP_KERNEL.TransformedTriangle.COORDINATE_FOR_DETERMINANT_EXPANSION, INTERP_KERNEL.dot(), INTERP_KERNEL.TransformedTriangle.DP_FOR_DETERMINANT_EXPANSION, INTERP_KERNEL.epsilonEqual(), LOG, INTERP_KERNEL.TransformedTriangle.MULT_PREC_F, INTERP_KERNEL.TransformedTriangle.P, INTERP_KERNEL.TransformedTriangle.PQ, INTERP_KERNEL.TransformedTriangle.Q, INTERP_KERNEL.TransformedTriangle.QR, INTERP_KERNEL.TransformedTriangle.R, INTERP_KERNEL.TransformedTriangle.RP, and INTERP_KERNEL.TransformedTriangle.THRESHOLD_F.

void TransformedTriangle::preCalculateTriangleSurroundsEdge ( ) [protected]

Calls TransformedTriangle.testTriangleSurroundsEdge for edges OX to ZX and stores the result in member variable array_triangleSurroundsEdgeCache.


Friends And Related Function Documentation

friend class INTERP_TEST::TransformedTriangleTest [friend]

Field Documentation

Array holding the coordinates of the triangle's three corners order : [ p_x, p_y, p_z, p_h, p_H, q_x, q_y, q_z, q_h, q_H, r_x, r_y, r_z, r_h, r_H ].

Flag showing whether the double products have been calculated yet.

Flag showing whether the triple products have been calculated yet.

Array containing the 24 double products.

order : c^PQ_YZ, ... ,cPQ_10, ... c^QR_YZ, ... c^RP_YZ following order in enumeration DoubleProduct

Array containing the 4 triple products.

order : t_O, t_X, t_Y, t_Z

Vector holding the points of the intersection polygon A.

these points are allocated in calculateIntersectionPolygons() and liberated in the destructor

Vector holding the points of the intersection polygon B.

These points are allocated in calculateIntersectionPolygons() and liberated in the destructor

Array holding the coordinates of the barycenter of the polygon A This point is calculated in calculatePolygonBarycenter.

Array holding the coordinates of the barycenter of the polygon B This point is calculated in calculatePolygonBarycenter.

Array of flags indicating which of the four triple products have been correctly calculated. Used for asserts in debug mode

calculated volume for use of UnitTetraIntersectionBary

Array holding results of the test testTriangleSurroundsEdge() for all the edges.

These are calculated in preCalculateTriangleSurroundsEdge().

const int INTERP_KERNEL.TransformedTriangle::DP_OFFSET_1 = {1, 2, 0, 2, 0, 1, 4, 1} [static, protected]

Table with first coordinate (a) used to calculate double product c^pq_ab = p_a * q_b - p_b * q_a (index to be used : DoubleProduct)

const int INTERP_KERNEL.TransformedTriangle::DP_OFFSET_2 = {2, 0, 1, 3, 3, 3, 0, 4} [static, protected]

Table with second coordinate (b) used to calculate double product c^pq_ab = p_a * q_b - p_b * q_a (index to be used : DoubleProduct)

Initial value:
    {
      
      0, 1, 2, 
      3, 1, 2, 
      0, 3, 2, 
      0, 1, 3  
    }

Coordinates used to calculate triple products by the expanding one of the three rows of the determinant (index to be used : 3*Corner + row)

Initial value:
 
    {
      
      C_YZ, C_ZX, C_XY, 
      C_YZ, C_ZH, C_YH, 
      C_ZH, C_ZX, C_XH, 
      C_YH, C_XH, C_XY  
    }

Double products used to calculate triple products by expanding one of the three rows of the determinant (index to be used : 3*Corner + row)

const long double INTERP_KERNEL.TransformedTriangle::MACH_EPS = std::numeric_limits<double>::epsilon() [static, protected]

The machine epsilon, used in precision corrections.

4.0 * the machine epsilon, represents the precision of multiplication when performing corrections corrections ( f in Grandy )

const long double INTERP_KERNEL.TransformedTriangle::THRESHOLD_F = 500.0 [static, protected]

Threshold for resetting double and triple products to zero; ( F / f in Grandy )

Threshold for what is considered a small enough angle to warrant correction of triple products by Grandy, [57].

Initial value:
 
    {
      C_XH, C_XY, C_ZX, 
      C_YH, C_YZ, C_XY, 
      C_ZH, C_ZX, C_YZ, 
      C_XH, C_YH, C_ZH  
    }

Correspondance between facets and double products.

This table encodes Grandy, table IV. Use 3*facet + {0,1,2} as index

Initial value:
 
    {
      1.0, 1.0, -1.0,
      1.0, 1.0, -1.0,
      1.0, 1.0, -1.0,
      1.0, 1.0,  1.0
    }

Signs associated with entries in DP_FOR_SEGMENT_FACET_INTERSECTION.

This table encodes Grandy, table IV. Use 3*facet + {0,1,2} as index

Initial value:
 
    {
      0.0, 0.0, 0.0,
      1.0, 0.0, 0.0,
      0.0, 1.0, 0.0,
      0.0, 0.0, 1.0
    }

Coordinates of corners of tetrahedron.

Use 3*Corner + coordinate as index

Initial value:
    {
      
      -1, 1, 2,  
      5, -1, 4,  
      7, 8, -1,  
      9, 10, 11  
    }

Indices to use in tables DP_FOR_SEG_FACET_INTERSECTION and SIGN_FOR_SEG_FACET_INTERSECTION for the calculation of the coordinates (x,y,z) of the intersection points for Segment-Facet and Segment-Edge intersections.

Use 3*facet + coordinate as index. -1 indicates that the coordinate is 0.

Initial value:
 
    {
      O, X, 
      O, Y, 
      O, Z, 
      X, Y, 
      Y, Z, 
      Z, X  
    }

Correspondance edge - corners.

Gives the two corners associated with each edge Use 2*edge + {0, 1} as index

Initial value:
    {
      OXY, OZX, 
      OXY, OYZ, 
      OZX, OYZ, 
      OXY, XYZ, 
      OYZ, XYZ, 
      OZX, XYZ  
    }

Correspondance edge - facets.

Gives the two facets shared by and edge. Use 2*facet + {0, 1} as index

Initial value:
    {
      OX, OY, OZ, 
      OX, XY, ZX, 
      OY, XY, YZ, 
      OZ, ZX, YZ  
    }

Correspondance corners - edges.

Gives edges meeting at a given corner. Use 3*corner + {0,1,2} as index

Initial value:
    {
      C_10, C_01, C_ZH, C_10, 
      C_01, C_XY, C_XH, C_01, 
      C_XY, C_10, C_YH, C_XY  
    }

Double products to use in halfstrip intersection tests.

Use 4*(offset_edge) + {0,1,2,3} as index. offset_edge = edge - 3 (so that XY -> 0, YZ -> 1, ZX -> 2) Entries with offset 0 and 1 are for the first condition (positive product) and those with offset 2 and 3 are for the second condition (negative product).

Initial value:

Double products to use in segment-ray test.

Use 7*corner_offset + {0,1,2,3,4,5,6} as index. corner_offset = corner - 1 (so that X -> 0, Y-> 1, Z->2) Entries with offset 0 are for first condition (zero double product) and the rest are for condition 3 (in the same order as in the article)

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS