4 Scale
bi0qaw edited this page 2017-11-25 17:13:04 +01:00

Vectors

%vectors% scaled by %number% [in direction of %vector%]

Locations

%locations% scaled at %location% by %number% [in direction of %vector%]

Scales a list of locations or vectors by a number.


Effect of direction vector on scaling

With scaling factor = 1

Scaling Direction Vector
all points move to the center 0, 0, 0
no scaling 1, 1, 1
scaling by a factor of 2 2, 2, 2
scaling by a factor of 2 in the x-direction 2, 1, 1
scaling by a factor of 2 in the y-direction 1, 2, 1
scaling by a factor of 2 in the z-direction 1, 1, 2
shrinking by a factor of 2 1/2, 1/2, 1/2
shrinking by a factor of 3 1/3, 1/3, 1/3
scaling by a factor of a, b, c in the x-, y- and z-direction a, b, c

Note that the scaling factor just multiplies all the scalings applied by the direction vector. Using a scaling factor of 2 and a direction vector of 1, 2, 3 is the same as using a scaling factor of 1 and a direction vector 2, 4, 8.


Example:

set {_circle::*} to circle with radius 1 and density 5
set {_scaled::*} to {_circle::*} scaled by 2

With locations:

set {_circle::*} to circle at player with radius 1 and density 5
set {_scaled::*} to {_circle::*} scaled at player by 2

This example scales the original circle by a factor of 2, which makes the radius of the circle 2 times larger. An image of the result (green particles = original, flame particles = scaled)


We can use the direction vector to create an ellipse:

set {_circle::*} to circle with radius 1 and density 5
set {_scaled::*} to {_circle::*} scaled by 1 in direction of vector 2, 1, 1

With locations:

set {_circle::*} to circle at player with radius 1 and density 5
set {_scaled::*} to {_circle::*} scaled at player by 1 in direction of vector 2, 1, 1

The result is an ellipse that has a two times larger radius in the x-direction than in the z-direction. Image with the green particles showing the original circle and the flame particles showing the ellipse:


The same is possible with 3D shapes like spheres, which we can scale in all 3 dimensions at once:

set {_sphere::*} to sphere with radius 1 and density 5
set {_scaled::*} to {_sphere::*} scaled by 2 in direction of vector 1, 2, 3

With locations:

set {_sphere::*} to sphere at player with radius 1 and density 5
set {_scaled::*} to {_sphere::*} scaled at player by 2 in direction of vector 1, 2, 3

Which results in an ellipsoid:

Note also that the ellipsoid has not more points than the sphere. Sometimes it is therefore more useful to make a bigger shape and then shrink it to keep a high density of points. We can change the previous example to use a big sphere and then shrink it:

set {_sphere::*} to sphere with radius 6 and density 5
set {_scaled::*} to {_sphere::*} scaled by 1 in direction of vector 1/3, 1/2, 1

Which results in an ellipsoid with a lot more points: