commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Juntunen <>
Subject [geometry] Polar/Spherical Coordinates API
Date Tue, 05 Jun 2018 03:06:03 GMT
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:


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message