- // three points checking
- gp_Pnt aFirstPnt = aCurve->Value(aFirst);
- gp_Pnt aMidPnt = aCurve->Value((aFirst + aLast) / 2.);
- gp_Pnt aLastPnt = aCurve->Value(aLast);
- inPlane = aPlane.SquareDistance(aFirstPnt) < Precision::SquareConfusion() &&
- aPlane.SquareDistance(aMidPnt) < Precision::SquareConfusion() &&
- aPlane.SquareDistance(aLastPnt) < Precision::SquareConfusion();
+ Handle(Geom_Circle) aCirc = circ(aCurve);
+ if (!aCirc.IsNull()) {
+ gp_Pnt aCenter = aCirc->Location();
+ Standard_Real aDot = aPlane.Axis().Direction().Dot(aCirc->Axis().Direction());
+ inPlane = aPlane.SquareDistance(aCenter) < Precision::SquareConfusion() &&
+ Abs(Abs(aDot) - 1.0) < Precision::Confusion();
+ } else {
+ // three points checking
+ gp_Pnt aFirstPnt = aCurve->Value(aFirst);
+ gp_Pnt aMidPnt = aCurve->Value((aFirst + aLast) / 2.);
+ gp_Pnt aLastPnt = aCurve->Value(aLast);
+ inPlane = aPlane.SquareDistance(aFirstPnt) < Precision::SquareConfusion() &&
+ aPlane.SquareDistance(aMidPnt) < Precision::SquareConfusion() &&
+ aPlane.SquareDistance(aLastPnt) < Precision::SquareConfusion();
+ }