Version 0.55.1

Tesselation

The native output formats of trCAD are triangulated surface objects that can be stored in 3D file formats as stl, ply or 3mf. To create these, rounded shapes like spheres or cylinders get broken into meshes of connected triangles that approximate the original curvatures. This process is called tesselation. The size of the triangles determines, how well the roundings are conserved: the smaller the triangle, the better the curvature is approximated.

trCAD has two interacting mechanisms for determining the triangle size that is used during the tesselation processes. Both mechanisms can be controlled by the programmer/designer.

Tesselation by angular deviation

The first mechanism is focused on how coarse a given rounding is approximated in terms of its angular deviation. The figure shows a circle that is approximated by a polygon line, what can be seen as a cut-through image of a triangle mesh tesselation of a sphere.

Tesselation of a circle showing deviation angle γ and secant length s.

Angle γ measures the deviation between the secant s formed by the polygon's edge and the actual tangent at the vertex point. As one can see, a smaller parameter γ leads to shorter secants and to a finer approximation of the roundings. On the other hand, a finer approximation produces a higher number of triangles what leads to larger files and longer processing times. Angle γ can be set by the designer and should be in the range ]0° , 45°]. However, it is strongly recommended not to set γ to a value smaller than 1° to avoid massive oversampling. γ is set by the document-global parameter document.gamma:

Example

document.gamma = rad( 5.0 )
make sphere()

The default value of γ is 5°.

Tesselation by resolution

The angular deviation method is a scale free method, i.e. it breaks down a large circle into a polygon with the same number of secants as it does for a small one. This behavior may be unwanted when it comes to construction of real physical objects, e.g. for 3D printing. Since every manufacturing process has a lowest level of resolution it can create, object details smaller than this are redundant and one may want to save the memory resources used for storing these. This can be achieved by the tesselation by resolution mechanism. trCAD will not create details that are significantly smaller than the resolution parameter smin. One can think of this as the smallest secant length that is created, even when the angular deviation mechanism suggests to build a smaller one. Be aware that this implies, that objects smaller or thinner than smin may not be build at all. This makes sense, since these objects wouldn't be realized by the final 3D manufacturing.

Parameter smin can be set to 0 or any positive value by setting parameter document.smin. Setting smin to 0 turns off the resolution tesselation mechanism completely. The program will then solely use the angular deviation mechanism.

The default value of smin is 0.01.

Multiple resolutions in a single object

The current value of the document parameters document.gamma and document.smin is always applied whenever a make command is executed. This means changing the parameters between two make command calls results in differently tesselated outputs. The following example shows how spheres with different levels of tesselation can be created:

Example

float dGamma = 45.0
for( int i = 0; i < 5; i++ )
{
  document.gamma = rad( dGamma )
  make sphere( 1.0, <[2*i, 0, 0]> )
  dGamma /= 2.0
}

Result of the example showing multiple spheres created with different values of γ (from left): 45°, 22.5°, 11.25°, 5.625° and 2.8125°.

Other tesselation limits

In addition to the tesselation by angular deviation and by resolution mechanisms, trCAD CAD has certain fixed minimum parameters for specific tesselation purposes, e.g. a circle will never be tesselated by a polygonial with less than 16 secants.

🗙

Search results for