Boost logo

Boost :

Subject: Re: [boost] [geometry] few questions
From: Barend Gehrels (barend_at_[hidden])
Date: 2010-04-23 03:19:51


Hi Janek,

> By looking at the documentation I can see that Geometry library is
> great for 2D polygons. I am working in 3D, so I wanted to ask about
> what I can, and what I can't. Is it possible to define 3D shapes,
> calculate their intersections, unions and so on? What about centroids
> and second (geometrical) moments of inertia?
>
No. The 3D is implemented in the design but there is hardly any
implementation. 3D points and boxes can be defined. 3D distances can be
calculated. There is some more but the operations you ask for are not
yet implemented.

> Does the geometry deal with spheres, or maybe other classical 3D
> geometries, like ellipsoid, torus or cone? What about the infinite
> geometries (like infinite cone)? Or infinitely long line?
>
The sphere is moved to an extension. The other geometries you mention
are not (yet) there. We concentrate on finishing the part for first
inclusion into Boost first.

> Also I wanted to ask about 3D points regarded as vectors. Can I add
> and subtract them? What about 3D vector cross product. What about dot
> product? I guess that I need to write that 'very old formula'
> function myself?
>
This is possible: seeing 3D points as vectors, adding and subtracting
indeed. Dot product in any dimension; cross product in 2 and 3 dimensions.

> In fact, since you are well into the subject, perhaps you could tell
> me if there are anywhere in boost a vector dot product and cross
> product implemented?
>
I know that Emil's library of which I hope it is reviewed soon does have it:

http://www.revergestudios.com/boost-la/

If accepted, we plan to merge vector operations / let them interoperate
between geometries.

> Last but not least - I am doing frequently a 3D rotation of 3D points
> using quaternions for that (this could work with rotation matrices
> too). I suppose that I would need to implement this myself to "link"
> boost::quaternion with boost::geometry::point3d.
>
I've rotated 3D shapes (linestrings) using the transformations,
delivering a KML shape like here
<http://www.xs4all.nl/~barend/geodan/poisonous_cloud.png> and here
<http://www.xs4all.nl/~barend/geodan/ve_mal.htm>.

So these things should be possible, however the calculation of the
rotation about an arbitrary axis was in draft and not yet in the SVN. If
wished I can add this once. On the other hand a link with
boost::quaternion sounds also as an attractive alternative.

Regards, Barend


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk