Hello,

I didn't receive any feedback on this so I'm going to assume that everyone is 
okay with this approach. I'm working on a pull request now 
(https://github.com/darkma773r/commons-geometry/tree/polar-spherical-working). 
Also, I'm changing the property names of the existing SphericalCoordinates 
class from "r", "theta", and "phi" to "radius", "azimuth", and "polar" since 
there are competing conventions for the meanings of "theta" and "phi" and the 
latter set of property names is unambiguous and far more intuitive. Likewise, 
the properties for the PolarCoordinates class are "radius" and "azimuth" (there 
was no prior version of this class).


Thanks,

Matt


________________________________
From: Matt Juntunen <[email protected]>
Sent: Monday, June 4, 2018 11:06 PM
To: Commons Developers List
Subject: [geometry] Polar/Spherical Coordinates API

Hi all,


I'm trying to add support for polar and spherical coordinates to the Euclidean 
geometry code. My basic idea is to add them as simple DTOs with getters and 
factory methods in the Point?D and Vector?D classes. For example:



Polar polar = Polar.of(1, Math.PI / 2);
polar.getRadius(); // 1
polar.getTheta(); // 2

Vector2D vec = Vector2D.ofPolar(polar);
// also possible: Vector2D.ofPolar(1, Math.PI / 2)

// do stuff with vec; uses Cartesian coordinates internally

Polar result = vec.getPolar();


The Spherical class would be similar. Any thoughts, comments, or objections to 
this approach? I've create the following issue to track this: 
https://issues.apache.org/jira/projects/GEOMETRY/issues/GEOMETRY-7.

Thanks,
Matt


Reply via email to