Randomized Object Placement on Faces (Ruby Snippet)
At least when it comes to creating realistic-looking vegetation in SketchUp, it is important to be able to randomly place, scale, and rotate objects. Nothing looks worse than a "sterile" copied/pasted row of trees, for example. Of course, this applies to other objects as well, like e.g. a shag carpet or fur. Let's fix this with today's code snippet.
Random grass in a randomized landscape
Typically, the objects to be placed would come in the form of components (trees, grass, bushes, as in the image above). And those then need to be placed somewhat randomly on one or more faces in your model. A good example for that is a lawn, as I discussed in Chapter 5 in my book. As I mention in Chapter 4, there are of course several extensions available that let you accomplish this task. However, as it turns out, we can re-use two pieces of example code from Chapter 7 and do this with just a few...