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>

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 double * | getCorner (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 |
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.
Reference : J. Grandy, "Conservative Remapping and Region Overlays by Intersecting Arbitrary Polyhedra", Journal of Computational Physics (1999)
Constructor.
The coordinates are copied to the internal member variables
| p | array of three doubles containing coordinates of P |
| q | array of three doubles containing coordinates of Q |
| r | array 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] |
| double INTERP_KERNEL.TransformedTriangle::calculateIntersectionVolume | ( | ) |
Calculates the volume of intersection between the triangle and the unit tetrahedron.
References INTERP_KERNEL.TransformedTriangle._polygonA, INTERP_KERNEL.TransformedTriangle._polygonB, INTERP_KERNEL.TransformedTriangle._volume, INTERP_KERNEL.TransformedTriangle.A, INTERP_KERNEL.TransformedTriangle.B, med_test1.barycenter, INTERP_KERNEL.TransformedTriangle.calculateIntersectionPolygons(), INTERP_KERNEL.TransformedTriangle.calculatePolygonBarycenter(), INTERP_KERNEL.TransformedTriangle.calculateVolumeUnderPolygon(), INTERP_KERNEL.TransformedTriangle.isTriangleBelowTetraeder(), INTERP_KERNEL.TransformedTriangle.isTriangleInclinedToFacet(), INTERP_KERNEL.TransformedTriangle.isTriangleInPlaneOfFacet(), LOG, INTERP_KERNEL.TransformedTriangle.OXY, INTERP_KERNEL.TransformedTriangle.sortIntersectionPolygon(), and INTERP_KERNEL.TransformedTriangle.XYZ.
| 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 std::vector<double*>& INTERP_KERNEL.TransformedTriangle.getPolygonA | ( | ) | const |
| double INTERP_KERNEL.TransformedTriangle.getVolume | ( | ) | const |
Reimplemented in INTERP_KERNEL.UnitTetraIntersectionBary.
| 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.
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.
| poly | one of the two intersection polygons |
| barycenter | array 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.
| poly | one of the two intersection polygons |
| barycenter | array 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.
| poly | one of the two intersection polygons |
| barycenter | array of three doubles with the coordinates of the barycenter |
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.
| facet | one of the facets of the tetrahedron |
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.
| facet | one of the facets of the unit tetrahedron |
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.
| facet | one of the facets of the unit tetrahedron |
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.
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])
| edge | edge of tetrahedron |
| pt | array 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])
| seg | segment of the triangle |
| facet | facet of the tetrahedron |
| pt | array 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.
| seg | segment of the triangle |
| edge | edge of tetrahedron |
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])
| seg | segment of the triangle |
| edge | edge of the tetrahedron |
| pt | array 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.
| seg | segment of the triangle |
| corner | corner of the tetrahedron |
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] |
Tests if the given segment of the triangle intersects the half-strip above the given edge of the h = 0 plane.
(Grandy, eq. [30])
| seg | segment of the triangle |
| edge | edge of the h = 0 plane of the tetrahedron (XY, YZ, ZX) |
References INTERP_KERNEL.TransformedTriangle.C_01, INTERP_KERNEL.TransformedTriangle.C_10, INTERP_KERNEL.TransformedTriangle.C_XH, INTERP_KERNEL.TransformedTriangle.C_XY, INTERP_KERNEL.TransformedTriangle.C_YH, INTERP_KERNEL.TransformedTriangle.C_ZH, INTERP_KERNEL.TransformedTriangle.calcStableC(), INTERP_KERNEL.TransformedTriangle.DP_FOR_HALFSTRIP_INTERSECTION, LOG, INTERP_KERNEL.TransformedTriangle.NO_TET_FACET, INTERP_KERNEL.TransformedTriangle.OYZ, INTERP_KERNEL.TransformedTriangle.OZX, INTERP_KERNEL.TransformedTriangle.testSegmentIntersectsFacet(), and INTERP_KERNEL.TransformedTriangle.testSegmentIntersectsHPlane().
| 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])
| seg | segment of the triangle |
| edge | edge of the tetrahedron defining the halfstrip |
| pt | array 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.
| seg | segment of the triangle PQR |
| corner | corner of the tetrahedron on the h = 0 facet (X, Y, or Z) |
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.
| edge | edge of tetrahedron |
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].
| seg | Segment for which to check consistency of double products |
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] |
Pre-calculates all double products for this triangle, and stores them internally.
This method makes compensation for precision errors, and it is thus the "stable" double products that are stored.
References INTERP_KERNEL.TransformedTriangle._coords, INTERP_KERNEL.TransformedTriangle._doubleProducts, INTERP_KERNEL.TransformedTriangle._is_double_products_calculated, INTERP_KERNEL.TransformedTriangle.areDoubleProductsConsistent(), INTERP_KERNEL.TransformedTriangle.C_10, INTERP_KERNEL.TransformedTriangle.C_YZ, INTERP_KERNEL.TransformedTriangle.calculateDistanceCornerSegment(), INTERP_KERNEL.TransformedTriangle.calcUnstableC(), INTERP_KERNEL.TransformedTriangle.DP_OFFSET_1, INTERP_KERNEL.TransformedTriangle.DP_OFFSET_2, INTERP_KERNEL.epsilonEqual(), LOG, INTERP_KERNEL.TransformedTriangle.MULT_PREC_F, INTERP_KERNEL.TransformedTriangle.O, INTERP_KERNEL.TransformedTriangle.PQ, INTERP_KERNEL.TransformedTriangle.resetDoubleProducts(), INTERP_KERNEL.TransformedTriangle.RP, INTERP_KERNEL.TransformedTriangle.THRESHOLD_F, and INTERP_KERNEL.TransformedTriangle.Z.
| 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.
| corner | corner of the tetrahedron |
| seg | segment of the triangle |
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] |
Pre-calculates all triple products for the tetrahedron with respect to this triangle, and stores them internally.
This method takes into account the problem of errors due to cancellation.
References INTERP_KERNEL.TransformedTriangle._is_triple_products_calculated, INTERP_KERNEL.TransformedTriangle._triangleSurroundsEdgeCache, INTERP_KERNEL.TransformedTriangle._tripleProducts, INTERP_KERNEL.TransformedTriangle._validTP, INTERP_KERNEL.angle(), INTERP_KERNEL.TransformedTriangle.calcTByDevelopingRow(), INTERP_KERNEL.TransformedTriangle.calculateAngleEdgeTriangle(), INTERP_KERNEL.TransformedTriangle.DP_FOR_DETERMINANT_EXPANSION, LOG, INTERP_KERNEL.TransformedTriangle.O, INTERP_KERNEL.TransformedTriangle.TRIPLE_PRODUCT_ANGLE_THRESHOLD, and INTERP_KERNEL.TransformedTriangle.Z.
| double INTERP_KERNEL.TransformedTriangle::calculateAngleEdgeTriangle | ( | const TetraEdge | edge | ) | const [protected] |
Calculates the angle between an edge of the tetrahedron and the triangle.
| edge | edge of the tetrahedron |
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.
| corner | corner for which the triple product is calculated |
| row | row (1 <= row <= 3) used to calculate the determinant |
| project | indicates whether or not to perform projection as inidicated in Grandy, p.446 |
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.
friend class INTERP_TEST::TransformedTriangleTest [friend] |
friend class INTERP_TEST::TransformedTriangleIntersectTest [friend] |
double INTERP_KERNEL.TransformedTriangle._coords[15] [protected] |
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 INTERP_KERNEL.TransformedTriangle._is_double_products_calculated [protected] |
Flag showing whether the double products have been calculated yet.
bool INTERP_KERNEL.TransformedTriangle._is_triple_products_calculated [protected] |
Flag showing whether the triple products have been calculated yet.
double INTERP_KERNEL.TransformedTriangle._doubleProducts[24] [protected] |
Array containing the 24 double products.
order : c^PQ_YZ, ... ,cPQ_10, ... c^QR_YZ, ... c^RP_YZ following order in enumeration DoubleProduct
double INTERP_KERNEL.TransformedTriangle._tripleProducts[4] [protected] |
Array containing the 4 triple products.
order : t_O, t_X, t_Y, t_Z
std::vector<double*> INTERP_KERNEL.TransformedTriangle._polygonA [protected] |
Vector holding the points of the intersection polygon A.
these points are allocated in calculateIntersectionPolygons() and liberated in the destructor
std::vector<double*> INTERP_KERNEL.TransformedTriangle._polygonB [protected] |
Vector holding the points of the intersection polygon B.
These points are allocated in calculateIntersectionPolygons() and liberated in the destructor
double INTERP_KERNEL.TransformedTriangle._barycenterA[3] [protected] |
Array holding the coordinates of the barycenter of the polygon A This point is calculated in calculatePolygonBarycenter.
bool INTERP_KERNEL.TransformedTriangle._validTP[4] [protected] |
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
double INTERP_KERNEL.TransformedTriangle._volume [protected] |
calculated volume for use of UnitTetraIntersectionBary
bool INTERP_KERNEL.TransformedTriangle._triangleSurroundsEdgeCache[NO_TET_EDGE] [protected] |
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)
const int INTERP_KERNEL.TransformedTriangle::COORDINATE_FOR_DETERMINANT_EXPANSION [static, protected] |
{
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)
const TransformedTriangle::DoubleProduct INTERP_KERNEL.TransformedTriangle::DP_FOR_DETERMINANT_EXPANSION [static, protected] |
const long double INTERP_KERNEL.TransformedTriangle::MACH_EPS = std::numeric_limits<double>::epsilon() [static, protected] |
The machine epsilon, used in precision corrections.
const long double INTERP_KERNEL.TransformedTriangle::MULT_PREC_F = 4.0 * TransformedTriangle::MACH_EPS [static, protected] |
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 )
const double INTERP_KERNEL.TransformedTriangle::TRIPLE_PRODUCT_ANGLE_THRESHOLD = 0.1 [static, protected] |
Threshold for what is considered a small enough angle to warrant correction of triple products by Grandy, [57].
const TransformedTriangle::DoubleProduct INTERP_KERNEL.TransformedTriangle::DP_FOR_SEG_FACET_INTERSECTION [static, protected] |
const double INTERP_KERNEL.TransformedTriangle::SIGN_FOR_SEG_FACET_INTERSECTION [static, protected] |
{
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
const double INTERP_KERNEL.TransformedTriangle::COORDS_TET_CORNER [static, protected] |
{
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
const int INTERP_KERNEL.TransformedTriangle::DP_INDEX [static, protected] |
{
-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.
const TransformedTriangle::TetraCorner INTERP_KERNEL.TransformedTriangle::CORNERS_FOR_EDGE [static, protected] |
const TransformedTriangle::TetraFacet INTERP_KERNEL.TransformedTriangle::FACET_FOR_EDGE [static, protected] |
const TransformedTriangle::TetraEdge INTERP_KERNEL.TransformedTriangle::EDGES_FOR_CORNER [static, protected] |
const TransformedTriangle::DoubleProduct INTERP_KERNEL.TransformedTriangle::DP_FOR_HALFSTRIP_INTERSECTION [static, protected] |
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).
const TransformedTriangle::DoubleProduct INTERP_KERNEL.TransformedTriangle::DP_SEGMENT_RAY_INTERSECTION [static, protected] |
{
C_10, C_YH, C_ZH, C_01, C_XY, C_YH, C_XY,
C_01, C_XH, C_ZH, C_XY, C_10, C_ZH, C_10,
C_XY, C_YH, C_XH, C_10, C_01, C_XH, C_01
}
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)