Algosim documentation: model

model

Creates a new 3D model based on vertex and face data.

Syntax

Description

model(s) creates a 3D model based on the vertex and face data given in s.

s must be in the Algosim 3D model format, a superset of a subset of the Wavefront OBJ format.

model(s, a, f, d, α) translates the object by a, scales it by diag(f), aligns its axis with d, and rotates it an amount α about its axis.

If omitted, a defaults to ❨0, 0, 0❩, f to ❨1, 1, 1❩, d to ❨0, 0, 1❩, and α to 0.

The object is shown in the current scene and a reference to the object is returned.

The AdjustVisual function can be used to adjust the appearance of the object. See Visual settings for a list of applicable settings.

Examples

icosahedron ≔

"
v 0 -1 -1.61803398874989485
v 0 -1 +1.61803398874989485
v 0 +1 -1.61803398874989485
v 0 +1 +1.61803398874989485
v -1 -1.61803398874989485 0
v -1 +1.61803398874989485 0
v +1 -1.61803398874989485 0
v +1 +1.61803398874989485 0
v -1.61803398874989485 0 -1
v -1.61803398874989485 0 +1
v +1.61803398874989485 0 -1
v +1.61803398874989485 0 +1

f 12 8 4
f 12 11 8
f 4 8 6
f 8 3 6
f 11 3 8
f 4 6 10
f 6 9 10
f 10 9 5
f 10 5 2
f 5 7 2
f 5 1 7
f 7 1 11
f 9 3 1
f 1 3 11
f 6 3 9
f 4 10 2
f 4 2 12
f 7 11 12
f 2 7 12
f 9 1 5
";

model(icosahedron)

Image 1

See also