ArcCAM

 From:  probotix
11543.9 In reply to 11543.7 
I'm using the latest beta July 30 2024.

I have noticed some issues in the past where snapping seems to accumulate rounding errors, or so it seems.

I've gotten my test curve mostly straightened out. One thing I had to do that took me a couple of days to figure out was how to identify whether can arc was clockwise or counterclockwise. I figured out how to do it by calculating the arc angle. Here is my logic:


function find_angle2(p0,p1,c) {
return Math.atan2(p0.y - c.y, p0.x - c.x) - Math.atan2(p1.y - c.y, p1.x - c.x);
}

function isClockwise( angle )
{
var pi = Math.PI;
if ( angle == 0 || angle == pi )
return 0;
else if ( angle > 0 && angle < pi )
return 1;
else if ( angle> pi )
return -1;
else if ( angle < 0 && angle> (pi * -1))
return -1;
else if ( angle < (pi * -1))
return 1;
}

var arcAngle2 = round(find_angle2( segment.getStartPt(), segment.getEndPt(), segment.conicFrame.origin),1);

Problem is that when I have an exact half circle, the arc angle is 1pi and I havent figured out how to identify clockwise or counterclockwise. Any ideas?

Also, is there a way (I could not find a script) to explicitly set the start point of a curve?

>Len