ANN: Displacement Scaling of graphic objects

Jim Hurley jhurley at infostations.com
Wed Mar 15 14:03:36 EST 2006


Scaling is a very common feature of all graphics applications, e.g. 
Illustrator and Freehand. But there is another type of scaling that 
is sometimes useful; for lack of a better expression I'll call it 
displacement scaling. (Thanks to a suggestion from Scott Rossi for 
bringing this up.)

As a simple example, consider a rectangle of width w and height h. If 
you magnify this in Illustrator or Freehand by an amount m, you get a 
rectangle with sides m*w and m*h. This  preserves the geometrical 
features of the rectangle. For example the tangent of the angle 
between the diagonal and the base is h/w in both rectangles.

But  suppose you wanted to make a frame by putting two rectangles 
together, one inside the other. You would want all the sides of the 
expanded rectangle to be at a uniform distance, say "d", from the 
original--as in a frame. This expanded rectangle does not preserve 
the geometry. The tangent of the diagonal angle becomes: 
(h+2d)/(w+2d), which is not the same as h/w. In fact, for large 
displacements, the rectangle becomes a square--the tangent approaches 
one. (Similarly, an expanded ellipse approaches a circle.)

The stack "ScaleMe" performs this displacement scaling on all 
polygons. (It also applies to any polygon with sufficient points that 
it approximates a curved figure, for example an ellipse.)

It presents some interesting problems, particularly when the graphic 
points are numerous and close together--as in an ellipse. In this 
case it is necessary to define the points of the graphic, not by Run 
Rev's graphic points (with just 3 significant figures) but with the 
full precision of Run Rev's decimal calculations. The calculated 
graphic points are stored in a custom property of the graphic. The 
points then are stored both as the customary 3 digit graphic points 
for purposes of display and as a decimal (8 displayed , 15 total?) 
digits for purposes of calculation.  (Scott: This eliminates all the 
problems we had with such figures.)

The stack shows how to create some dazzling graphic figures by 
repeatedly scaling a simple form and setting each displaced figure to 
a different color. It also touches on fractal graphics.

In the message box:

go url "http://home.infostations.net/jhurley/ScaleMe3.rev"



More information about the use-livecode mailing list