-// Copyright (C) 2014-2020 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
if (aProjectedCurve->isCircle()) {
if (aProjectedCurve->isTrimmed()) {
// ARC is a projection
- isOk = fillArc(theProjection, aProjectedCurve, aSketchPlane);
+ isOk = fillArc(theProjection, aProjectedCurve, aSketchPlane, theEdge);
}
else {
// CIRCLE is a projection
else if (aProjectedCurve->isEllipse()) {
if (aProjectedCurve->isTrimmed()) {
// ELLIPTIC ARC is a projection
- isOk = fillEllipticArc(theProjection, aProjectedCurve, aSketchPlane);
+ isOk = fillEllipticArc(theProjection, aProjectedCurve, aSketchPlane, theEdge);
}
else {
// ELLIPSE is a projection
bool SketchPlugin_Projection::fillArc(FeaturePtr& theProjection,
const GeomCurvePtr& theArc,
- const GeomPlanePtr& thePlane)
+ const GeomPlanePtr& thePlane,
+ const GeomEdgePtr& theOriginalEdge)
{
rebuildProjectedFeature(theProjection, ARC_PROJECTION(), SketchPlugin_Arc::ID());
bool isInversed = aNormalsDot < 0.;
+ GeomCirclePtr anOriginalCircle = theOriginalEdge->circle();
+ if (anOriginalCircle) {
+ double aCirclesDot = anOriginalCircle->normal()->dot(aCircle.normal());
+ if (aCirclesDot < 0.)
+ isInversed = !isInversed;
+ }
+
GeomPointPtr aCenter = thePlane->project(aCircle.center());
GeomPnt2dPtr aCenterInSketch = sketch()->to2D(aCenter);
bool SketchPlugin_Projection::fillEllipticArc(FeaturePtr& theProjection,
const GeomCurvePtr& theEllipticArc,
- const GeomPlanePtr& thePlane)
+ const GeomPlanePtr& thePlane,
+ const GeomEdgePtr& theOriginalEdge)
{
rebuildProjectedFeature(theProjection, ARC_PROJECTION(), SketchPlugin_EllipticArc::ID());
bool isInversed = aNormalsDot < 0.;
+ GeomEllipsePtr anOriginalEllipse = theOriginalEdge->ellipse();
+ if (anOriginalEllipse) {
+ double anEllipsesDot = anOriginalEllipse->normal()->dot(anEllipse.normal());
+ if (anEllipsesDot < 0.)
+ isInversed = !isInversed;
+ }
+
GeomPointPtr aCenter = thePlane->project(anEllipse.center());
GeomPnt2dPtr aCenterInSketch = sketch()->to2D(aCenter);
GeomPointPtr aFocus = thePlane->project(anEllipse.firstFocus());