Boost logo

Geometry :

Subject: [ggl] sample: poisonous cloud
From: Barend Gehrels (Barend.Gehrels)
Date: 2009-04-27 15:59:27


Maybe it's nice to give an example of what can can be done with ggl, and
especially what's currently being added and why.

I created a small sample web-page here:, showing a poisonous
cloud (in Dutch: gasmal). Those clouds are normally modelled, calculated
and displayed in 2D but for a project we decided to add a 3D version for
visualization. So if you go to the referred page and download the
Microsoft Virtual Earth plugin, you'll see a 3D representation of a
dome-shaped ellipse-like geometry.

How is this created?
- a polygon is read from a shapefile
- its longest axis is determined using the new algorithm "diameter"
which calculates the diameter (furthest point pair and its distance)
from a geometry (in this case a polygon). The diameter.hpp is not yet
added to svn, will be soon. It uses brute force now (n^2) but it is
possible to use O(n log n).
- the half of the polygon is selected (using the new
"circular_iterator") and copied to a linestring
- another version of this "half" linestring is generated: where all
vertices are exactly in between the vertices of the original (this is
called the algorithm "intermediate" but maybe a more appropriate name
can be invented)
- it is then rotated along its longest axis using a 4D matrix
(generation of this matrix will be added as a transformation), in steps
of 18 degrees, 10 times until it is totally rotated 180 degrees.
Rotation is done alternating the original and the "intermediate". All
those rotated 3D linestrings are collected in a std::vector
- then, using two of these rotated 3D linestrings at a time (so a normal
one and an "intermediate" one) 3D triangles are generated (--> a 3D mesh)
- those triangles are transformed from Dutch Coordinate System (epsg
28992) to LatLong using "transform" with the new
"project_inverse_transformer". In transformation height is copied
- detail: within this generic transformation a corresponding type must
be generated with another point-type. So for polygon<P> -->
polygon<LatLong>. This is the new meta-function replace_point_type
     * note that this one can be enhanced (if possible at all) by adding
constness, and by using the original point type. The last one is
probably hard or requires specializations per point-type...
- all triangles are streamed to "VEShapes", these are Javascript Virtual
Earth shapes. Virtual Earth is Microsoft's Google Earth answer, a nice
environment where 3D can be displayed in your webbrowser
- it's also possible to generate KML (of course)
- I'll create a new sample of these procedure
- part of this procedure (rotation, intermediate and 3D mesh generation)
can be added in another algorithm, e.g. "create_mesh"
- there were already question raised: what's the volume of that cloud? NYI.

See also where more
steps are displayed:
- the ground shape in darker green
- the 3D triangles in lighter green
- the rotated linestrings in black
- the pair of points indicating the longest axis as pushpins

Note that VE even shows the weather (also clouds). Note also that during
weather-display the semi-transparante dome is sometimes not painted

Regards, Barend

Geometry list run by mateusz at