Interactive Model Dimensions: This is an embedded interactive Java applet that demonstrates the automatic generation and update of model dimensions. Click on any object or facet in the scene to see dynamically auto-generated dimensions, Use the middle and right buttons to pan and rotate the view.

Overview

The applet basically displays the dimensions of each 3D form as you drag it or any of its facets around to change shape. Simply left-click any facet to select it and then click+drag the displayed arrows at its centre point to move it along its surface normal. Double-click to select the whole object, in which case you can drag it around or use the X, Y and Z keys, with the SHIFT key to reverse direction, to move the selection in corresponding axis. Use the Settings panel to play with different dimension parameters.

Background

A significant part of that 6-day period was spent dealing with radial dimensions that show an arc and an angle between two 3D lines. Whilst it was possible to get most things working with standard 3D matrix rotations, because I wanted just a single method to deal with all possible configurations, I ran into all sorts of trouble when both lines were in arbitrary 3D directions. If either one was axially aligned or ran parallel to one of the Cartesian planes, you could work out the rotations required. However, with both in arbitrary 3D directions, there was no reference point to properly orient the third axis.

Also, at one point I spent many hours debugging one particular angle flip only to find that it may actually have been due to an instance of Gimbal Lock. Who knows if that was really the case but, as I subsequently discovered, I am by no means the first programmer to trip over that particular log and hence began my dalliance with quaternions. I am no maths guru and most sites that describe quaternions assume you are. However, they did seem to make a bit of sense and actually turned out to be the answer to a couple of other transformation niggles I’d been having.

Dimension Settings

The following is a brief explanation of the various dimension settings available in the Settings panel in the top-left of the applet.

Use Spheres Instead of Ticks

Select this option to display each dimension indicator as a small dark sphere instead of an angled, slightly thicker, tick line.

Dimension Lines Always Visible

When this option is selected, dimension lines are drawn with no depth buffer test, meaning that they will always be visible and not obstructed by other model geometry. When not selected, they are treated like any other part of the model and depth tested against obstructing surfaces.

Adjust Text Orientation with View

When this option is selected, the text on each dimension line will do its best to reorient itself so that it is always facing towards the camera. This was not as straightforward as it sounds.

First, the axis of rotation for each text block is fixed along its dimension line, so there is a limit to how appropriate that rotation can be depending on the angle the dimension line makes with the line of view. Having text that rotates around outside the axis of this line simply does not look right as the orientation of the text is a key indicator of what dimension line it belongs to.

Also, it is often necessary to flip the X and Y axis of text depending on the azimuth angle of the view relative to the dimension line. This is so that text at the same perspective angle always runs in the same relative direction. This avoids situations where the vertical text on one side of a wall runs upwards whilst the text on the other side runs downwards. This way, all parallel text runs in the same direction - upwards if vertical and left-to-right if horizontal.

Second, having text always orient to the camera at higher altitude views also didn’t look right, especially for text that ran close to parallel with the line of view. You actually do want text that is on the ground plane to look like it is on the ground plane, not to be oriented slightly off in all but plan view. This is a fine line to walk but, essentially, horizontal text in this applet only reorients when the view altitude is within about 30 degrees to the horizontal, as this is seemed the best compromise.

Use Imperial Feet and Inches

Select this option to show each dimension in feet, inches and sixteenths. Obviously the model is originally generated in SI units and the snap settings will be pretty arbitrary, but it at least shows that the units formatting is working reasonably well.

Metric Decimals

Use this slider to set the number of decimal points (precision) displayed in the metric dimension text.

Dimension Line Darkness

This just shows that it is possible to control the colour of the dimension line, though here it is just black to white.

Dimension Text Darkness

This just shows that it is possible to control the colour of the dimension text separate from the dimension line, though here again it is just black to white.

Relative Size

Use this to adjust the text size and, as it is related, the dimension line offset distance.

Adjust Text with View Distance

If the dimension text was always the same size, then dimensions on objects that are quite far away from the camera become very difficult to read - unless the text size is very large in which case dimensions on objects quite close to the camera look silly. Thus, with this option checked, the text size is adjusted so that distant text is drawn slightly larger and close text slightly smaller. The adjustment isn’t large as too much very quickly makes it all look noticeably weird.

Adjust Text with View Zoom

When you zoom into a model, text that looks fine from far away quickly starts to look too large. Thus, with this option checked, the text size of all dimensions is adjusted to get smaller relative to the model as you zoom in and slightly larger as you zoom out.

Radial Dimensions

If you select the Radial Dimensions button at the bottom left of the canvas, the applet shows three radial angles instead of the central pyramid shape. You can then interactively manipulate the vertex at the top to see the spherical arc change and the radial dimension text re-orient itself as you rotate the view. Whilst there are still a couple of orientation issues, on the whole the re-orientation of the text works reasonably well. You can use the right-mouse button to rotate the view if you haven’t already discovered it.

Show Facet Dimensions

When this button at the bottom is selected, dimensions are shown around the selected facet boundary instead of the whole object. This was an experiment to see if this can be done for any arbitrary planar shape in any orientation and still get the dimension lines on the proper ‘outer’ side of each line segment. And, apart from some degenerate shapes such as self-intersecting butterfly polygons, it turned out to be not that difficult.


Click here to comment on this page.