#include <GeomAlgoAPI_EdgeBuilder.h>
#include <GeomAlgoAPI_PointBuilder.h>
+static const double TOLERANCE = 1.e-7;
SketchPlugin_MacroEllipse::SketchPlugin_MacroEllipse()
: SketchPlugin_SketchEntity(),
anEllipsePoints[0]->setY(0.5 * (anEllipsePoints[0]->y() + anEllipsePoints[1]->y()));
}
+ if (anEllipsePoints[0]->distance(anEllipsePoints[1]) < TOLERANCE)
+ return; // ellipse is not valid
+
std::shared_ptr<GeomAPI_Ellipse2d> anEllipse;
if (aNbInitialized == 2) {
GeomDir2dPtr aXDir(new GeomAPI_Dir2d(anEllipsePoints[1]->x() - anEllipsePoints[0]->x(),
#include <GeomAlgoAPI_PointBuilder.h>
+const double TOLERANCE = 1.e-7;
const double paramTolerance = 1.e-4;
const double PI = 3.141592653589793238463;
myStartPnt = anEllipsePoints[2];
myEndPnt = anEllipsePoints[3];
+ if (myCenter->distance(myMajorAxis) < TOLERANCE)
+ return; // ellipse is not valid
+
std::shared_ptr<GeomAPI_Ellipse2d> anEllipse;
if (aNbInitialized == 2) {
GeomDir2dPtr aXDir(new GeomAPI_Dir2d(anEllipsePoints[1]->x() - anEllipsePoints[0]->x(),
tooltip="Passed point coordinates"
accept_expressions="0"
enable_value="enable_by_preferences"/>
+ <validator id="GeomValidators_Different" parameters="first_point,second_point,passed_point"/>
+ <validator id="SketchPlugin_DifferentPointReference" parameters="first_point_ref,second_point_ref"/>
</box>
<box id="by_major_axis_and_point"
icon="icons/Sketch/ellipse_axes_32x32.png"
tooltip="Passed point coordinates"
accept_expressions="0"
enable_value="enable_by_preferences"/>
+ <validator id="GeomValidators_Different" parameters="first_point_1,second_point_1,passed_point_1"/>
+ <validator id="SketchPlugin_DifferentPointReference" parameters="first_point_ref_1,second_point_ref_1"/>
</box>
</toolbox>
<labelvalue id="major_radius"
default="false"
obligatory="0"
change_visual_attributes="true"/>
+ <validator id="GeomValidators_Different" parameters="center,major_axis_point"/>
+ <validator id="SketchPlugin_DifferentPointReference" parameters="center_ref,major_axis_point_ref"/>
+ <validator id="GeomValidators_Different" parameters="start_point,end_point"/>
+ <validator id="SketchPlugin_DifferentPointReference" parameters="start_point_ref,end_point_ref"/>
</feature>
</group>