entity:rotate
List of: Scheme Extensions
Subjects: Entity
Contents: Kernel

Action: Rotates an entity or list of entities.

Filename: kern/kern_scm/transform_scm.cxx

APIs: api_transform_entity

Syntax: (entity:rotate body-list [xorigin yorigin zorigin]


xaxis yaxis zaxis angle [fix-transform])

Arg Types: body-list entity | entity ...

xorigin real

yorigin real

zorigin real

xaxis real

yaxis real

zaxis real

angle real

fix-transform boolean

Returns: (entity | entity ...)

Errors: Given entity or entities must be a body.

Description: This is a faster way to rotate entities in Scheme. Before (entity:rotate), one had to type:


(entity:transform ent


(transform:rotation (position x y z)


(gvector x y z) angle))


This shorthand version lets you do the same operation with:


(entity:rotate ent x y z x y z)


body-list specifies an entity or a list of entities that has to be rotated.


xorigin, yorigin, and zorigin specifies the origin point for rotation. If the origin values are not specified, then (0,0,0) is taken as the default origin.


xaxis, yaxis, and zaxis specifies the axis for rotation.


angle specifies the rotation angle in degrees.


fix-transform is an optional argument that allows the transforms to be fixed to the bodies (#t).

Example: ; entity:rotate

; Create a cylinder.

(define c (solid:cylinder


(position 0 0 0) (position 10 10 10) 5))

;; c

; Move the cylinder.

(define move (entity:move c 10 0 0))

;; move

; Scale the cylinder.

(define scale1 (entity:scale c 3 1 1))

;; scale1

; Apply uniform scale.

(define scale2 (entity:scale c 2))

;; scale2

; Rotate about (position 20 0 0) (vector 0 0 1)

; by 90 degrees.

(define rotate1 (entity:rotate c 20 0 0 0 0 1 90))

;; rotate1

; Rotate about (position 0 0 0) (vector 0 0 1)

; by 90 degrees.

(define rotate2 (entity:rotate c 0 0 1 90))

;; rotate2

; Reflect across (position 40 0 0) (vector 1 0 0).

(define reflect1 (entity:reflect c 40 0 0 1 0 0))

;; reflect1

; Reflect across (position 0 0 0) (vector 1 0 0).

(define reflect2 (entity:reflect c 1 0 0))

;; reflect2
PDF/KERN/12SCA.PDF
HTM/DATA/KERN/KERN/12SCA/0099.HTM