Subject: Re: [geometry] Compute Normal in 3D
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2014-01-30 10:24:47
2014-01-29 Jon Summers <j.summers_at_[hidden]>
> My application uses a 3D coordinate system. I want to compute a normal
> for a model such as a ring. I don't see a property or algorithm that
> provides computation of a normal. Have I missed something in my searches?
> A ring would have to be planar to compute a normal, so a related question
> is "If dimensionality is greater than 2, how do I determine that a model is
Guys, correct me if I'm wrong.
Currently 3D functionality is very limited. Some functions doesn't work for
3D geometries and some silently assume that the third coordinate is equal
to 0. In particular, there is no function calculating the normal, checking
if all points are lying on some plane, etc.
So you'd be forced to calculate the normal by yourself. You probably would
like to do something like this:
1. find two nonparallel segments, and calculate the cross product (the
orientation of a polygon is known)
2. if needed, calculate the last component of the plane equation and check
if all points are lying on the same plane (WRT some EPS).
Using pure BG funcionality you'd be forced to store your normal as a point
(BG has no Vector concept). For vector/points operations you could use
non-official functions from boost/geometry/arithmetic.
Alternatively, you could also use e.g. QVM (
http://www.revergestudios.com/boost-qvm/) but it isn't a part of Boost yet.
Geometry list run by mateusz at loskot.net