commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Commented] (GEOMETRY-23) Remove Euclidean Point Classes
Date Mon, 05 Nov 2018 12:59:00 GMT


Gilles commented on GEOMETRY-23:

{quote}How is this different from what we already have?
Currently, we [have|]:
public class Vector3D extends Cartesian3D implements MultiDimensionalEuclideanVector<Point3D,
which would be replaced by
public interface Vector3D<COORDINATE> extends MultiDimensionalVector<COORDINATE>
    public double getX();
    public double getY();
    public double getZ();

    // Define "default" methods in terms of the above Cartesian coordinate accessors.
Then, we'd have
public class Cartesian3D implements Vector3D<Cartesian3D> {
    private final double x, y , z;

    // Factory.
    public static Cartesian3D of(double x, double y, double z) { /* ... */ }
public class Spherical3D implements Vector3D<Spherical3D> {
    private final double r, theta, phi;
    private final double x, y, z; // See below.

    // Factory.
    public static Spherical3D of(double r, double theta, double phi) { /* ... */ }

    // Define conversion methods (values could be computed at construction, trading
    // off space for performance since we assume that most algorithms in this library
    // are based on Cartesian coordinates).
    public double getX() { /* ... */ }
    public double getY() { /* ... */ }
    public double getZ() { /* ... */ }

    // Override interface methods with faster alternatives.

> Remove Euclidean Point Classes
> ------------------------------
>                 Key: GEOMETRY-23
>                 URL:
>             Project: Apache Commons Geometry
>          Issue Type: Improvement
>            Reporter: Matt Juntunen
>            Priority: Major
>              Labels: pull-request-available
> Based on discussion of the current Point/Vector API in GEOMETRY-14 and research into
other geometric libraries, I think we should remove the Euclidean Point?D classes and make
Vector?D also implement Point. This will end up being similar to the previous commons-math
design but avoids the issue raised in MATH-1284 since the Point and Vector interfaces are
not related. They just happen to be implemented by the same class, which we're calling Vector?D
since a vector can be used to indicate a point (by adding it to the origin).
> In the course of trying this out this design, I ended up removing 7 classes and simplifying
several methods. I think that's a good indicator that this is a good design choice.
> Pull request:

This message was sent by Atlassian JIRA

View raw message