[ 
https://issues.apache.org/jira/browse/GEOMETRY-14?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16641031#comment-16641031
 ] 

Gilles commented on GEOMETRY-14:
--------------------------------

{quote}The transform classes are used to transform both points and vectors
{quote}
What are the different use-cases?
 Having had a quick look at {{Point3D}} and {{Vector3}}, they seem fairly 
similar in their API and fairly convoluted in their inheritance hierarchy.
 We may want to have a user guide explaining the design and how it is put to 
use with concrete examples of when to use this vs that class/interface. It will 
surely spare us puzzled faces later on.

When we wonder whether an {{AffineTransform3D}} _is-a_ 
{{UnaryOperator<Point3D>}} or {{UnaryOperator<Vector3D>}}, there is some alarm 
starting to ring...
{quote}Did you have any other alternatives in mind?
{quote}
In principle, there are two use-cases that arise from the above discussion:
 # Expressing a sequence of {{AffineTransform3D}} operations
 # Combining a sequence of {{AffineTransform3D}} operations

If the former is ever useful, then the {{UnaryOperator}} approach seems to 
allow more flexibility in using the JDK API (stream, filter, ...).

If the second is necessary for performance reason, for example (IIUC) when the 
same transform is to be applied to many points (or was it vectors? ;)), a 
simpler (IMHO) API may be:
{code:java}
public static AffineTransform3D combine(AffineTransform3D ... transforms) {
    AffineTransform3D c = identity();
    for (int i = 0; i < transforms.length; i++) {
        c = c.times(transforms[i]);
    }
    return c;
}
{code}
So perhaps, it is the right to setup "real-life" use-cases as you mentioned in 
your roadmap post to the ML, in order to keep us in the right track (i.e. 
trying to avoid API and performance mistakes).

Also, have you already looked at how e.g.
 # existing classes such as {{Rotation}} fit with {{AffineTransform3D}}
 # usage of {{Quaternion}} (from ["Commons 
Numbers"|https://git1-us-west.apache.org/repos/asf?p=commons-numbers.git;a=blob;f=commons-numbers-quaternion/src/main/java/org/apache/commons/numbers/quaternion/Quaternion.java;h=86d7fdfa53d2b61bd07cebd05c02008f2809ebd9;hb=HEAD])

?

> AffineTransform?D Classes
> -------------------------
>
>                 Key: GEOMETRY-14
>                 URL: https://issues.apache.org/jira/browse/GEOMETRY-14
>             Project: Apache Commons Geometry
>          Issue Type: New Feature
>            Reporter: Matt Juntunen
>            Priority: Major
>              Labels: pull-request-available
>
> We should create AffineTransform?D classes that implement matrix-based affine 
> transforms. They should have simple methods for creating translations, 
> rotations, and scaling and calculating the inverse.
>  
> Pull Request #1: https://github.com/apache/commons-geometry/pull/14



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to