fromThreeScript

by Stewart Dickson

This is a program for converting a ThreeScript-format geometrical object description file to one of the Open Inventor file format.

Program Command Usage

fromThreeScript [options] infile.3s outfile.iv

Options:

The infile.3s is assumed to be of the format as produced by the Mathematica Graphics/ThreeScript standard package.

The ThreeScript Input File Format

The following example ThreeScript file is a tetrahedron, produced from Mathematica's Graphics/Polyhedra standard package.
% Graphics3D objects
boundingbox
-1.414213562373095 -0.816496580927726 -0.5773502691896258
1.414213562373095 1.632993161855452 1.732050807568876
viewpoint
1.3 -2.399999999999999 2.
ambientlight
0 0 0
lightsources
1. 0. 1.
1 0 0
1. 1. 1.
0 1 0
0. 1. 1.
0 0 1
polygon
0 0 1.732050807568876
0 1.632993161855452 -0.5773502691896258
-1.414213562373095 -0.816496580927726 -0.5773502691896258
polygon
0 0 1.732050807568876
-1.414213562373095 -0.816496580927726 -0.5773502691896258
1.414213562373095 -0.816496580927726 -0.5773502691896258
polygon
0 0 1.732050807568876
1.414213562373095 -0.816496580927726 -0.5773502691896258
0 1.632993161855452 -0.5773502691896258
polygon
0 1.632993161855452 -0.5773502691896258
1.414213562373095 -0.816496580927726 -0.5773502691896258
-1.414213562373095 -0.816496580927726 -0.5773502691896258

Note

In the ThreeScript file format, the geometrical vertices are listed explicitly in the specification of the polygons. That is, the polygons are not indexed and the vertices between adjacent polygons sharing a common edge are not welded.

The fromThreeScript -w (weld) option allows the input to be converted into a topologically continuous polygon mesh.

In order that a polygon mesh can be treated as a continuous surface, neighboring polygons sharing a common edge must reference the same, single pair of vertices defining that edge.

The fromThreeScript -w (weld) option will remove the redundant vertices at each common edge and produce welded Open Inventor IndexedFaceSet nodes on output.

The optional floating-point number after the -w option is the welding resolution, or the distance below which vertices will be considered identical.

Without specifying the welding resolution, fromThreeScript will dynamically set the effective welding resolution to be one-half the length of the shortest polygon edge it encounters.

fromThreeScript reports the value of the effective welding resolution after conversion to allow the user to fine-tune this value, if necessary.

fromThreeScript -q will output the geometry as an Open Inventor SoQuadMesh node. SoQuadMesh is even more restrictive than simply welded topology, because the coordinates in the assicuated SoCoordinate3 node must be in strict row-major order.

The conversion to an SoQuadMesh can be accomplished if the ThreeScript-format output from Mathematica was the result of a ParametricPlot3D operation.

The values of the -r and -c parameters will correspond to the values in the PlotPoints option to ParametricPlot3D in Mathematica.

See Also