Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/emc/rs274ngc/interp_arc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ int Interp::arc_data_r(int move, //!< either G_2 (cw arc) or G_3 (ccw arc)
half_length = hypot((mid_x - end_x), (mid_y - end_y));
CHKS(((half_length - abs_radius) > tolerance),
NCE_ARC_RADIUS_TOO_SMALL_TO_REACH_END_POINT);
if ((half_length / abs_radius) > (1 - TINY))
half_length = abs_radius; /* allow a small error for semicircle */
if (half_length > abs_radius * (1 - TINY))
abs_radius = half_length; /* allow a small error for semicircle, R0 too */
/* check needed before calling asin */
if (((move == G_2) && (radius > 0)) || ((move == G_3) && (radius < 0)))
theta = atan2((end_y - current_y), (end_x - current_x)) - M_PI_2l;
Expand Down
5 changes: 5 additions & 0 deletions tests/interp/good/good-arc.r0.ngc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
g21
f1
g0x0y0z0
g2 x0.001 y0 r0
m2
19 changes: 19 additions & 0 deletions tests/interp/good/good-arc.r0.ngc.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
4 N..... SET_XY_ROTATION(0.0000)
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
6 N..... ON_RESET()
7 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
8 N..... SET_FEED_RATE(1.0000)
9 N..... STRAIGHT_TRAVERSE(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
10 N..... ARC_FEED(0.0010, 0.0000, 0.0005, 0.0000, -1, 0.0000, 0.0000, 0.0000, 0.0000)
11 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
12 N..... SET_XY_ROTATION(0.0000)
13 N..... SET_FEED_MODE(0, 0)
14 N..... SET_FEED_RATE(0.0000)
15 N..... STOP_SPINDLE_TURNING(0)
16 N..... SET_SPINDLE_MODE(0 0.0000)
17 N..... PROGRAM_END()
18 N..... ON_RESET()
19 N..... ON_RESET()