One of the strengths of the D-Cubed 2D DCM and 3D DCM geometric constraint solvers is their ability to work with models imported from other systems. Of course, before the data gets to the solver it has to be in a format which can be read into the application and this is often a major challenge in its own right. However, what I would like to focus on here is a key product feature that can help when working on imported data.
One of the most important things to remember when writing any mathematical software is that floating-point numbers are not exact, so 2.0 + 2.0 almost never equals 4.0. For example, to compare double-precision floating-point numbers you need to use a tolerance of at least 0.0000000000000002, or 2.0 x 10e-16 in scientific notation. Also, rounding errors can build up as calculations are done so it is necessary to use a larger tolerance than this. Another consideration is that accuracy can be lost if data is written out to a file and then read in.
Typically, geometry in CAD systems will be represented by floating-point numbers so the same issues will apply. This is something we take account of throughout the D-Cubed geometric constraint solvers, but we also allow an application to specify two additional tolerances: the linear resolution and the angular resolution. I’ll give some examples of how these are used.
In the first model, the user wants to put the peg in a hole that is nominally the same size, and to do this applies a coincident constraint between the two cylindrical faces. Obviously, if the radii are different it isn’t possible to make the faces coincident. In this example the 3D DCM will use the linear resolution to compare the cylinders.
In the second model, the user again wants to the put the peg into the hole, and decides to do this by making two pairs of faces coincident. What is important here is that the angles between the faces in both parts are the same, and to check this 3D DCM uses the angular resolution.
These are very simple examples just to illustrate the basics, but in the course of solving even a small model the DCM will perform many similar geometric tests, each of which will need to use the correct resolution value. Getting the code to do this correct requires a lot of skill and care, but is absolutely vital to ensure reliability.
In our geometric constraint solvers, we have default values of 10e-8 for the linear resolution and 10e-11 radians for the angular resolution. However, these can be modified by applications to suit the data. This is important for native data, but even more so for imported models which have been built in a different application. In the examples above, if the blocks were made in one application and the pegs in another it would be necessary to choose the right resolutions.
Fortunately most of this complexity is hidden from end-users. But it is worth remembering next time you use one of the many CAD applications which use the D-Cubed components how much you rely upon these little numbers.