SclGraphicsRotateObject
Overview
Rotate all geometry in the currently open node of the graphics database by a defined amount about the X, Y and Z axes. Successive rotations are cumulative so if you need to ensure that the rotation you are setting on some geometry is not affected by prior rotations use SclGraphicsUnSetModellingMatrix to forget any existing rotation, scaling and translation settings.
SclGraphicsRotateObject is generally most useful when the data is centred on X=0, Y=0, Z=0 as the results are easier to predict. SclGraphicsTranslateObject can be used to translate geometry rotated about 0,0,0 to a location that is near other geometry of interest.
Synopsis
SclGraphicsRotateObject $xrot $yrot $zrot
Description
This command rotates all geometry in the currently open node of the graphics database by the specified amounts about the X, Y and Z axes. Note that the data is rotated about the origin so the further away from the origin the greater the relative amount of movement.
Rotations are cumulative and are inherited down the hierarchy of nodes in the graphics database.
Arguments
- xrot, yrot, zrot
Pass by value. The amount of rotation, expressed in decimal degrees, about the X, Y and Z axes respectively.
Returns
Nothing.
Examples
#
# Create a node and insert a small polyline then rotate it in an
# animation loop
#
SclGraphicsOpen mygraphicsnode
# create the lists of coordinate values
set xlist [list -0.5 0.5 -0.5 0.5 -0.5]
set ylist [list -1.0 1.0 1.0 -1.0 -1.0]
set zlist [list 0.0 0.0 0.0 0.0 0.0]
# insert the polyline and remember its key
set key [SclGraphicsInsertPolyline $xlist $ylist $zlist ]
# set the rendering attributes
SclGraphicsSetColour "lines=pink"
SclGraphicsSetVisibility "markers=off"
SclGraphicsSetLineWeight 2
SclGraphicsSetLinePattern "---"
SclGraphicsSetHeuristics "quick moves=on"
for {set i 0} {$i < 180} {incr i} {
SclGraphicsRotateObject 0.0 0.0 2.0
SclGraphicsUpdateDisplay
}
SclGraphicsClose
See Also
SclGraphicsScaleObject
SclGraphicsTranslateObject
SclGraphicsUnSetModellingMatrix