Hello.
Le dim. 29 janv. 2023 à 19:25, Andreas Goss
<[email protected]> a écrit :
>
> Hello,
>
> I want to contribute a solution for the open Jira task GEOMETRY-110 (
> https://issues.apache.org/jira/projects/GEOMETRY/issues/GEOMETRY-110?filter=allopenissues).
> I tried my best to organize the code according to guidelines and at least
> the maven build was succesful. I created a pull-request for the github
> clone. If someone could give me a code review and point out areas to
> improve the code or errors i would be very thankful.
Thank you for tackling this issue.
It was part of a broader discussion about the API around the hull functionality.
IIRC, the "commons-geometry-hull" module was not included in the first
release of "Commons Geometry" because Matt Juntunen was convinced
that a few enhancements were necessary. Hopefully, he'll chime in order to
make this recollection more precise.
A general question is whether we want to expose (make "public") classes
that implement the algorithm(s), such as "QuickHull3D". For example, we
could perhaps have (untested and required comments missing...):
---CUT---
public interface ConvexHull3D extends ConvexHull<Vector3D> {
public enum Generate {
QUICK_HULL((c, p) -> new QuickHull3D(p).generate(c));
private final BiFunction<Collection<Vector3D>,
DoubleEquivalence, ConvexHull3D> generator;
private HullGenerator3D(BiFunction<Collection<Vector3D>,
DoubleEquivalence, ConvexHull3D> generator) {
this.generator = generator;
}
public ConvexHull3D from(Collection<Vector3D> points,
DoubleEquivalence equivalence) {
return generator.apply(points, equivalence));
}
}
public Collection<? extends ConvexPolygon3D> getFacets();
}
private class QuickHull3D {
private final DoubleEquivalence precision;
QuickHull3D(DoubleEquivalence precision) {
this.precision = precision;
}
ConvexHull3D generate(Collection<Vector3D> points) {
// ...
return new SimpleConvexHull3D(...);
}
}
private class SimpleConvexHull3D implements ConvexHull3D {
private final List<Vector3D> vertices;
private final ConvexVolume region;
private Collection<ConvexPolygon3D> facets;
SimpleConvexHull3D(...) {
// ...
}
// ...
}
---CUT---
For other concrete (basic) remarks about the code, we can certainly
continue the conversation in comments on the JIRA report.
Best regards,
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]