Vizard 7 » Reference » 3D models » Creating 3D models on-the-fly » Creating 3D models on-the-fly--the basics
7.7

Creating 3D models on-the-fly basics

Vizard allows you to create basic geometric objects "on-the-fly". These objects are defined by creating vertices and then connecting those vertices with lines or surfaces. Once you've created an on-the-fly object, you can treat it as you would any other 3D object. You can also access individual vertices and manipulate them independently of the rest of the objects.

 

Each object you create is defined by a layer of vertices. A layer can be a set of points, lines, triangles, quadrilaterals, or polygons. Your options for kinds of layers are listed in the table below.  

Type flag

Description

viz.POINTS

Creates a point for each vertex in the list.

viz.LINES

Creates a series of separate lines by splitting the list of vertices into pairs and drawing a line between each member in each pair.

viz.LINE_STRIP

Creates a series of connected lines by drawing a line between each vertex and the next vertex in the list.

viz.LINE_LOOP

Creates a loop of lines by drawing a line between each vertex and the next vertex on the list, and then connecting the last vertex with the first vertex on the list.

viz.TRIANGLES

Creates a series of separate triangular surfaces. The list of vertices is split into sets of three which each define a separate triangle.

viz.TRIANGLE_STRIP

Creates an series of triangular surfaces connected along shared edges.  Each contiguous trio of vertices defines a triangle in the strip.

viz.TRIANGLE_FAN

Creates a fan of triangular surfaces. The first vertex is linked to each subsequent pair of vertices tp define each triangle in the fan.

viz.QUADS

Creates a series of separate quadrilateral surfaces. The list of vertices is split into sets of four which each define a separate quadrilateral.

viz.QUAD_STRIP

Creates a series of quadrilateral surfaces connected along shared edges. Each contiguous series of four vertices defines a quadrilateral in the strip.  

viz.POLYGON

Creates a polygon. Each vertex provides a point for the polygon. Each of the inside angles created by linking the vertices must be acute.

#Example for creating a set of points:
viz.startLayer(viz.POINTS)
viz.vertex(-.5,1,5)
viz.vertex(-.5,2,5)
viz.vertex(.5,1,5)
viz.vertex(.5,2,5)
viz.vertex(0,1.5,5)
myPoints = viz.endLayer()

#Example for creating a set of lines:
viz.startLayer(viz.LINES)
viz.vertex(-1,1,5) #Vertices are split into pairs.
viz.vertex(-1,2,5)
viz.vertex(0,2,5)
viz.vertex(0,1,5)
viz.vertex(1,1,5)
viz.vertex(1,2,5)
myLines = viz.endLayer()

#Example for creating a set of quadrilaterals:
viz.startLayer(viz.QUADS)
viz.vertex(-2.25,1,5) #Vertices are split into sets of four.
viz.vertex(-2.25,2,5)
viz.vertex(-1,3,5)
viz.vertex(-1,1,5)
viz.vertex(1.,0,5)
viz.vertex(1.,2,5)
viz.vertex(2.25,2,5)
viz.vertex(2.25,1,5)
myQuad = viz.endLayer()

#Example for creating a fan of triangles:
viz.startLayer(viz.TRIANGLE_FAN)
viz.vertex(0,1,5) #All the triangles have the first vertex as a point.
viz.vertex(-1.5,1.35,10) #The other points are taken in pairs.
viz.vertex(-.25,1.5,10)
viz.vertex(0,.8,10)
viz.vertex(.25,1.5,10)
viz.vertex(1.5,1.35,10)
myTrianglefan = viz.endLayer() 

See also

In this section:

Vertex properties

Changing vertices on-the-fly

Creating models on-the-fly command table

Other sections:

3D model transform basics

Tutorial: On-the-fly objects

Example scripts:

3D objects on-the-fly