Skip to content

Commit

Permalink
Sketcher: Arc Of Parabola - Symmetry tool
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullahtahiriyo committed Dec 28, 2016
1 parent 309d9cf commit c6a8e3d
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions src/Mod/Sketcher/App/SketchObject.cpp
Expand Up @@ -2107,6 +2107,31 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
geosymaoe->setRange(theta1,theta2,true);
isStartEndInverted.insert(std::make_pair(*it, true));
}
else if(geosym->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()){
Part::GeomArcOfParabola *geosymaoe = static_cast<Part::GeomArcOfParabola *>(geosym);
Base::Vector3d cp = geosymaoe->getCenter();
Base::Vector3d sp = geosymaoe->getStartPoint(true);
Base::Vector3d ep = geosymaoe->getEndPoint(true);

//double df= geosymaoe->getFocal();
Base::Vector3d f1 = geosymaoe->getFocus();

Base::Vector3d sf1 = f1+2.0*(f1.Perpendicular(refGeoLine->getStartPoint(),vectline)-f1);
Base::Vector3d scp = cp+2.0*(cp.Perpendicular(refGeoLine->getStartPoint(),vectline)-cp);
Base::Vector3d ssp = sp+2.0*(sp.Perpendicular(refGeoLine->getStartPoint(),vectline)-sp);
Base::Vector3d sep = ep+2.0*(ep.Perpendicular(refGeoLine->getStartPoint(),vectline)-ep);

geosymaoe->setXAxisDir(sf1-scp);

geosymaoe->setCenter(scp);

double theta1,theta2;
geosymaoe->closestParameter(sep,theta1);
geosymaoe->closestParameter(ssp,theta2);

geosymaoe->setRange(theta1,theta2,true);
isStartEndInverted.insert(std::make_pair(*it, true));
}
else if(geosym->getTypeId() == Part::GeomPoint::getClassTypeId()){
Part::GeomPoint *geosympoint = static_cast<Part::GeomPoint *>(geosym);
Base::Vector3d cp = geosympoint->getPoint();
Expand Down Expand Up @@ -2153,6 +2178,10 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
const Part::GeomArcOfHyperbola *geosymaoe = static_cast<const Part::GeomArcOfHyperbola *>(georef);
refpoint = geosymaoe->getStartPoint(true);
}
else if(georef->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()){
const Part::GeomArcOfParabola *geosymaoe = static_cast<const Part::GeomArcOfParabola *>(georef);
refpoint = geosymaoe->getStartPoint(true);
}
break;
case Sketcher::end:
if(georef->getTypeId() == Part::GeomLineSegment::getClassTypeId()){
Expand All @@ -2171,6 +2200,10 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
const Part::GeomArcOfHyperbola *geosymaoe = static_cast<const Part::GeomArcOfHyperbola *>(georef);
refpoint = geosymaoe->getEndPoint(true);
}
else if(georef->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()){
const Part::GeomArcOfParabola *geosymaoe = static_cast<const Part::GeomArcOfParabola *>(georef);
refpoint = geosymaoe->getEndPoint(true);
}
break;
case Sketcher::mid:
if(georef->getTypeId() == Part::GeomCircle::getClassTypeId()){
Expand All @@ -2193,6 +2226,10 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
const Part::GeomArcOfHyperbola *geosymaoe = static_cast<const Part::GeomArcOfHyperbola *>(georef);
refpoint = geosymaoe->getCenter();
}
else if(georef->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()){
const Part::GeomArcOfParabola *geosymaoe = static_cast<const Part::GeomArcOfParabola *>(georef);
refpoint = geosymaoe->getCenter();
}
break;
default:
Base::Console().Error("Wrong PointPosId.\n");
Expand Down Expand Up @@ -2313,6 +2350,31 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
geosymaoe->setRange(theta1,theta2,true);
isStartEndInverted.insert(std::make_pair(*it, false));
}
else if(geosym->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()){
Part::GeomArcOfParabola *geosymaoe = static_cast<Part::GeomArcOfParabola *>(geosym);
Base::Vector3d cp = geosymaoe->getCenter();
Base::Vector3d sp = geosymaoe->getStartPoint(true);
Base::Vector3d ep = geosymaoe->getEndPoint(true);

/*double df= geosymaoe->getFocal();*/
Base::Vector3d f1 = geosymaoe->getFocus();

Base::Vector3d sf1 = f1 + 2.0*(refpoint-f1);
Base::Vector3d scp = cp + 2.0*(refpoint-cp);
Base::Vector3d ssp = sp + 2.0*(refpoint-sp);
Base::Vector3d sep = ep + 2.0*(refpoint-ep);

geosymaoe->setXAxisDir(sf1-scp);

geosymaoe->setCenter(scp);

double theta1,theta2;
geosymaoe->closestParameter(ssp,theta1);
geosymaoe->closestParameter(sep,theta2);

geosymaoe->setRange(theta1,theta2,true);
isStartEndInverted.insert(std::make_pair(*it, false));
}
else if(geosym->getTypeId() == Part::GeomPoint::getClassTypeId()){
Part::GeomPoint *geosympoint = static_cast<Part::GeomPoint *>(geosym);
Base::Vector3d cp = geosympoint->getPoint();
Expand Down

0 comments on commit c6a8e3d

Please sign in to comment.