readOBJ {svgViewR} | R Documentation |
Reads an OBJ file
Description
Reads a mesh file in the OBJ format and returns an object of class 'obj'
Usage
readOBJ(file, scaling = 1)
## S3 method for class 'obj'
print(x, ...)
Arguments
file |
A filepath to a file of type '.obj'. |
scaling |
A scaling factor to be applied to the vertices. |
x |
an object used to select a method. |
... |
further arguments passed to or from other methods. |
Details
This function convert a Wavefront .obj file or OBJ object into a JSON (JavaScript Object Notation) object and optionally saves this JSON object as a .json file. This function only provides basic functionality, reading only vertices, normals, and faces. It has only been tested on the .obj files returned from the DICOM Medical Image Viewer Horos (formerly Osirix). This function was written in order directly convert CT scan meshes exported from Horos into the JSON format for web visualization, eliminating intermediate conversions in programs such as meshlab and Blender.
Value
a list of class "obj"
with the following elements:
vertices |
Mesh vertices. |
normals |
Normal vectors, at each vertex. |
faces |
Mesh faces (indices to vertices). |
metadata |
Mesh metadata. |
Author(s)
Aaron Olsen
See Also
Examples
## Not run:
# Read an .obj file
obj <- readOBJ('obj_file.obj')
# Print obj object
print(obj)
## End(Not run)