[
https://issues.apache.org/jira/browse/GEOMETRY-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17326202#comment-17326202
]
Matt Juntunen commented on GEOMETRY-118:
----------------------------------------
Added a PR for this: https://github.com/apache/commons-geometry/pull/153
I added new methods to all 3 {{AffineTransformMatrixXD}} classes for applying
the transform to a set of coordinates and returning a double value for a
specified component. For example, the {{AffineTransformMatrix3D}} class now has
{{applyX}}, {{applyY}}, and {{applyZ}}, as well as {{applyVectorX}},
{{applyVectorY}}, and {{applyVectorZ}}. These correspond to the existing
{{apply}} and {{applyVector}} methods.
I also added some benchmark tests. There is a consistent performance boost when
using the non-Vector methods to transform values stored in double arrays. The
table below shows a typical result with JDK 8. Both tests accept an array of
random double values representing point coordinates which are then transformed
in-place. The {{transformArrayAsVectors3D}} test constructs a {{Vector3D}}
instance for each triplet of values, transforms this vector, and then unpacks
the results back into the array. The {{transformArrayComponents3D}} test uses
the new {{applyX}}, etc methods to perform the transformation directly without
creating {{Vector3D}} instances.
||Benchmark||(size)||Mode||Cnt||Score||Error||Units||
|AffineTransformMatrixPerformance.transformArrayAsVectors3D|6000|avgt|5|48270.474|±512.041|ns/op
|AffineTransformMatrixPerformance.transformArrayAsVectors3D|600000|avgt|5|4953753.812|
±73952.368 |ns/op|
|AffineTransformMatrixPerformance.transformArrayComponents3D|6000|avgt|5|42049.154|±688.317|ns/op|
|AffineTransformMatrixPerformance.transformArrayComponents3D|600000|avgt|5|4301789.439|±59713.465|ns/op|
> AffineTransformMatrix2D should support direct transformation of x/y values
> --------------------------------------------------------------------------
>
> Key: GEOMETRY-118
> URL: https://issues.apache.org/jira/browse/GEOMETRY-118
> Project: Apache Commons Geometry
> Issue Type: Improvement
> Reporter: Christoph Läubrich
> Priority: Major
>
> [~mattjuntunen] as discussed on the mailinglist, it would be convenient if
> there would be methods to directly transform a single x/y value instead of
> using vectors and/or export the matrix as an array and perform it manually.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)