sclass LineWithColor implements RenderableWithHints { Pt a, b; RGB color; int width = 14; *() {} *(Pt *a, Pt *b, RGB *color) {} *(Pt *a, Pt *b, Color color, int *width) { this.color = new RGB(color); } public void renderOn(Graphics2D g, int w, int h) { drawRoundEdgeLine(g, a, b, toColor(color), width); } public void renderHints(Graphics2D g, int w, int h) { fillRect(g, a.x, a.y, 1, 1, hintColor()); fillRect(g, b.x, b.y, 1, 1, hintColor()); } // 0 to 360 (clockwise, 0 is north) double angle() { double angle = Math.toDegrees(Math.atan2(b.y-a.y, b.x-a.x)); ret mod(angle+90, 360); } }
Began life as a copy of #1014949
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015016 |
Snippet name: | LineWithColor |
Eternal ID of this version: | #1015016/10 |
Text MD5: | 38965e41f5fb4f1f81b3b8ef1b7e71c7 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-01-02 06:04:19 |
Source code size: | 668 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 440 / 1015 |
Version history: | 9 change(s) |
Referenced in: | [show references] |