static GCS::SET_pD lineParameters(const EdgeWrapperPtr& theLine);
static GCS::SET_pD circleParameters(const EdgeWrapperPtr& theCircle);
static GCS::SET_pD arcParameters(const EdgeWrapperPtr& theArc);
+static GCS::SET_pD ellipseParameters(const EdgeWrapperPtr& theEllipse);
return circleParameters(GCS_EDGE_WRAPPER(theEntity));
case ENTITY_ARC:
return arcParameters(GCS_EDGE_WRAPPER(theEntity));
+ case ENTITY_ELLIPSE:
+ return ellipseParameters(GCS_EDGE_WRAPPER(theEntity));
default: break;
}
return GCS::SET_pD();
new GCS::ConstraintP2PDistance(*(thePoint->point()), aCirc->center, aCirc->rad));
break;
}
+ case ENTITY_ELLIPSE:
+ case ENTITY_ELLIPTICAL_ARC: {
+ std::shared_ptr<GCS::Ellipse> anEllipse =
+ std::dynamic_pointer_cast<GCS::Ellipse>(theEntity->entity());
+ aNewConstr = GCSConstraintPtr(new GCS::ConstraintPointOnEllipse(*(thePoint->point()), *anEllipse));
+ break;
+ }
default:
return ConstraintWrapperPtr();
}
std::shared_ptr<GCS::Circle> aCirc2 =
std::dynamic_pointer_cast<GCS::Circle>(theEntity2->entity());
- aConstrList.push_back(GCSConstraintPtr(new GCS::ConstraintEqual(aCirc1->rad, aCirc2->rad)));
+ if (aCirc1 && aCirc2)
+ aConstrList.push_back(GCSConstraintPtr(new GCS::ConstraintEqual(aCirc1->rad, aCirc2->rad)));
+ else {
+ std::shared_ptr<GCS::Ellipse> anEllipse1 =
+ std::dynamic_pointer_cast<GCS::Ellipse>(theEntity1->entity());
+ std::shared_ptr<GCS::Ellipse> anEllipse2 =
+ std::dynamic_pointer_cast<GCS::Ellipse>(theEntity2->entity());
+
+ aConstrList.push_back(GCSConstraintPtr(
+ new GCS::ConstraintEqual(anEllipse1->radmin, anEllipse2->radmin)));
+ aConstrList.push_back(GCSConstraintPtr(
+ new GCS::ConstraintEqualMajorAxesConic(anEllipse1.get(), anEllipse2.get())));
+ }
}
std::shared_ptr<PlaneGCSSolver_ConstraintWrapper> aResult(
aParams.insert(anArc->rad);
return aParams;
}
+
+GCS::SET_pD ellipseParameters(const EdgeWrapperPtr& theEllipse)
+{
+ GCS::SET_pD aParams;
+ std::shared_ptr<GCS::Ellipse> anEllipse =
+ std::dynamic_pointer_cast<GCS::Ellipse>(theEllipse->entity());
+ aParams.insert(anEllipse->center.x);
+ aParams.insert(anEllipse->center.y);
+ aParams.insert(anEllipse->focus1.x);
+ aParams.insert(anEllipse->focus1.y);
+ aParams.insert(anEllipse->radmin);
+ return aParams;
+}