commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raymond DeCampo (JIRA)" <>
Subject [jira] [Commented] (MATH-1284) Vector is-not-a Point
Date Tue, 25 Apr 2017 23:10:04 GMT


Raymond DeCampo commented on MATH-1284:

Please take a look at the {{feature-MATH-1284}} branch.

First, I made it so that {{Vector}} no longer extends {{Point}}.  Then I added the appropriate
methods from the {{Point}} interface to the {{Vector}} interface.

The only implementations which represented problems were the {{Vector?D}} classes.  I noticed
that the existing code dealing with these implementations relied pretty heavily on casting
back and forth between {{Point}} and {{Vector}}, so the most prudent thing seemed to be supplying
a class which implements both.

I decided on {{Coordinates?D}} for the "new" classes (these are really just {{Vector?D}} renamed).
 Here I am using the fact that point a vector and a point in finite dimensional Euclidean
space can be represented by a set of coordinates.  (Keeping the classes with {{Vector?D}}
name would feel like we hadn't really addressed the issue.)

If it is a problem that the {{Vector?D}} classes are just dropped we could introduce them
as an intermediate interface (or even as a concrete class which {{Coordinates?D}} extends
but that feels less satisfying).

Having {{Coordinates?D}} implement both interfaces led to some method calls being ambiguously
defined.  Here I just removed one of the methods.  I am thinking now it would have been better
just to create an implementation accepting the {{Coordinate?D}} class.

In any case, there would be more work in terms of cleaning up and documentation, this is not
meant to be a finished product but a basis for discussion.

> Vector is-not-a Point
> ---------------------
>                 Key: MATH-1284
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.5
>            Reporter: Roman Werpachowski
>            Priority: Minor
>             Fix For: 4.0
> The class hierarchy for geometry claims that Vector is-a Point:
> This is mathematically incorrect, see e.g.
> Just because they share the same numerical representation, Point and Vector shouldn't
be crammed into a common class hierarchy.

This message was sent by Atlassian JIRA

View raw message