Skip to content

Commit

Permalink
Part::Geometry: ArcOfHyperbola CCW emulation support/fix
Browse files Browse the repository at this point in the history
===================================================

Correction of the emulation so that arcs of hyperbola are always CCW. This fixes mismatching of end points and edge in Sketcher.
  • Loading branch information
abdullahtahiriyo authored and wwmayer committed Nov 27, 2016
1 parent 8bba242 commit 96d664d
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions src/Mod/Part/App/Geometry.cpp
Expand Up @@ -2160,26 +2160,36 @@ bool GeomArcOfHyperbola::isReversedInXY() const

void GeomArcOfHyperbola::getRange(double& u, double& v, bool emulateCCWXY) const
{
u = myCurve->FirstParameter();
v = myCurve->LastParameter();
if(emulateCCWXY){
if(isReversedInXY()){
std::swap(u,v);
u = -u; v = -v;
try {
if(emulateCCWXY){
if(isReversedInXY()){
Handle_Geom_Hyperbola c = Handle_Geom_Hyperbola::DownCast( myCurve->BasisCurve() );
assert(!c.IsNull());
c->Reverse();
}
}
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
throw Base::Exception(e->GetMessageString());
}

u = myCurve->FirstParameter();
v = myCurve->LastParameter();
}

void GeomArcOfHyperbola::setRange(double u, double v, bool emulateCCWXY)
{
try {
myCurve->SetTrim(u, v);

if(emulateCCWXY){
if(isReversedInXY()){
std::swap(u,v);
u = -u; v = -v;
Handle_Geom_Hyperbola c = Handle_Geom_Hyperbola::DownCast( myCurve->BasisCurve() );
assert(!c.IsNull());
c->Reverse();
}
}
myCurve->SetTrim(u, v);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Expand Down

0 comments on commit 96d664d

Please sign in to comment.