CG programming for non-programmers, lesson 10

Today we are going to start making shapes — using a little high school math.

You probably learned in high school that the radius squared (r2) of a circle is x*x + y*y. That means we can use the expression x*x + y*y to measure the distance squared from the center of the image (that’s the place where both x and y are zero).

If we then apply our handy dandy step function, we get a disk shape.

Everything inside the disk is where r2 is less than our cutoff value. Everything outside our disk is where r2 is greater than that cutoff value.

And that is exactly what we do in lesson 10.

You can see this lesson by CLICKING HERE.

2 Responses to “CG programming for non-programmers, lesson 10”

  1. Sam Umbach says:

    This is SO MUCH FUN!! Thanks for putting this together, Ken :-)

    float y = vPos.y + 0.9*(mod(uTime,5.4)-2.4);

  2. admin says:

    You are very welcome. It’s fun for me as well! I like your little animation trick. Very elegant.

Leave a Reply