Centroid and Moment of Inertia This program will find the centroid

Centroid and Moment of Inertia
This program will find the centroid and area moments of inertia for a composite area with respect to a
given coordinate system. Then the program will calculate the moments of inertia for the coordinate
system that passes through the centroid. Then the program will find the principal coordinate system
that passes through the centroid and the principal moments of inertia.
The program will handle any composite area made up of as many as ten simple shapes where the basic
simple shapes are rectangles, right triangles, circles, half circles and quarter circles. The simple shapes
can be added or subtracted from the area, so the area of a simple shape can be zero in the event that the
area has a hole in it.
The first step is to break your composite area into the simple shapes. Next, if there is not a given
coordinate system, you need to establish one. Once you have your area broken down into rectangles,
right triangles, circles, half circles and quarter circles, you are ready to use the program.
The program expects information to be entered for each of the simple shapes. The program is set up
with help available so that if you can't remember what to enter you can use the mouse to press the
button that is above the column and the required information will be explained.
The information required is:
type: this is the type of simple shape you have
1 = rectangle
2 = right triangle
3 = circle
4 = half circle
5 = quarter circle
X-coord:
this will be the x coordinate of a specific point for the simple shape in the original
coordinate system
for a rectangle, x coordinate of the lower left corner
for a right triangle, x coordinate of the vertex with the 90 degree angle
for a circle, x coordinate of the center of the circle
for a half circle, x coordinate of the center of the circle
for a quarter circle, x coordinate of the center of the circle
Y-coord:
this will be the y coordinate of a specific point for the simple shape in the original
coordinate system
for a rectangle, y coordinate of the lower left corner
for a right triangle, y coordinate of the vertex with the 90 degree angle
for a circle, y coordinate of the center of the circle
for a half circle, y coordinate of the center of the circle
for a quarter circle, y coordinate of the center of the circle
B/R:
this is a dimension of the simple shape
for a rectangle, it is the base or x dimension of the rectangle
for a right triangle, it is the base or x dimension of the triangle
for a circle, it is the radius of the circle
for a half circle, it is the radius of the circle
for a quarter circle, it is the radius of the circle
H/0:
this is a second dimension of the simple shape
for a rectangle, it is the height or y dimension of the rectangle
for a right triangle, it is the height or y dimension of the triangle
for a circle, it is 0 since there is not another dimension required
for a half circle, it is 0 since there is not another dimension required
for a quarter circle, it is 0 since there is not another dimension required
Orient:
this is to specify the orientation of the simple shape
for a rectangle, this would be zero
for a right triangle, this will be non zero. Consider putting a local coordinate system at the
vertex of the triangle that has the right angle and the axes of the coordinate system along
the base and height of the triangle. Then the triangle will be located in one of the four
quadrants of the coordinate system. So orient will be:
1 when the triangle is in the first quadrant
2 when the triangle is in the second quadrant
3 when the triangle is in the third quadrant
4 when the triangle is in the forth quadrant
for a circle, this would be 0
for a half circle, this will be non zero. Consider putting a local coordinate system at the center
of the half circle and one of the axes along the base of the half circle and the other axis
on the line of symmetry for the half circle. Then the half circle will be located in two of
the quadrants of the coordinate system. So orient will be:
1 when the half circle is in the forth and first quadrants
2 when the half circle is in the first and second quadrants
3 when the half circle is in the second and third quadrants
4 when the half circle is in the third an forth quadrants
for a quarter circle, this will be non zero. Consider putting a local coordinate system at the
center of the quarter circle and the axes of the coordinate system along the edges of the
quarter circle. Then the quarter circle will be located in one of the quadrants of the
coordinate system. So orient will be:
1 when the quarter circle is in the first quadrant
2 when the quarter circle is in the second quadrant
3 when the quarter circle is in the third quadrant
4 when the quarter circle is in the forth quadrant
this is used to specify whether the simple shape is added or subtracted from the
composite area.
If the area of the simple shape is added to the total area of the composite area, then this is +1
If the area of the simple shape is subtracted from the total area of the composite area, then this is
-1
+/-:
Example:
Let's find the centroid and moments of inertia for the composite area shown above. We can see that the
composite area is made up of three simple shapes: a rectangle, a triangle and a cut out in the shape of a
quarter circle.
Consider the rectangle to be simple shape area 1. The data needed for the program is:
type = 1, x coord = 0, y coord = 0, B/R = 3, H = 4, orient = 0, +/- = 1
Take the triangle to be simple shape area 2. The data needed for the program is:
type = 2, x coord = 3, y coord = 0, B/R = 2.5, H = 4, orient = 1, +/- = 1
Then finally, the quarter circle is simple shape area 3. The data needed for the program is:
type = 5, x coord = 2, y coord = 1, B/R = 1, H = 0, orient = 2, +/- = -1
Enter this information into the program using the tab key to move from field to field or use the mouse
to select the box where you want to enter information.
When you have entered all the information, the screen will look as shown on the next page.
Now, all you need to do is hit the Calc button. You will see the screen shown on the next page.
When you look at the result, the first thing to check is the picture of the composite area and the original
coordinate system marked with a capital X and Y. It should look exactly as you intended. If it does
not, then you need to hit the x in the upper right corner in order to kill the result window and change
the input data for whatever simple shape was not drawn as intended.
The picture will show the location of the centroid marked with C and a new coordinate system will be
shown at this location with axes parallel to the original coordinate system. The axes of this coordinate
system will be marked with a lower case x and y. Also shown will be the principal coordinate system
for the composite area. This will be rotated for the x,y system and the axes will be marked by x' and y'.
To the right of the picture you will see the calculated information. The program calculates the Area, the
moments of inertia for the X, Y coordinate system, the coordinates of the centroid in the X,Y
coordinate system, the moments of inertia for the x,y coordinate system, the angle that locates the
principal axes (positive measured counterclockwise), and finally the principal moments of inertia
which are for the x', y' axes.
When you are satisfied with the result, you can kill the result window and hit the Quit button on the
data entry window to leave the program or you can use the Clear button to clear the data so that you
can enter information for a new problem. Have fun.