Querying BRep solids

 

Calculating distances and angles

Calculating area of all faces

Calculation of volumetric properties

 

Calculating distances and angles

  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.

 

Calculating area of all faces

  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:

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).

nx = Sx / Sface
ny = Sy / Sface
nz = Sz / Sface

Calculation of volumetric properties

  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