public final class OBJWriter extends Object implements AutoCloseable
| Constructor and Description |
|---|
OBJWriter(File file)
Create a new instance for writing to the given file.
|
OBJWriter(Writer writer)
Create a new instance that writes output with the given writer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
DecimalFormat |
getDecimalFormat()
Get the
DecimalFormat instance used to format floating point output. |
String |
getLineSeparator()
Get the current line separator.
|
void |
setDecimalFormat(DecimalFormat decimalFormat)
Set the
DecimalFormat instance used to format floatin point output. |
void |
setLineSeparator(String lineSeparator)
Set the line separator.
|
void |
writeBoundaries(BoundarySource3D boundarySource)
Write the boundaries present in the given boundary source.
|
void |
writeComment(String comment)
Write an OBJ comment with the given value.
|
void |
writeFace(int... vertexIndices)
Write a face with the given vertex indices, specified in the OBJ 1-based
convention.
|
void |
writeGroupName(String groupName)
Write a group name to the output.
|
void |
writeMesh(Mesh<?> mesh)
Write a mesh to the output.
|
void |
writeObjectName(String objectName)
Write an object name to the output.
|
int |
writeVertex(Vector3D vertex)
Write a vertex to the output.
|
public OBJWriter(File file) throws IOException
file - file to write toIOException - if an IO operation failspublic OBJWriter(Writer writer)
writer - writer used to write outputpublic String getLineSeparator()
public void setLineSeparator(String lineSeparator)
lineSeparator - the line separator to usepublic DecimalFormat getDecimalFormat()
DecimalFormat instance used to format floating point output.public void setDecimalFormat(DecimalFormat decimalFormat)
DecimalFormat instance used to format floatin point output.decimalFormat - decimal format instancepublic void writeComment(String comment) throws IOException
comment - comment to writeIOException - if an IO operation failspublic void writeObjectName(String objectName) throws IOException
objectName - the name to writeIOException - if an IO operation failspublic void writeGroupName(String groupName) throws IOException
groupName - the name to writeIOException - if an IO operation failspublic int writeVertex(Vector3D vertex) throws IOException
writeFace(int...).vertex - vertex to writeIOException - if an IO operation failsIOException - if an IO operation failspublic void writeFace(int... vertexIndices)
throws IOException
vertexIndices - vertex indices for the face, in the 1-based OBJ conventionIOException - if an IO operation failspublic void writeBoundaries(BoundarySource3D boundarySource) throws IOException
Mesh,
it is written using writeMesh(Mesh). Otherwise, each boundary is written to the output
separately.boundarySource - boundary source containing the boundaries to write to the outputIllegalArgumentException - if any boundary in the argument is infiniteIOException - if an IO operation failspublic void writeMesh(Mesh<?> mesh) throws IOException
mesh - the mesh to writeIOException - if an IO operation failspublic void close()
throws IOException
close in interface AutoCloseableIOExceptionCopyright © 2016–2020 The Apache Software Foundation. All rights reserved.