When the Gcode has G2 Xa Yb Rc;
How can i find center point of this circle .
Thanks...
When the Gcode has G2 Xa Yb Rc;
How can i find center point of this circle .
Thanks...
To calculate the centre of the arc, the Control uses:
1. the coordinates of the location prior to the circular move as the arc Start Point
2. the End coordinates specified in the circular move block as the arc End Points
3. the Radius value specified in the circular move block
Following is an example of the math used in such an algorithm
Where:
X = Resultant X centre point
Y = Resultant Y centre point
X1 = 1st X point
Y1 = 1st Y point
X2 = 2nd X point
Y2 = 2nd Y point
r = Arc Radius
The following can be used to find the arc centre point.
'Get distance between 1st and 2nd points
q = Sqr((X2 - X1) ^ 2 + (Y2 - Y1) ^ 2)
'Find mid point of q (X3,Y3)
X3 = (X1 + X2) / 2
Y3 = (Y1 + Y2) / 2
All two sets of points and given radii will have two arc centre points, hence the two examples shown below. In software, the correct centre point for the application would be determined by G02 or G03 specified in the command block.
'Find centre point of circle
X = X3 + Sqr(r ^ 2 - (q / 2) ^ 2) * (Y1 - Y2) / q
Y = Y3 + Sqr(r ^ 2 - (q / 2) ^ 2) * (X2 - X1) / q
X = X3 - Sqr(r ^ 2 - (q / 2) ^ 2) * (Y1 - Y2) / q
Y = Y3 - Sqr(r ^ 2 - (q / 2) ^ 2) * (X2 - X1) / q
Regards,
Bill