Class BoundaryIOManager3D

    • Constructor Detail

      • BoundaryIOManager3D

        public BoundaryIOManager3D()
    • Method Detail

      • facetDefinitionReader

        public FacetDefinitionReader facetDefinitionReader​(GeometryInput in,
                                                           GeometryFormat fmt)
        Get a FacetDefinitionReader for reading facet information from the given input.
        Parameters:
        in - input to read facets from
        fmt - format of the input; if null, the format is determined implicitly from the file extension of the input file name
        Returns:
        facet definition reader
        Throws:
        java.lang.IllegalArgumentException - if no read handler can be found for the input format
        java.lang.IllegalStateException - if a data format error occurs
        java.io.UncheckedIOException - if an I/O error occurs
      • facets

        public java.util.stream.Stream<FacetDefinition> facets​(GeometryInput in,
                                                               GeometryFormat fmt)
        Return a Stream providing access to all facets from the given input. 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 = manager.facets(in, fmt)) {
              // access stream content
          }
         

        The following exceptions may be thrown during stream iteration:

        • IllegalStateException if a data format error occurs
        • UncheckedIOException if an I/O error occurs
        Parameters:
        in - input to read from
        fmt - format of the input; if null, the format is determined implicitly from the file extension of the input file name
        Returns:
        stream providing access to the facets in the input
        Throws:
        java.lang.IllegalArgumentException - if no read handler can be found for the input format
        java.lang.IllegalStateException - if a data format error occurs during stream creation
        java.io.UncheckedIOException - if an I/O error occurs during stream creation
      • triangles

        public java.util.stream.Stream<Triangle3D> triangles​(GeometryInput in,
                                                             GeometryFormat fmt,
                                                             org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
        Return a Stream providing access to all triangles from the given input. 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<Triangle3D> stream = manager.triangles(in, fmt, precision)) {
              // access stream content
          }
         

        The following exceptions may be thrown during stream iteration:

        • IllegalArgumentException if mathematically invalid data is encountered
        • IllegalStateException if a data format error occurs
        • UncheckedIOException if an I/O error occurs
        Parameters:
        in - input to read from
        fmt - format of the input; if null, the format is determined implicitly from the file extension of the input file name
        precision - precision context used for floating point comparisons
        Returns:
        stream providing access to the triangles in the input
        Throws:
        java.lang.IllegalArgumentException - if no read handler can be found for the input format
        java.lang.IllegalStateException - if a data format error occurs during stream creation
        java.io.UncheckedIOException - if an I/O error occurs during stream creation
      • readTriangleMesh

        public TriangleMesh readTriangleMesh​(GeometryInput in,
                                             GeometryFormat fmt,
                                             org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
        Return a TriangleMesh containing all triangles from the given input.
        Parameters:
        in - input to read from
        fmt - format of the input; if null, the format is determined implicitly from the file extension of the input file name
        precision - precision context used for floating point comparisons
        Returns:
        mesh containing all triangles from the input
        Throws:
        java.lang.IllegalArgumentException - if mathematically invalid data is encountered or no read handler can be found for the input format
        java.lang.IllegalStateException - if a data format error occurs
        java.io.UncheckedIOException - if an I/O error occurs
      • write

        public void write​(java.util.stream.Stream<? extends PlaneConvexSubset> boundaries,
                          GeometryOutput out,
                          GeometryFormat fmt)
        Write all boundaries in the stream to the output.

        This method does not explicitly close the boundaries stream. If callers need to ensure that the stream is closed (for example, if the stream is reading from a file), they should use it in a try-with-resources statement outside of this method.

        Parameters:
        boundaries - stream containing boundaries to write
        out - output to write to
        fmt - format of the output; if null, the format is determined implicitly from the file extension of the output file name
        Throws:
        java.lang.IllegalArgumentException - if no write handler can be found for the output format
        java.io.UncheckedIOException - if an I/O error occurs
      • writeFacets

        public void writeFacets​(java.util.stream.Stream<? extends FacetDefinition> facets,
                                GeometryOutput out,
                                GeometryFormat fmt)
        Write all facet in the stream to the output.

        This method does not explicitly close the boundaries stream. If callers need to ensure that the stream is closed (for example, if the stream is reading from a file), they should use it in a try-with-resources statement outside of this method.

        Parameters:
        facets - stream containing facets to write
        out - output to write to
        fmt - format of the output; if null, the format is determined implicitly from the file extension of the output file name
        Throws:
        java.lang.IllegalArgumentException - if no write handler can be found for the output format
        java.io.UncheckedIOException - if an I/O error occurs
      • writeFacets

        public void writeFacets​(java.util.Collection<? extends FacetDefinition> facets,
                                GeometryOutput out,
                                GeometryFormat fmt)
        Write the given facets to the output.
        Parameters:
        facets - facets to write
        out - output to write to
        fmt - format of the output; if null, the format is determined implicitly from the file extension of the output file name
        Throws:
        java.lang.IllegalArgumentException - if no write handler can be found for the output format
        java.io.UncheckedIOException - if an I/O error occurs
      • registerDefaultHandlers

        public void registerDefaultHandlers()
        Register default read/write handlers. This method registers a read and write handler for each value in GeometryFormat3D.