Action:
|
Creates a transform to rotate an object about an axis.
|
|
Filename:
|
kern/kern_scm/tran_scm.cxx
|
|
Syntax:
|
(transform:rotation origin-position
|
|
|
axis-direction angle)
|
|
Arg Types:
|
origin-position
|
position
|
|
axis-direction
|
gvector
|
|
angle
|
real
|
|
|
|
Returns:
|
transform
|
|
|
origin-position specifies the start location of the rotate.
|
|
|
axis-direction specifies the axis direction of rotation. The right-hand rule determines the direction of rotation.
|
|
|
angle specifies the angle in degrees to rotate the object.
|
|
Example:
|
; transform:rotation
|
|
; Define a working coordinate system.
|
|
(define wcs1
|
|
|
(wcs (position 0 0 0) (gvector 1 0 0)
|
|
|
(gvector 0 1 0)))
|
|
;; wcs1
|
|
; Set a color for the wcs.
|
|
(entity:set-color wcs1 6)
|
|
;; ()
|
|
; Create a solid block.
|
|
(define block1
|
|
|
(solid:block (position 0 0 0)
|
|
|
(position 5 10 15)))
|
|
;; block1
|
|
; OUTPUT Original
|
|
|
; Create a transform and then create its reflection.
|
|
(define transform1
|
|
|
(transform:rotation
|
|
|
(position 0 0 0) (gvector -3 0 0) 45))
|
|
;; transform1
|
|
; Apply the transform to reflect the block.
|
|
(define transform
|
|
|
(entity:transform block1 transform1))
|
|
;; transform
|
|
; OUTPUT Result
|
|
|
|
|
Figure 15-7. transform:rotation
|