[
https://issues.apache.org/jira/browse/GEOMETRY-150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17743179#comment-17743179
]
Alex Herbert commented on GEOMETRY-150:
---------------------------------------
Note that the Vector interface does have an angle method:
{code:java}
double angle(V v);
{code}
So you can test for codirectional if the angle is zero within a tolerance.
Using this approach brings in the robust checks made in the implementing
classes for the angle computation, which becomes problematic as the vectors
become aligned. You are then free to set whatever tolerance you desire on the
angle:
{code:java}
Vector2D v1;
Vector2D v2;
boolean codirectional = Math.abs(v1.angle(v2)) < 0.001;
if (codirectional) {
// do something important
}{code}
As with other recent PRs and jira tickets, I would ask what is your specific
use case for this? A line of action would be: (1) you have a problem you cannot
solve when you are using the library; (2) you contact the user mailing list
with a question on how you could solve the issue; (3) if it is not currently
possible then discuss a wish for the functionality on the dev mailing list or a
jira ticket to determine if it is applicable to add as a feature. This will
consider the API such as general requirements, parameters, acceptable tolerance
on the result and error conditions. Jumping straight to raising PRs will
inevitably result in the reviewer asking questions to elicit why you are adding
this functionality, and then checking the aforementioned considerations. Given
we are all volunteers each step will take time to wait for feedback. So perhaps
try and focus on features that are missing from libraries you are actively
using in your project. If you are not using them, and don't intend to, then I
do question if that is the best use of your volunteer time.
> implement isCodirectionalTo(Vector y)
> -------------------------------------
>
> Key: GEOMETRY-150
> URL: https://issues.apache.org/jira/browse/GEOMETRY-150
> Project: Commons Geometry
> Issue Type: New Feature
> Components: euclidean1D
> Reporter: Dimitrios Efthymiou
> Priority: Minor
> Labels: features
> Fix For: 1.1
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> implement isCodirectionalTo(Vector y) method in the Vector interface. The
> isCodirectionalTo() checks if the 2 vectors point at the same direction. This
> means that each vector can be obtained from the other by multiplying by a
> positive scalar.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)