mirror of https://github.com/CGAL/cgal
Sphere_3::orthogonal_transform fixes:
- was only declared in Homogeneous - was buggy in Cartesian - was not tested
This commit is contained in:
parent
3eac87c674
commit
290a24c95e
|
|
@ -122,7 +122,7 @@ public:
|
|||
Sphere_3 orthogonal_transform(const Aff_transformation_3 &t) const
|
||||
{
|
||||
// FIXME: precond: t.is_orthogonal() (*UNDEFINED*)
|
||||
Vector_3 vec(FT(1), FT(0)); // unit vector
|
||||
Vector_3 vec(FT(1), FT(0), FT(0)); // unit vector
|
||||
vec = vec.transform(t); // transformed
|
||||
FT sq_scale = vec.squared_length(); // squared scaling factor
|
||||
|
||||
|
|
|
|||
|
|
@ -254,6 +254,30 @@ SphereH3<R>::bbox() const
|
|||
maxx.sup(), maxy.sup(), maxz.sup());
|
||||
}
|
||||
|
||||
template <class R>
|
||||
SphereH3<R>
|
||||
SphereH3<R>::
|
||||
orthogonal_transform(const typename SphereH3<R>::Aff_transformation_3& t) const
|
||||
{
|
||||
typename R::Vector_3 vec( RT(1), RT(0), RT(0) ); // unit vector
|
||||
vec = vec.transform(t); // transformed
|
||||
FT sq_scale = FT( vec*vec ); // squared scaling factor
|
||||
|
||||
if ( t.is_even() )
|
||||
{
|
||||
return SphereH3<R>(t.transform(center() ),
|
||||
sq_scale * squared_radius(),
|
||||
orientation() );
|
||||
}
|
||||
else
|
||||
{
|
||||
return SphereH3<R>(t.transform(center() ),
|
||||
sq_scale * squared_radius(),
|
||||
CGAL::opposite( orientation()) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef CGAL_NO_OSTREAM_INSERT_SPHEREH3
|
||||
template < class R >
|
||||
CGAL_KERNEL_INLINE
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ _test_cls_aff_transformation_3(const R& )
|
|||
CGAL::Triangle_3<R> ttri;
|
||||
CGAL::Tetrahedron_3<R> tet(p1, p2, p3, p4);
|
||||
CGAL::Tetrahedron_3<R> ttet;
|
||||
CGAL::Sphere_3<R> unit_sphere(CGAL::ORIGIN, 1);
|
||||
|
||||
|
||||
CGAL::Aff_transformation_3<R> ident( CGAL::IDENTITY );
|
||||
|
|
@ -536,6 +537,10 @@ _test_cls_aff_transformation_3(const R& )
|
|||
assert( scale11.homogeneous(0,0) == scale11.hm(0,0) );
|
||||
assert( translate.homogeneous(1,2) == translate.hm(1,2) );
|
||||
|
||||
// orthogonal_transform
|
||||
assert (unit_sphere.orthogonal_transform(ident) == unit_sphere);
|
||||
assert (unit_sphere.orthogonal_transform(translate).center() == pnt);
|
||||
|
||||
std::cout << "done" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue