Commit f6ae4ecb authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

changed the formula for the calculation of triangle area to match what we use in TNL

parent 05ca96c6
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -67,11 +67,18 @@ double getEntityMeasure(const Interface* mb, const EntityHandle handle)
            coords[2][i] -= coords[0][i];
        }

#if 0
        // formula from http://math.stackexchange.com/a/128999
        const double c1 = coords[1][1] * coords[2][2] - coords[1][2] * coords[2][1];   // first component of the cross product
        const double c2 = coords[1][2] * coords[2][0] - coords[1][0] * coords[2][2];   // second component of the cross product
        const double c3 = coords[1][0] * coords[2][1] - coords[1][1] * coords[2][0];   // third component of the cross product
        return 0.5 * std::sqrt( c1 * c1 + c2 * c2 + c3 * c3 );
#endif
        // formula for 2D triangles
        // NOTE: MOAB does not indicate if the triangle is 2D or 3D, so in general we should use the
        //       general formula - but TNL can differentiate between 2D and 3D triangles, so we
        //       benchmark the same algorithm as used in TNL
        return 0.5 * std::abs( coords[1][0] * coords[2][1] - coords[1][1] * coords[2][0] );
    }
    if( entity_type == MBTET )
    {