Subject: CGAL users discussion list
List archive
- From: "Max" <>
- To: "" <>
- Subject: [cgal-discuss] Coordinate Transformation
- Date: Thu, 17 Jan 2008 14:13:24 +0800
- Disposition-notification-to: "Max" <>
- Organization: LoadCom
Hello
I need to do some coordinates transformation between severl 3d coordinate
frames. At first I wrote the following code to do the transformation,
template<typename Vector_3>
CGAL::Aff_transformation_3<typename Vector_3::R> MakeUserCoordSysFromVectors(
const Vector_3& x, const Vector_3& y, const Vector_3& z )
{
// make a transformation from global/default coord system
// to the user/local system specified by the x/y/z *UNIT*
// vectors denoting the user system's x/y/z axis
return CGAL::Aff_transformation_3<Kernel>
(x.x(), x.y(), x.z(),
y.x(), y.y(), y.z(),
z.x(), z.y(), z.z());
}
but I got a compiler error. To have the code compiled, I changed the code
to this:
template<typename Vector_3>
CGAL::Aff_transformation_3<typename Vector_3::R> MakeUserCoordSysFromVectors(
const Vector_3& x, const Vector_3& y, const Vector_3& z )
{
return CGAL::Aff_transformation_3<Kernel>
(CGAL::to_double(x.x()), CGAL::to_double(x.y()),
CGAL::to_double(x.z()),
CGAL::to_double(y.x()), CGAL::to_double(y.y()),
CGAL::to_double(y.z()),
CGAL::to_double(z.x()), CGAL::to_double(z.y()),
CGAL::to_double(z.z()));
}
yes, it got compiled and worked ok. But I think it's not good enough -
for any exact kernel, an conversion to double and then back may lose
the should-have exactness. How to get rid of this drawback? Is there
any other solution more elegant?
Thanks for any help.
B/Rgds
Max
- [cgal-discuss] Coordinate Transformation, Max, 01/17/2008
- Re: [cgal-discuss] Coordinate Transformation, Max, 01/17/2008
- [cgal-discuss][Nef_polehedron]convert_to_Polyhedron ( Polyhedron& P), Max, 01/17/2008
- Re: [cgal-discuss][Nef_polehedron]convert_to_Polyhedron ( Polyhedron& P), Peter Hachenberger, 01/17/2008
- Re: Re: [cgal-discuss][Nef_polyhedron]convert_to_Polyhedron (Polyhedron& P), Max, 01/18/2008
- Re: Re: Re: [cgal-discuss][Nef_polyhedron]convert_to_Polyhedron (Polyhedron& P), Max, 01/18/2008
- Re: Re: Re: [cgal-discuss][Nef_polyhedron]convert_to_Polyhedron (Polyhedron& P), Peter Hachenberger, 01/18/2008
- Re: Re: Re: [cgal-discuss][Nef_polyhedron]convert_to_Polyhedron (Polyhedron& P), Max, 01/18/2008
- [cgal-discuss] Order of including CGAL header files, Max, 01/18/2008
- Re: Re: [cgal-discuss][Nef_polyhedron]convert_to_Polyhedron (Polyhedron& P), Max, 01/18/2008
- Re: [cgal-discuss][Nef_polehedron]convert_to_Polyhedron ( Polyhedron& P), Peter Hachenberger, 01/17/2008
Archive powered by MHonArc 2.6.16.