(compute a quarter-arc preentry and radius vector to a point x,y) (return: _entry:prex,prey == preentry point) ( _entry:vx,vy == vector from start x,y to center xctr,yctr) (Usage: for entry to a point on an arc of a circle:) ( o call [inside][dir][tooldiam][x][y][xctr][yctr]) ( then preentry point is: prex = #<_entry:prex>) ( prey = #<_entry:prey>) ( and the entry arc is: g2|3 x # y # i #<_entry:vx> j #<_entry:vy>) o sub (not_a_subfile) # = #1 (1:in, 0:out) # = #2 (2:cw, 3:ccw) # = #3 # = #4 # = #5 # = #6 # = #7 # = [# - #] # = [# - #] o if [[# NE 0] AND [# NE 1]] (debug, entry: bad inside specifier # -- EXITING) (print, entry: bad inside specifier # -- EXITING) (AXIS,notify, entry: bad inside specifier -- EXITING) m2 o endif o if [[# NE 2] AND [# NE 3]] (debug, entry: bad dir specifier # -- EXITING) (print, entry: bad dir specifier # -- EXITING) (AXIS,notify, entry: bad dir specifier # -- EXITING) m2 o endif # = [# / 2.0] # = 0.000001 o if [ABS[#] GT #] # = ATAN[#]/[#] o else o if [# GE 0] # = 90 o else # = -90 o endif o endif (compute pre-entry px,py for 1/4 circle with radius rt) (and vector from start x,y to center of circle) o if [# EQ 1] o if [# EQ 2] (cw) # = [# - #*sin[#] - #*cos[#]] # = [# + #*cos[#] - #*sin[#]] # = [0 + #*sin[#]] # = [0 - #*cos[#]] o else (ccw) # = [# + #*sin[#] - #*cos[#]] # = [# - #*cos[#] - #*sin[#]] # = [0 - #*sin[#]] # = [0 + #*cos[#]] o endif o else o if [# EQ 2] (cw) # = [# - #*sin[#] + #*cos[#]] # = [# + #*cos[#] + #*sin[#]] # = [0 + #*sin[#]] # = [0 - #*cos[#]] o else (ccw) # = [# + #*sin[#] + #*cos[#]] # = [# - #*cos[#] + #*sin[#]] # = [0 - #*sin[#]] # = [0 + #*cos[#]] o endif o endif #<_entry:prex> = [# + #] #<_entry:prey> = [# + #] #<_entry:vx> = # #<_entry:vy> = # o endsub