Boost logo

Geometry :

Subject: Re: [geometry] translation and rotation proposal
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2013-05-28 19:26:05


Adam Wulkiewicz wrote:
> Hi,
> I've been thinking about additional concepts like vector, matrix, etc.
> and how they could be used in Boost.Geometry. In our context they
> probably should be seen only as translation and rotation representations.
> So I think about following use cases:


In the free time you may check extensions/algebra. For now there is only
Vector concept and some algorithms (for now only for vectors defined in
cartesian cs). Basically this is what is implemented now:

typedef bg::model::point<
   double, 3, ::boost::geometry::cs::cartesian> p3d;
typedef bg::model::box<p3d> b3d;
typedef ag::model::vector<double, 3> v3d;

v3d v;
bg::set<0>(v, 1);
bg::set<1>(v, 2);
bg::set<3>(v, 3);
double x = bg::get<0>(v);
double y = bg::get<1>(v);
double z = bg::get<2>(v);

bg::assign_values(v, 10, 11, 12);

// get vector
p3d p1, p2;
bg::translation(p1, p2, v);
v = bg::return_translation<v3d>(p1, p2);

// translate point
bg::translate(p1, v);
bg::translated(p1, v, p2);
p2 = bg::return_translated<p3d>(p1, v);

// translate box
b3d b1, b2;
bg::translate(b1, v);
bg::translated(b1, v, b2);
b2 = bg::return_translated<b3d>(b1, v);

I was probably too hasty with the rotation proposal and must think more
about it.

Another thing, if we have transformations in the future, it would
probably be good to replace translate() and rotate() with one
transform() function working for vectors, rotation and transformation
matrices, quaternions, etc.
And then replace translation() by some more general name like


Geometry list run by mateusz at