[jira] [Created] (GEOMETRY-72) Boundary API

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (GEOMETRY-72) Boundary API

ASF GitHub Bot (Jira)
Matt Juntunen created GEOMETRY-72:
-------------------------------------

             Summary: Boundary API
                 Key: GEOMETRY-72
                 URL: https://issues.apache.org/jira/browse/GEOMETRY-72
             Project: Apache Commons Geometry
          Issue Type: New Feature
          Components: Euclidean 2D, Euclidean 3D
            Reporter: Matt Juntunen
             Fix For: 1.0


Geometric models are often specified as a set of boundaries. These boundaries may also contain additional data beyond pure geometric information, such as an identifier, color, reflectance, etc. In order to allow these additional properties to be used by commons-geometry, we should make a general interface for region boundaries in Euclidean 2D and 3D. Users could then have their own classes implement this interface and take advantage of commons-geometry algorithms.

Here is part of the proposed API for 3D. A similar one would exist for 2D.
{code:java}
public interface Boundary3D {
    // Return a convex subplane representing the same boundary as this instance
    ConvexSubPlane toSubPlane();
}
{code}

{code:java}
public interface BoundarySource3D<B extends Boundary3D> {
    // get a stream of boundary instances
    Stream<B> boundaryStream();
}
{code}

{code:java}
// add additional methods to RegionBSPTree3D
public class RegionBSPTree3D {
    // insert a boundary stream into the tree
    public <B extends Boundary3D> void insert(BoundarySource3D<B> src) {
        try (Stream<B> stream = src.boundaryStream()) {
            stream.forEach(b -> insert(b.toSubPlane());
        }
    }
}
{code}

This API would also be used for raycasting (see GEOMETRY-68).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)