Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1034109 // PolarPt

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4953L/27K).

1  
// angle is in radians for faster calculations
2  
srecord PolarPt(double length, double angle) {
3  
  DoublePt toDoublePt() {
4  
    ret doublePt(length*cos(angle), length*sin(angle));
5  
  }
6  
  
7  
  meta-for Pt also as DoublePt {
8  
    *(Pt p) {
9  
      angle = atan2(p.x, p.y);
10  
      length = p.length();
11  
    }
12  
  }
13  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034109
Snippet name: PolarPt
Eternal ID of this version: #1034109/4
Text MD5: bd30fe25d468cdd5981ce67f2e97dec5
Transpilation MD5: b5c0b3602707266311d4571cb5a8aa29
Author: stefan
Category: javax / math
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-22 17:26:15
Source code size: 311 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 137 / 238
Version history: 3 change(s)
Referenced in: [show references]