objToJSON: Converts OBJ to JSON

View source: R/objToJSON.R

objToJSONR Documentation

Converts OBJ to JSON

Description

Converts a mesh file in the OBJ format into the JSON format

Usage

objToJSON(obj, file = NULL)

Arguments

obj

A filepath to a file of type '.obj' or an 'obj' object, the value returned by the function readOBJ.

file

A filepath to a file of type '.json' where the converted obj object will be saved. If is NULL (default) then no file is written and the JSON object is returned.

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 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. See readOBJ for more details and limitations in .obj file reading.

Value

A JSON object, if file is NULL

Author(s)

Aaron Olsen

See Also

readOBJ

Examples

## Not run: 
# Convert OBJ to JSON file
objToJSON(obj='obj_file.obj', file='json_file.json')

# Convert OBJ to JSON list object
json_list <- objToJSON(obj='obj_file.obj')

## End(Not run)

svgViewR documentation built on Aug. 29, 2023, 1:06 a.m.