Difficulty |
2 |
Prerequisites |
1. Resizing
Say you have a primitive and want to resize it along the X-axis so that its total width is 0.2.
You can of course use the scale
function, but this requires you to determine the original width of the primitive and then compute the factor by which to multiply so that its size ends up at 0.2
.
We can make a smarter scaling function, one which instead of expecting a scaling factor gets a target size.
var scaled = scale(some_factor, 1, 1, primitive)
// becomes
var scaled = resize_x(0.2, primitive)
Create new files
|
2. Uniform Resizing
resize_x(primitive, target_width)
lets you easily create a primitive of width target_width
, but it does so by squashing the primitive.
Perhaps you want the height and depth to be scaled alongside its width, i.e., scaling uniformly along all three dimensions, so that the primitive maintains its propertions.
Implement functions with signature
|
3. Evaluation
TODO