Vizard 8 » Command Index » Vizard objects » node3d » <node3d:onthefly>.setVertex
8.0

<node3d:onthefly>.setVertex

Modify a vertex position of an On-The-Fly object

<node3d:onthefly>.setVertex(  
index  
[x,y,z]  
mode = viz.ABS_LOCAL # Positional argument
)  
index
0-based index of the vertex. Negative index can also be used to reference from end of vertex list.
[x,y,z]
The new position of the vertex
mode = viz.ABS_LOCAL
One of the following modes:

Vertex modes

viz.ABS_LOCAL

Set the raw position of the vertex.

viz.REL_LOCAL

Add the position to the existing raw position.

viz.ABS_PARENT

Set the position of the vertex in the coordinate frame of the parent node.

viz.REL_PARENT

Add the vertex to the existing position in the coordinate frame of the parent node.

viz.ABS_GLOBAL

Set the position of the vertex in the global coordinate frame.

viz.REL_GLOBAL

Add the vertex to the existing position in the global coordinate frame.

Remarks

This command allows you to modify the position of a specific vertex in the On-The-Fly object. The index is a number that can start from 0 and go up to, but not including, the number of vertices in the object.

Note: If you are frequently changing the position of a vertex, then use the <node3d:onthefly>.dynamic command to speed up rendering.

Return Value

None

Example

#Create a red triangle
viz.startLayer(viz.LINE_LOOP)
viz.vertexColor(viz.RED)
viz.vertex(-1,0,0)
viz.vertex(1,0,0)
viz.vertex(0,1,0)
triangle = viz.endLayer()

.
.
.

#Move the tip of the triangle higher
triangle.setVertex(2,0,2,0)

#Set vertex position in global coordinates
pos = [0,3,0]
triangle.setVertex(0,pos,viz.ABS_GLOBAL)

See also

<node3d:onthefly>.dynamic
<node3d:onthefly>.static
<node3d:onthefly>.setNormal
<node3d:onthefly>.setTexCoord
<node3d:onthefly>.setVertexColor