Using CGAL, how to determine the coordinates of a point from one system to another? Suppose we have:
Point p1(1.0, 1.0, 1.0);
which is expressed in the typical coordinate system determined by the vectors:
Vector vx1(1.0, 0.0, 0.0);
Vector vy1(0.0, 1.0, 0.0);
Vector vz1(0.0, 0.0, 1.0);
representing the coordinate axis. Now taking the vectors of the coordinate axis of another system, how do I determine the coordinates of p1 in that system?
Vector vx2(1.0, -1.0, -1.0);
Vector vy2(-1.0, 1.0, -1.0);
Vector vz2(1.0, 1.0, 0.0);
I think I must determine a matrix for pass it to an object of CGAL::Aff_transformation_3
, but I don't know how.
Vector p2 = p1.transform(??);
Any tips?
Well, after researching a bit, I found here the theory for the solution to my problem. https://en.wikipedia.org/wiki/Change_of_basis
To clarify a bit, these definitions have built with the purpose of making the code more understandable.
typedef CGAL::Cartesian<long double> KC;
typedef KC::Point_3 Point;
typedef KC::Vector_3 Vector;
typedef CGAL::Aff_transformation_3<KC> Transform3;
After considering the above, built the affine transformation as follows:
Transform3 tr3(
vx2.x(), vx2.y(), vx2.z(),
vy2.x(), vy2.y(), vy2.z(),
vz2.x(), vz2.y(), vz2.z());
Then, with this transform object, I can get the coordinates of a point in the desired system:
Point p1_out = p1.transform (tr3);
Thanks!