Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/dc
- # Process fold section (storing first fold axis and line in a and l)
- [
- sl sa # store line, axis (clobber, only want first fold)
- d _1!=R # loop until top is -1
- ] sR
- lRx s.
- [ ll2* lx- sx ] sX # macro to flip in x
- [ ll2* ly- sy ] sY # macro to flip in y
- [ lY sF [ly] sA ] sS # macro to swap x-macros for y-macros
- [ lx ] sA # store axis value loader in A
- lX sF # start with X in F (flip transform macro)
- la 121=S # if doing Y, S will change the above macros
- [ lc1- sc ] sM # point merged, reduce count
- # Loop to transform each point and check for collisions
- [
- sy sx # store point into x,y
- lAx ll<F # execute transform if on far side of line
- ly 10000* lx+ # calculate hash (10000y + x)
- d;h 1=M 1 r:h # (h(hash) = 1, merge) (h(hash) = 1)
- z 0<L # loop while points on stack
- ] sL
- z 2/ sc # init count with number of points (stack/2)
- lLx # start loop
- [Part 1: ]n lcp
Add Comment
Please, Sign In to add comment