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).

// angle is in radians for faster calculations
srecord PolarPt(double length, double angle) {
  DoublePt toDoublePt() {
    ret doublePt(length*cos(angle), length*sin(angle));
  }
  
  meta-for Pt also as DoublePt {
    *(Pt p) {
      angle = atan2(p.x, p.y);
      length = p.length();
    }
  }
}

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: 136 / 237
Version history: 3 change(s)
Referenced in: [show references]