31#if defined(SphericalTriangle_RECURSES) 
   32#error Recursive header files inclusion detected in SphericalTriangle.h 
   35#define SphericalTriangle_RECURSES
 
   37#if !defined SphericalTriangle_h 
   39#define SphericalTriangle_h 
   45#include "DGtal/base/Common.h" 
   60  template <
typename TSpace>
 
   83                       bool normalize = 
true )
 
   85      setA( va, normalize );
 
   86      setB( vb, normalize );
 
   87      setC( vc, normalize );
 
 
  121          if ( fabs( n ) > 1e-8 ) 
myA /= n;
 
 
  137          if ( fabs( n ) > 1e-8 ) 
myB /= n;
 
 
  152          if ( fabs( n ) > 1e-8 ) 
myC /= n;
 
 
  164      if ( ( d[ 0 ] < 1e-8 ) || ( d[ 1 ] < 1e-8 ) || ( d[ 2 ] < 1e-8 ) )
 
  168      if ( d[ 1 ] > d[ m ] ) m = 1;
 
  169      if ( d[ 2 ] > d[ m ] ) m = 2;
 
  170      return ( fabs( d[ m ] - d[ (m+1)%3 ] - d[ (m+2)%3 ] ) < 1e-8 );
 
 
  180      if ( Ap.dot( 
myA ) < 0.0 ) Ap = -Ap;
 
  181      if ( Bp.dot( 
myB ) < 0.0 ) Bp = -Bp;
 
  182      if ( Cp.dot( 
myC ) < 0.0 ) Cp = -Cp;
 
  183      return Self( Ap, Bp, Cp, 
true );
 
 
  194        alpha = beta = gamma = 0.0;
 
  197          Scalar ca = std::max( -1.0, std::min( 1.0, T.
B().
dot( T.
C() ) ) );
 
  198          Scalar cb = std::max( -1.0, std::min( 1.0, T.
C().
dot( T.
A() ) ) );
 
  199          Scalar cc = std::max( -1.0, std::min( 1.0, T.
A().
dot( T.
B() ) ) );
 
 
  209      Scalar alpha, beta, gamma;
 
  212      return ( (alpha == 0.0) || (beta == 0.0) || (gamma == 0.0) )
 
  213               ? 0.0 : 2.0*M_PI - alpha - beta - gamma;
 
 
  222      if ( M.
norm1() <= 1e-8 || X.
norm1() <= 1e-8 ) 
return 0.0;
 
  223      return M.
dot( X ) < 0.0 ? -S : S;
 
 
 
  254#undef SphericalTriangle_RECURSES 
Aim: Implements basic operations that will be used in Point and Vector classes.
 
UnsignedComponent norm1() const
 
auto dot(const PointVector< dim, OtherComponent, OtherStorage > &v) const -> decltype(DGtal::dotProduct(*this, v))
Dot product with a PointVector.
 
double norm(const NormType type=L_2) const
 
auto crossProduct(const PointVector< dim, OtherComponent, OtherStorage > &v) const -> decltype(DGtal::crossProduct(*this, v))
Cross product with a PointVector.
 
TEuclideanRing Component
Type for Vector elements.
 
static Self zero
Static const for zero PointVector.
 
static const Dimension dimension
static constants to store the dimension.
 
Aim: Represent a triangle drawn onto a sphere of radius 1.
 
SphericalTriangle< Space > Self
 
RealVector::Component Scalar
 
BOOST_STATIC_ASSERT((Space::dimension==3))
 
bool isDegenerate() const
 
Space::RealPoint RealPoint
 
RealVector myC
The point C of the triangle ABC, of unit length.
 
SphericalTriangle & operator=(const SphericalTriangle &other)=default
 
void setC(const RealVector &vc, bool normalize=true)
 
SphericalTriangle(const RealVector &va, const RealVector &vb, const RealVector &vc, bool normalize=true)
Default constructor. The object is invalid.
 
void interiorAngles(Scalar &alpha, Scalar &beta, Scalar &gamma) const
 
Scalar algebraicArea() const
 
Space::RealVector RealVector
 
RealVector myA
The point A of the triangle ABC, of unit length.
 
const RealVector & C() const
 
const RealVector & B() const
 
Self polarTriangle() const
 
const RealVector & A() const
 
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
 
void setB(const RealVector &vb, bool normalize=true)
 
SphericalTriangle(const SphericalTriangle &other)=default
 
RealVector myB
The point B of the triangle ABC, of unit length.
 
void setA(const RealVector &va, bool normalize=true)
 
DGtal is the top-level namespace which contains all DGtal functions and types.
 
auto crossProduct(PointVector< 3, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< 3, RightEuclideanRing, RightContainer > const &rhs) -> decltype(DGtal::constructFromArithmeticConversion(lhs, rhs))
Cross product of two 3D Points/Vectors.
 
DGtal::uint32_t Dimension
 
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.