Libraryless. Click here for Pure Java version (7621L/42K).
1 | // only shift-right supported so far |
2 | srecord noeq OnePathShifter(OnePathWithOrigin path, bool shiftRight) { |
3 | Pt pIn, pOut; |
4 | int direction; |
5 | int iStep; |
6 | gettable OnePathWithOrigin outPath; |
7 | |
8 | run { |
9 | assertTrue(shiftRight); |
10 | outPath = new OnePathWithOrigin; |
11 | pIn = path.origin(); |
12 | |
13 | while (iStep < path.nSteps()) { |
14 | int step = path.getStep(iStep); |
15 | Pt dir = onePathDirection(step); |
16 | if (direction == 0) { |
17 | direction = step; |
18 | pOut = ptPlus(path.origin(), rotatePtRight(dir)); |
19 | outPath.setOrigin(pOut); |
20 | } |
21 | |
22 | outPath.addStep(step); |
23 | |
24 | pIn = ptPlus(pIn, dir); |
25 | ++iStep; |
26 | } |
27 | } |
28 | |
29 | OnePathWithOrigin get() { if (outPath == null) run(); ret outPath; } |
30 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034958 |
Snippet name: | OnePathShifter - shift a OnePath one pixel to the left or right (along the path) [dev.] |
Eternal ID of this version: | #1034958/4 |
Text MD5: | c7570d9a7b4aa8f10d858593e83452e8 |
Transpilation MD5: | 85e3c34be8d2fd2bcf4d127e4163d981 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-18 00:57:15 |
Source code size: | 763 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 160 / 278 |
Version history: | 3 change(s) |
Referenced in: | [show references] |