checking arc and arcto input for invalid function arguments

This commit is contained in:
shirnschall 2021-08-13 16:00:12 +02:00
parent 539798971c
commit 1c0cfd8965

View File

@ -160,6 +160,10 @@ public:
{ {
gp_Pnt2d P1 = localpos.Location(); gp_Pnt2d P1 = localpos.Location();
//check input
if(P1.X() == h && P1.Y() == v)
throw Exception("points P1 and P2 must not be congruent");
localpos.SetLocation (gp_Pnt2d(h,v)); localpos.SetLocation (gp_Pnt2d(h,v));
gp_Pnt2d P2 = localpos.Location(); gp_Pnt2d P2 = localpos.Location();
@ -231,6 +235,10 @@ public:
{ {
double newAngle = fmod(angle,360)*M_PI/180; double newAngle = fmod(angle,360)*M_PI/180;
//check input
if(newAngle<1e-16 && newAngle>-1e-16)
throw Exception("angle must not be an integer multiple of 360");
gp_Dir2d dir = localpos.Direction(); gp_Dir2d dir = localpos.Direction();
gp_Dir2d dirn; gp_Dir2d dirn;
//compute center point of arc //compute center point of arc