Calculating the Range of a LOD

In VRML the selection of a LOD is performed by comparing ranges. A viewer switches to the next LOD if the distance of the LOD to the viewpoint is greater or equal to a specified value.

Switching from a LOD to the next means that representatives are selected from clusters of points. All points within a cluster are moved to the representative. The program calculates the range of a LOD so that the maximum deferral of these points projected to the screen is below a specified value. This value can be set with the commandline option -e or --errorrange. If you specifiy an errorrange of 10 this means the maximum deferral of the points on screen is below 10% of the height of the screen. If you do not specify this option a default value of 2% will be used.


How will this range be calculated ?

The viewer must switch to the next LOD if the maximum deferral s projected into the screen is greater than errorrange % of the height of the screen. The deferral s is defined by the diagonal of the smallest cube in the octree of the next LOD.

So s is calculated as follows:

The points will be projected into a projection plane (the screen) with distance 1 to the camera. The height of the screen is determined by the camera height angle:

The maximum deferral s projected into the screen is called ps. A viewer must switch to the next LOD if ps is greater than:

Now the distance for switching can be calculated:

Finally the formula for the distance d is:

d = s / (errorrange/100 * 2 * tan(alpha/2) )

The program adds to this distance d the radius of the bounding sphere of the coordinates in the next LOD.