_cross=
((*(_e2.getStartNode()))[0]-center[0])*((*(_e2.getEndNode()))[1]-center[1])-
((*(_e2.getStartNode()))[1]-center[1])*((*(_e2.getEndNode()))[0]-center[0]);
- _determinant=getE1().getRadius()*getE1().getRadius()/_drSq-_cross*_cross/(_drSq*_drSq);
- if(_determinant>-2*QuadraticPlanarPrecision::getPrecision())//QuadraticPlanarPrecision::getPrecision()*QuadraticPlanarPrecision::getPrecision()*_drSq*_drSq/(2.*_dx*_dx))
+ _determinant = (getE1().getRadius()*getE1().getRadius()-_cross*_cross/_drSq) / _drSq;
+ if(_determinant > -2*QuadraticPlanarPrecision::getPrecision())//QuadraticPlanarPrecision::getPrecision()*QuadraticPlanarPrecision::getPrecision()*_drSq*_drSq/(2.*_dx*_dx))
obviousNoIntersection=false;
else
obviousNoIntersection=true;
double _dist;
};
+ /**
+ * Cross-type intersector: edge1 is the arc of circle, edge2 is the segment.
+ */
class INTERPKERNEL_EXPORT ArcCSegIntersector : public CrossTypeEdgeIntersector
{
public:
const EdgeArcCircle& getE1() const { return (const EdgeArcCircle&)_e1; }
const EdgeLin& getE2() const { return (const EdgeLin&)_e2; }
private:
- double _dx;
- double _dy;
- double _drSq;
- double _cross;
- double _determinant;
+ double _dx; //!< X extent of the segment
+ double _dy; //!< Y extent of the segment
+ double _drSq; //!< Square of the norm of the seg
+ double _cross; //!< See areOverlappedOrOnlyColinears()
+ double _determinant; //!< See areOverlappedOrOnlyColinears()
};
class INTERPKERNEL_EXPORT EdgeArcCircle : public Edge
*/
bool SegSegIntersector::areColinears() const
{
+ Bounds b;
+ b.prepareForAggregation();
+ b.aggregate(_e1.getBounds());
+ b.aggregate(_e2.getBounds());
double determinant=_matrix[0]*_matrix[3]-_matrix[1]*_matrix[2];
- return fabs(determinant)<QuadraticPlanarArcDetectionPrecision::getArcDetectionPrecision();
+ double dimChar=b.getCaracteristicDim();
+
+ return fabs(determinant)< dimChar*QuadraticPlanarArcDetectionPrecision::getArcDetectionPrecision(); // TODO [ABN]: should be QuadraticPlanarPrecision::getPrecision() ...
}
/*!