Sketcher: Parabola perpendicularity constraint
This commit is contained in:
parent
d8b38032cf
commit
9e7d86f1b8
|
@ -2012,10 +2012,12 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg)
|
|||
|
||||
if( geo1->getTypeId() == Part::GeomEllipse::getClassTypeId() ||
|
||||
geo1->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() ||
|
||||
geo1->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()) {
|
||||
geo1->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId() ||
|
||||
geo1->getTypeId() == Part::GeomArcOfParabola::getClassTypeId() ) {
|
||||
|
||||
Base::Vector3d center;
|
||||
Base::Vector3d majdir;
|
||||
Base::Vector3d focus;
|
||||
double majord = 0;
|
||||
double minord = 0;
|
||||
double phi = 0;
|
||||
|
@ -2048,13 +2050,19 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg)
|
|||
majdir=aoh->getMajorAxisDir();
|
||||
phi=atan2(majdir.y, majdir.x);
|
||||
}
|
||||
else
|
||||
if( geo1->getTypeId() == Part::GeomArcOfParabola::getClassTypeId() ){
|
||||
const Part::GeomArcOfParabola *aop = static_cast<const Part::GeomArcOfParabola *>(geo1);
|
||||
|
||||
center=aop->getCenter();
|
||||
focus=aop->getFocus();
|
||||
}
|
||||
|
||||
const Part::GeomLineSegment *line = static_cast<const Part::GeomLineSegment *>(geo2);
|
||||
|
||||
Base::Vector3d point1=line->getStartPoint();
|
||||
Base::Vector3d PoO;
|
||||
|
||||
|
||||
if( geo1->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId() ) {
|
||||
double df=sqrt(majord*majord+minord*minord);
|
||||
Base::Vector3d direction=point1-(center+majdir*df); // towards the focus
|
||||
|
@ -2063,7 +2071,13 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg)
|
|||
PoO = Base::Vector3d(center.x+majord*cosh(tapprox)*cos(phi)-minord*sinh(tapprox)*sin(phi),
|
||||
center.y+majord*cosh(tapprox)*sin(phi)+minord*sinh(tapprox)*cos(phi), 0);
|
||||
}
|
||||
else {
|
||||
else if( geo1->getTypeId() == Part::GeomArcOfParabola::getClassTypeId() ) {
|
||||
Base::Vector3d direction=point1-focus; // towards the focus
|
||||
|
||||
PoO = point1 + direction / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Base::Vector3d direction=point1-center;
|
||||
double tapprox=atan2(direction.y,direction.x)-phi; // we approximate the eccentric anomally by the polar
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user