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

Action: Scales an entity or list of entities uniformly or non-uniformly.

Filename: kern/kern_scm/transform_scm.cxx

APIs: api_transform_entity

Syntax: (entity:scale body-list xscale


[yscale=xscale zscale=xscale] [fix-transform])

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

xscale real

yscale real

zscale real

fix-transform boolean

Returns: (entity | entity ...)

Errors: Given entity or entities must be a body. Must input either one or three positive scaling factors.

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


(entity:transform ent


(transform:scaling xscale [yscale zscale]))


This shorthand version lets you do the same operation with:


(entity:scale ent xscale [yscale zscale])


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


xscale, yscale, and zscale specifies the scaling along the X, Y, and Z axis respectively. If yscale and zscale are omitted, then uniform scaling is done using xscale along all the three axes.


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

Example: ; entity:scale

; 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/0100.HTM