Libraryless. Click here for Pure Java version (5103L/28K).
1 | sclass NumberPt is IDoublePt { |
2 | Number x, y; |
3 | |
4 | *() {} |
5 | *(Point p) { x = p.x; y = p.y; } |
6 | *(Pt p) { x = p.x; y = p.y; } |
7 | *(double *x, double *y) {} |
8 | |
9 | [stdEq] |
10 | |
11 | toString { |
12 | ret x + ", " + y; |
13 | } |
14 | |
15 | double length() { ret sqrt(sqr(x_dbl())+sqr(y_dbl())); } |
16 | |
17 | public double x_double aka x_dbl() { ret x.doubleValue(); } |
18 | public double y_double aka y_dbl() { ret y.doubleValue(); } |
19 | } |
Began life as a copy of #1009189
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034492 |
Snippet name: | NumberPt - point with Numbers |
Eternal ID of this version: | #1034492/5 |
Text MD5: | a1afa05f95284694f8bc30889be17ca8 |
Transpilation MD5: | 890dcfdde21b2b4e16b45c38381d6c07 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-02-08 09:10:57 |
Source code size: | 420 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 195 / 329 |
Version history: | 4 change(s) |
Referenced in: | [show references] |