Skip to main content

Units, tolerance and precision

Numbers have no unit​

A length in Bitbybit is a plain number. The kernels do not know millimetres from metres: a box of width 4 is 4 of whatever unit you decide on. Pick one for a model and keep to it, and say which one when you export: a STEP file or a 3D printer will read the numbers in a unit of its own, often millimetres. Angles, wherever a function takes one, are in degrees.

The scene does not care either, but the editors' camera starts about 22 units from the origin, which suits a model a few units across. A model in millimetres, even a single bolt through a plate, is tens of units across and stands around the camera: move the camera out with bitbybit.babylon.scene.adjustActiveArcRotateCamera, as the standard parts examples do. A scene that large also needs its shadows told how large it is.

Tolerance and precision are different things​

Two numbers decide how close is close enough, and they are easy to confuse:

  • Tolerance belongs to the kernel. It is how far apart two points may be and still count as the same point when OpenCascade joins edges, sews faces or checks a solid. The default suits most models; it matters when you import geometry from elsewhere or build at a very small or very large scale.
  • Precision belongs to drawing. A curved surface is drawn as triangles, and precision is how far those triangles may stray from the true surface. A smaller number gives smoother curves and more triangles.

Precision never changes the shape. The disc below is the same exact cylinder twice; the left one is drawn with a coarse precision of 0.5 and without its edges, so its round rim becomes a polygon, the right one with the default:

One disc, two precisions
Bitbybit Platform

One disc, two precisions in Rete

rete logoRete

Measure the two and they give the same volume, and a STEP export of either is exactly round. Only the picture differs. Lower the precision when a model is large and curved and the drawing is slow; raise it for close-ups and renders.

One precision rarely suits shapes of very different sizes. A boat in millimetres, a 20 m hull with 10 mm bolts on it, either draws its hull in millions of triangles or its bolts as rough polygons. precisionShare sizes the precision per shape instead: each shape is meshed at the larger of precision and that share of the longest side of its bounding box. With a precision of 0.05 and a precisionShare of 0.00005, the bolts mesh at 0.05 mm and the hull at 1 mm, and each looks as smooth as the other on screen. The share is 0 by default, which keeps one precision for everything.

The rest of the conventions​

Which way is up in each kernel, colours from 0 to 1, and the drawing defaults are on Conventions.