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

Gilles Sadowski commented on GEOMETRY-160:
------------------------------------------

{quote}[...] if you can't state a use case for adding code, then it does not 
belong.
{quote}
To be more precise, a "personal use" case is not a necessary condition; two 
others ways have been mentioned:
 # a reference to a scientific paper (or Wikipedia) describing the algorithm
 # a reference to a library that provides the functionality

{quote}Why is the method Vectors::normSq even necessary when you can just do 
x*x - which was the argument someone gave me for another convenience method I 
suggested 1/2 days ago?
{quote}
Cf. point (1): [https://en.wikipedia.org/wiki/Euclidean_distance]

Also, Matt and I have explained that this code is in an {{internal}} package 
(by convention, it is excluded from the user API). Admittedly the code is 
trivial, but is probably there for the sake of consistency and completeness wrt 
the 2D and 3D cases that are less trivial.
{quote}[...] dedicated class that handles that math aspect. Why don't we do the 
same for commons-geometry?
{quote}
Don't we? Where?
{quote}I don't know when you would need to know the indices of occurence of an 
element. But since it is calculable, there must be a reason or two, right?
{quote}
I've already answered this in an earlier comment.
{quote}I am guessing you are talking about only widely used libraries for Java 
or Python libraries, etc. right?
{quote}
Yes.
{quote}What should the Jira ticket say in that case? "Check if a point is on 
the vector – Matlab and NumPy does it".
{quote}
Yes.
But don't take this as an argument to extract a single method out of those 
libraries and make a PR out of it! It it fits into an existing class, fine. 
However, if it is part of a larger functionality, then additional conditions 
would probably apply:
 # that functionality should also be within the scope of the component/module, 
and
 # enough code should be ported so as to provide an actually useful equivalent 
of what exists in the other library.

{quote}I used ChatGPT to generate the use-cases
{quote}
A "use case" (AFAIK) is something concrete: "If feature <X> were implemented, I 
could do <Y>." I'd say that <Y> should be somewhat higher-level than <X> 
(otherwise, we'd just state the obvious: "With <X>, I can do <X>").
{quote}I just implemented math algorithms.
{quote}
With reference or use-case?

> Implement getIndicesOfOccurenceOfElement(Vector x, double element)
> ------------------------------------------------------------------
>
>                 Key: GEOMETRY-160
>                 URL: https://issues.apache.org/jira/browse/GEOMETRY-160
>             Project: Commons Geometry
>          Issue Type: New Feature
>          Components: euclidean1D, euclidean2D, euclidean3D
>            Reporter: Dimitrios Efthymiou
>            Priority: Minor
>              Labels: features
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> If we have a vector u = (2, 1, 3, 1, 7) and a number, say, 1 then it returns 
> a list of the indices 1 and 3



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to