Calculating distances and angles
Calculation of volumetric properties
It is immediate. To calculate distances between vertices, and angles between edges, simply apply the usual formulae using geometric information of vertices stored in the Brep model. Follow the same to calculate distances between edges or other calculations involving distances and intersections.
To calculate the area of the entire outer surface of an object, simply accumulate the area of all its faces. To calculate the area of each face:
Calculate its non-normalized normal vector (we suppose that external polygons of faces are oriented following the right-hand rule, so normals point outside the object). We can easily see that the components of normal vector of polygon p (oriented outside the object) area the areas of p projections on the three canonical planes. Hence,
Sx = 0.5 * sum (
( y[i] - y[j] ) * ( z[i] + z[j] ) )
Sy = 0.5 * sum ( ( z[i]
- z[j] ) * ( x[i] + x[j] ) )
Sz = 0.5 * sum ( ( x[i] - x[j]
) * ( y[i] + y[j] ) )
The sum has to be done for all edges of polygon p: index i varies between 1 and N, where N is the number of vertices of p. Here we assume that coordinates of initial vertex of the i-th edge are (x[i], y[i], z[i]), and the ones for ending vertex are (x[j], y[j], z[j]). Index j equals i+1 excepting the case where i=N; in that case j=1. We immediatly see that non-normalized normal vector has components (nx, ny, nz) = (Sx, Sy, Sz) (this is based in two geometric facts: components of normalized normal vector are the director cosinus, and values Sx, Sy, Sz are the products of the face area times each of director cosinus).
Calculate the face area from its projections:
Now, we finally can normalize the normal vector (its magnitude equals Sface). Normalized components of normal vector are obviously:
nx = Sx / Sface
ny = Sy / Sface
nz
= Sz / Sface
Coordinates of center of mass, and volume of the object, can be obtained using the Gauss theorem and performing the integral along the object's surface, stored in the BRep model:
Volume:
Coordinates of center of mass:
Moment of inertia, x-x axis:
There are other similar formulas for other volumetric properties.
Calculation of the integral is done numerically, according to Gaussian integration method. Let M be the matrix:
The algorithm calculating these information is as follows:
Calculated triangles are shown in the following figure:
generating the following triangles:
|
k |
TRIANGLE |
|
3 |
1,2,3 |
|
4 |
1,3,4 |
|
5 |
1,4,5 |