Class AbstractBoundaryReadHandler3D

java.lang.Object
org.apache.commons.geometry.io.euclidean.threed.AbstractBoundaryReadHandler3D
All Implemented Interfaces:
BoundaryReadHandler<PlaneConvexSubset,BoundarySource3D>, BoundaryReadHandler3D
Direct Known Subclasses:
ObjBoundaryReadHandler3D, StlBoundaryReadHandler3D, TextBoundaryReadHandler3D

public abstract class AbstractBoundaryReadHandler3D extends Object implements BoundaryReadHandler3D
Abstract base class for BoundaryReadHandler3D implementations.
  • Constructor Details

    • AbstractBoundaryReadHandler3D

      public AbstractBoundaryReadHandler3D()
  • Method Details

    • read

      public BoundarySource3D read(GeometryInput in, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Return an object containing all boundaries read from input using the handler's supported data format.
      Specified by:
      read in interface BoundaryReadHandler<PlaneConvexSubset,BoundarySource3D>
      Parameters:
      in - input to read from
      precision - precision context used for floating point comparisons
      Returns:
      object containing all boundaries read from input
    • readTriangleMesh

      public TriangleMesh readTriangleMesh(GeometryInput in, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Read a triangle mesh from the given input. Implementations may throw runtime exceptions if mathematically invalid boundaries are encountered.
      Specified by:
      readTriangleMesh in interface BoundaryReadHandler3D
      Parameters:
      in - input stream to read from
      precision - precision context used for floating point comparisons
      Returns:
      triangle mesh containing the data from the given input stream
    • boundaries

      public Stream<PlaneConvexSubset> boundaries(GeometryInput in, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Return a Stream that can be used to access all boundary information from the given input, which is expected to contain data in the format supported by this handler. Unlike the read method, this method does not require that all input be read immediately and stored in memory (although implementations of this interface are still free to do so). Callers may therefore prefer to use this method in cases where memory usage is a concern or transformations and/or filters must be applied to the boundaries before use.

      Implementing class will usually keep the source input stream open during stream iteration. Callers should therefore use the returned stream in a try-with-resources statement to ensure that all resources are properly released. Ex:

        try (Stream<H> stream = handler.boundaries(in, precision)) {
            // access stream content
        }
       

      The following exceptions may be thrown during stream iteration:

      Specified by:
      boundaries in interface BoundaryReadHandler<PlaneConvexSubset,BoundarySource3D>
      Parameters:
      in - input to read from
      precision - precision context used for floating point comparisons
      Returns:
      stream providing access to the boundary information from the given input
    • facets

      public Stream<FacetDefinition> facets(GeometryInput in)
      Return a Stream that can be used to access all facet information from the given input stream. The input stream is expected to contain data in the format supported by this handler.

      The underlying input stream is closed when the returned stream is closed. Callers should therefore use the returned stream in a try-with-resources statement to ensure that all resources are properly released.

        try (Stream<FacetDefinition> stream = handler.facets(in)) {
            // access stream content
        }
       

      The following exceptions may be thrown during stream iteration:

      Specified by:
      facets in interface BoundaryReadHandler3D
      Parameters:
      in - input stream to read from; this is not closed when the returned stream is closed
      Returns:
      stream providing access to the facet information from the given input stream