30    template<
typename Real>
 
   33        typedef typename ::dyno::Vector<Real, 3> Coord3D;
 
   45        if (d2 >= R2) 
return Real(0);
 
   56        for (
uint j = 0; j < 3; j++)
 
   58            if ((triangle.
v[j] - center.
origin).norm() <= r)
 
   66            return triangle.
area();
 
   73            for (
uint j = 0; j < 3; j++)
 
   75                if ((triangle.
v[j] - center.
origin).norm() > r)
 
   82            Coord3D v0 = triangle.
v[outsideId];
 
   83            Coord3D v1 = triangle.
v[(outsideId + 1) % 3];
 
   84            Coord3D v2 = triangle.
v[(outsideId + 2) % 3];
 
   86            Coord3D dir01 = v1 - v0;    dir01.normalize();
 
   87            Coord3D dir02 = v2 - v0;    dir02.normalize();
 
   98            Coord3D s1 = p1.
origin - l1 * dir01;
 
   99            Coord3D s2 = p2.
origin - l2 * dir02;
 
  105            Real d10 = 0.5 * (s1 - s2).norm();
 
  107            Real secArea = angle * r * r - d1 * d10;
 
  119            for (
uint j = 0; j < 3; j++)
 
  121                if ((triangle.
v[j] - center.
origin).norm() <= r)
 
  128            Coord3D v0 = triangle.
v[insideId];
 
  129            Coord3D v1 = triangle.
v[(insideId + 1) % 3];
 
  130            Coord3D v2 = triangle.
v[(insideId + 2) % 3];
 
  133            Coord3D dir01 = v1 - v0;    dir01.normalize();
 
  134            Coord3D dir02 = v2 - v0;    dir02.normalize();
 
  135            Coord3D dir12 = v2 - v1;    dir12.normalize();
 
  149            Coord3D s1 = p1.
origin + l1 * dir01;
 
  150            Coord3D s2 = p2.
origin + l2 * dir02;
 
  160                Coord3D s10 = p0.
origin - l * dir12;
 
  161                Coord3D s20 = p0.
origin + l * dir12;
 
  167                Real d20 = 0.5 * (s2 - s20).norm();
 
  169                Real secArea2 = angle2 * r * r - d2 * d20;
 
  172                Real d10 = 0.5 * (s1 - s10).norm();
 
  174                Real secArea1 = angle1 * r * r - d1 * d10;
 
  176                ret += secArea1 + secArea2;
 
  184                Real d12 = 0.5 * (s1 - s2).norm();
 
  188                bool opposite = (v0 - s1).
dot(center.
origin - s1) < 0;
 
  191                Real secArea = opposite ? (
M_PI - angle) * r * r : angle * r * r;
 
  194                secArea += opposite ? d0 * d12 : -d0 * d12;
 
  204        Real ret = circleArea;
 
  205        for (
int j = 0; j < 3; j++)
 
  207            Coord3D v0 = triangle.
v[j];
 
  208            Coord3D v1 = triangle.
v[(j + 1) % 3];
 
  209            Coord3D v2 = triangle.
v[(j + 2) % 3];
 
  225                secArea = opposite ? (
M_PI - angle) * r * r : angle * r * r;
 
  228                secArea += opposite ? d0 * d1 : -d0 * d1;
 
 
2D geometric primitives in three-dimensional space
 
0D geometric primitive in three-dimensional space
 
DYN_FUNC Real distanceSquared(const TPoint3D< Real > &pt) const
 
DYN_FUNC TPoint3D< Real > project(const TLine3D< Real > &line) const
project a point onto linear components – lines, rays and segments
 
DYN_FUNC Real distance(const TPoint3D< Real > &pt) const
 
DYN_FUNC Real area() const
 
DYN_FUNC Coord3D normal() const
 
This is an implementation of AdditiveCCD based on peridyno.
 
DYN_FUNC T dot(Vector< T, 2 > const &U, Vector< T, 2 > const &V)
 
DYN_FUNC T abs(const T &v)
 
TTriangle3D< double > Triangle3D
 
DYN_FUNC Real calculateIntersectionArea(const TPoint3D< Real > &pt, const TTriangle3D< Real > &triangle, const Real &R)
Calculate the intersection area between a sphere and a triangle by using the domain decompsotion algo...
 
TPoint3D< double > Point3D
 
DYN_FUNC Complex< Real > sqrt(const Complex< Real > &)
 
DYN_FUNC T maximum(const T &v0, const T &v1)
 
TSegment3D< double > Segment3D
 
DYN_FUNC Complex< Real > asin(const Complex< Real > &)