In this course module, we will investigate three concepts: rigid-body
transformations, primitive instancing,
and parametric modeling. These
concepts will be illustrated through a fairly simple example of a windmill.
We will begin by introducing rigid-body transformation and primitive instancing
first, then model the windmill a second time using parametric modeling.
A robot arm and a windmill share an important characteristic, relevant
to transformations - they are both open-loop mechanisms, where relative
transformations describe their motion.
With reference to Figure 1, our simple windmill consists of a base,
a house, and four blades that turn on a shaft (but the shaft is not modeled
geometrically). The geometry of the windmill is created by instantiating
simple geometric objects (cone, block), then scaling, translating, and
rotating them appropriately. For example, the base is a cone with a height
of 5 meters and radius of 4 meters. It is located at the global origin,
so no translation or rotation transformations were applied to it. The house
is 10 m in width and depth, and 15 m high. It rotates around a vertical
axis, which coincides with the global Z axis in this example.
Figure 1 Windmill with Coordinate System.
To download the Matlab code for the windmill, click here: windmill.m or click here windpc.m for a version runnable on computers that can only deal with 8-character file names.
To instantiate the base, it is only necessary to scale a nominal cone.
Given a cone with a 1 m height and 1 m radius, the appropriate scale matrix
is:
Then, the MATLAB code to compute line segment vertices for display of
the base is:
Base = BaseScale * Cone
To instantiate the house, it is necessary to scale a cube, rotate the
cube around the X axis by 90 degrees, then translate it along the Z axis
by the height of the base. Why the X-rotation? Because one face of the
cube is centered in the XZ plane, with the cube extending along the Y axis.
The rotation centers the face in the XY plane. The translation, orientation,
and scale matrices are
Since the house rotates relative to the base, it is necessary to add
a z-rotation transformation. Let the house rotation be denoted theta. Since
in our convention, post-multiplication of matrices denotes relative transformation,
the MATLAB code to compute line segment vertices for display of the house
is:
House = HouseTrans * Rot(z,theta) * HouseOrient * HouseScale * Cube
To model the propeller, it is necessary to introduce the shaft, even
though there is no model of the shaft displayed. The shaft rotates about
an axis parallel to the house's Z axis, at a height 10 m above the base
of the house. To facilitate positioning blades on the shaft, the coordinate
origin for the shaft will be translated to the blade-shaft interface at
a location of -6 m along the Y axis. Denote the shaft's rotation about
this axis by alpha. Note that the shaft's rotation is relative to the house's
rotation. So, the shaft is positioned using the following equation:
Shaft = HouseTrans * Rot(z,theta) * Translate(0, -6, 10) * Rot(y,alpha)
The four blades of the propeller are each modeled as scaled squares
centered in the XY plane with the blade's length along the X axis. To instantiate
these blades into the windmill, it is necessary to rotate them into the
XZ plane and move their coordinate origins to their left edge (draw a picture).
Let the length of each blade be 7 m and their width be 0.5 m. The equation
for computing vertices for the first blade is:
Blade1 = Shaft * Rotate(x, 90) * Translate(3.5, 0, 0) * Scale(7, 0.5,
0) * Square
Each subsequent blade is rotated an additional 90 degrees about the
local Z axis. Thus the second blade is given by:
Blade2 = Shaft * Rotate(x, 90) * Rotate(z, 90) * Translate(3.5, 0, 0)
* Scale(7, 0.5, 0) * Square
Now, consider the need to change the dimensions of the windmill. It would be a shame to have to recreate the geometry of the windmill each time that a simple change in dimension is needed. We will recreate the geometry here using parameters and parametric relationships in order to illustrate the power (and limitations) of parametric modeling.
To begin, let's introduce parameters that describe the size of the windmill base:
Then, the appropriate scale matrix is:
In a similar manner, the house dimensions and translation, orientation,
and scale matrices are
, ,
The propeller modeling will be presented in some detail. Again, we will introduce the shaft, even though there is no model of the shaft displayed. The shaft rotates about an axis parallel to the house's Z axis, at a height that will be dependent upon the height of the house. Let's introduce the parameter, ShaftHeightFactor, to help control the shaft height. Furthermore, let's introduce a parametric relationship to completely control shaft height, relative to the house.
ShaftHeight = ShaftHeightFactor * HouseHeight;
Note that with this parameterization, it is impossible to directly control the absolute height of the propeller shaft, or to change the house or base dimensions to correspond to a desired shaft height. This is a significant limitation of parametric modeling, the unidirectionality of parametric relationships.
A second parametric relationship will be introduced to control the position of the blades, relative to the house. The coordinate origin for the shaft will be translated to the blade-shaft interface at a location of -6 m along the Y axis. The following relationship will be used to parameterize this distance:
ShaftY = -0.5 * HouseDepth - 1.0;
Since the shaft's rotation about its axis is alpha, the rigid-body transformation equation to position the shaft becomes:
Shaft = HouseTrans * Rot(z,theta) * Translate(0, ShaftY, ShaftHeight)
* Rot(y,alpha)
The four blades of the propeller will be modeled as above, except that dimension parameters will be introduced to control their size:
The equation for computing vertices for the first blade becomes:
Blade1 = Shaft * Rotate(x, 90) * Translate(0.5*BladeLength, 0, 0) *
Scale(BladeLength, BladeWidth, 0) * Square
Each subsequent blade is rotated as described above.
If we exercise this parameterized windmill model using the following parameter values, the windmill model of Figure 2 results.
Figure 2 Parameterized Windmill Model.
To download the Matlab code for the parameterized windmill, click here: windmillPM.m or click here windpcpm.m for a version runnable on computers that can only deal with 8-character file names.
The JAVA applet below provides an interactive illustration of the concepts of primitive instancing and rigid-body transformations. The windmill was modeled as above. Two size parameters can be controlled. Changing the Base height causes the House to translate vertically and also changes the Base radius to maintain proportionality. Changing the House height causes the blades to translate vertically so that they are always 2/3 of the way up the House. House width and depth change proportionally as well.
House rotation relative to the Base can be specified (use degrees). Also, the propeller (blades) can be rotated by specifying the rotational angle.
The view of the windmill can be controlled in a similar manner to the dynamic rotation capabilities of IDEAS and ProEngineer. Just place the cursor in the windmill area of the applet, press a mouse button, and drag the mouse in the direction of desired rotation. The initial view can be restored by hitting the Reset View button.