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 java.lang.Object implements BoundaryReadHandler3D
Abstract base class forBoundaryReadHandler3Dimplementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classAbstractBoundaryReadHandler3D.FacetDefinitionReaderIteratorClass exposing aFacetDefinitionReaderas an iterator.
-
Constructor Summary
Constructors Constructor Description AbstractBoundaryReadHandler3D()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.stream.Stream<PlaneConvexSubset>boundaries(GeometryInput in, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)Return aStreamthat 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.java.util.stream.Stream<FacetDefinition>facets(GeometryInput in)Return aStreamthat can be used to access all facet information from the given input stream.BoundarySource3Dread(GeometryInput in, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)Return an object containing all boundaries read frominputusing the handler's supported data format.TriangleMeshreadTriangleMesh(GeometryInput in, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)Read a triangle mesh from the given input.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.geometry.io.core.BoundaryReadHandler
getFormat
-
Methods inherited from interface org.apache.commons.geometry.io.euclidean.threed.BoundaryReadHandler3D
facetDefinitionReader
-
-
-
-
Method Detail
-
read
public BoundarySource3D read(GeometryInput in, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
Return an object containing all boundaries read frominputusing the handler's supported data format.- Specified by:
readin interfaceBoundaryReadHandler<PlaneConvexSubset,BoundarySource3D>- Parameters:
in- input to read fromprecision- 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:
readTriangleMeshin interfaceBoundaryReadHandler3D- Parameters:
in- input stream to read fromprecision- precision context used for floating point comparisons- Returns:
- triangle mesh containing the data from the given input stream
-
boundaries
public java.util.stream.Stream<PlaneConvexSubset> boundaries(GeometryInput in, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
Return aStreamthat 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 thereadmethod, 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:
IllegalArgumentExceptionif mathematically invalid data is encounteredIllegalStateExceptionif a data format error occursUncheckedIOExceptionif an I/O error occurs
- Specified by:
boundariesin interfaceBoundaryReadHandler<PlaneConvexSubset,BoundarySource3D>- Parameters:
in- input to read fromprecision- precision context used for floating point comparisons- Returns:
- stream providing access to the boundary information from the given input
-
facets
public java.util.stream.Stream<FacetDefinition> facets(GeometryInput in)
Return aStreamthat 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:
IllegalArgumentExceptionif mathematically invalid data is encounteredIllegalStateExceptionif a parsing or syntax error occursUncheckedIOExceptionif an I/O error occurs
- Specified by:
facetsin interfaceBoundaryReadHandler3D- 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
-
-