This commit is contained in:
Giles Bathgate 2025-12-03 14:01:24 +01:00 committed by GitHub
commit caa3b52bc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 116 additions and 24 deletions

View File

@ -145,11 +145,16 @@ public:
transform(const Plane_3& p) const transform(const Plane_3& p) const
{ return this->Ptr()->transform(p); } { return this->Ptr()->transform(p); }
Plane_3
transform(const Plane_3& p, bool is_even, const Aff_transformation_3& transposed_inverse) const
{ return this->Ptr()->transform(p, is_even, transposed_inverse); }
Plane_3 Plane_3
operator()(const Plane_3& p) const operator()(const Plane_3& p) const
{ return transform(p); } // FIXME : not compiled by the test-suite ! { return transform(p); } // FIXME : not compiled by the test-suite !
Aff_transformation_3 inverse() const { return this->Ptr()->inverse(); } Aff_transformation_3 inverse() const { return this->Ptr()->inverse(); }
Aff_transformation_3 transpose() const { return this->Ptr()->transpose(); }
bool is_even() const { return this->Ptr()->is_even(); } bool is_even() const { return this->Ptr()->is_even(); }
bool is_odd() const { return ! (this->Ptr()->is_even()); } bool is_odd() const { return ! (this->Ptr()->is_even()); }
@ -183,8 +188,6 @@ public:
return !(*this == t); return !(*this == t);
} }
protected:
Aff_transformation_3 transpose() const { return this->Ptr()->transpose(); }
}; };

View File

@ -40,6 +40,7 @@ public:
virtual Vector_3 transform(const Vector_3 &v) const = 0; virtual Vector_3 transform(const Vector_3 &v) const = 0;
virtual Direction_3 transform(const Direction_3 &d) const = 0; virtual Direction_3 transform(const Direction_3 &d) const = 0;
virtual Plane_3 transform(const Plane_3& p) const = 0; virtual Plane_3 transform(const Plane_3& p) const = 0;
virtual Plane_3 transform(const Plane_3& p, bool is_even, const Aff_transformation_3& transposed_inverse) const = 0;
virtual Aff_transformation_3 operator*( virtual Aff_transformation_3 operator*(
const Aff_transformation_rep_baseC3 &t) const = 0; const Aff_transformation_rep_baseC3 &t) const = 0;
@ -133,14 +134,19 @@ public:
t31 * v.x() + t32 * v.y() + t33 * v.z()); t31 * v.x() + t32 * v.y() + t33 * v.z());
} }
virtual Plane_3 transform(const Plane_3& p) const virtual Plane_3 transform(const Plane_3& p, bool is_even, const Aff_transformation_3& transposed_inverse) const
{ {
if (is_even()) if (is_even)
return Plane_3(transform(p.point()), return Plane_3(transform(p.point()),
transpose().inverse().transform(p.orthogonal_direction())); transposed_inverse.transform(p.orthogonal_direction()));
else else
return Plane_3(transform(p.point()), return Plane_3(transform(p.point()),
- transpose().inverse().transform(p.orthogonal_direction())); - transposed_inverse.transform(p.orthogonal_direction()));
}
virtual Plane_3 transform(const Plane_3& p) const
{
return transform(p, is_even(), transpose().inverse());
} }

View File

@ -60,6 +60,11 @@ public:
return d; return d;
} }
virtual Plane_3 transform(const Plane_3 &p, bool, const Aff_transformation_3&) const
{
return transform(p);
}
virtual Plane_3 transform(const Plane_3 &p) const virtual Plane_3 transform(const Plane_3 &p) const
{ {
// direction ( which is (p.a(), p.b(), p.c())) does not change // direction ( which is (p.a(), p.b(), p.c())) does not change

View File

@ -57,6 +57,11 @@ public:
return d; return d;
} }
virtual Plane_3 transform(const Plane_3 &p, bool, const Aff_transformation_3&) const
{
return transform(p);
}
virtual Plane_3 transform(const Plane_3 &p) const virtual Plane_3 transform(const Plane_3 &p) const
{ {
// direction ( which is (p.a(), p.b(), p.c())) does not change // direction ( which is (p.a(), p.b(), p.c())) does not change

View File

@ -70,6 +70,9 @@ public:
virtual Plane_3 virtual Plane_3
transform(const Plane_3&) const = 0; transform(const Plane_3&) const = 0;
virtual Plane_3
transform(const Plane_3&, bool, const Aff_transformation_3&) const = 0;
virtual Aff_transformation_3 virtual Aff_transformation_3
inverse() const = 0; inverse() const = 0;
@ -134,6 +137,9 @@ public:
virtual Plane_3 virtual Plane_3
transform(const Plane_3& pl) const; transform(const Plane_3& pl) const;
virtual Plane_3
transform(const Plane_3& pl, bool is_even, const Aff_transformation_3& transposed_inverse) const;
virtual Aff_transformation_3 virtual Aff_transformation_3
inverse() const; inverse() const;
@ -207,6 +213,10 @@ public:
transform(const Plane_3& pl) const transform(const Plane_3& pl) const
{ return pl; } { return pl; }
virtual Plane_3
transform(const Plane_3& pl, bool, const Aff_transformation_3&) const
{ return pl; }
virtual Aff_transformation_3 virtual Aff_transformation_3
inverse() const inverse() const
{ return Aff_transformation_3( IDENTITY); } { return Aff_transformation_3( IDENTITY); }
@ -289,6 +299,12 @@ class Scaling_repH3 : public Aff_transformation_rep_baseH3<R>
return Plane_3(p.a()*_sf_den, p.b()*_sf_den, p.c()*_sf_den, p.d()*_sf_num); return Plane_3(p.a()*_sf_den, p.b()*_sf_den, p.c()*_sf_den, p.d()*_sf_num);
} }
virtual Plane_3
transform(const Plane_3& p, bool, const Aff_transformation_3&) const
{
return transform(p);
}
virtual Aff_transformation_3 virtual Aff_transformation_3
inverse() const inverse() const
{ return Aff_transformation_3(SCALING, _sf_den, _sf_num); } { return Aff_transformation_3(SCALING, _sf_den, _sf_num); }
@ -386,6 +402,9 @@ public:
virtual Plane_3 virtual Plane_3
transform(const Plane_3& pl) const; transform(const Plane_3& pl) const;
virtual Plane_3
transform(const Plane_3& pl, bool is_even, const Aff_transformation_3& transposed_inverse) const;
virtual Aff_transformation_3 virtual Aff_transformation_3
inverse() const; inverse() const;
@ -471,6 +490,9 @@ public:
Plane_3 Plane_3
transform(const Plane_3& pl) const; transform(const Plane_3& pl) const;
Plane_3
transform(const Plane_3& pl, bool is_even, const Aff_transformation_3& transposed_inverse) const;
Aff_transformation_3 Aff_transformation_3
inverse() const; inverse() const;
@ -577,22 +599,31 @@ template < class R >
CGAL_KERNEL_INLINE CGAL_KERNEL_INLINE
typename Aff_transformation_repH3<R>::Plane_3 typename Aff_transformation_repH3<R>::Plane_3
Aff_transformation_repH3<R>:: Aff_transformation_repH3<R>::
transform(const typename Aff_transformation_repH3<R>::Plane_3& pl) const transform(const typename Aff_transformation_repH3<R>::Plane_3& pl, bool is_even, const typename Aff_transformation_repH3<R>::Aff_transformation_3& transposed_inverse) const
{ {
if ( is_even() ) if ( is_even )
{ {
return Plane_3( return Plane_3(
transform(pl.point() ), transform(pl.point() ),
transpose().inverse().transform(pl.orthogonal_direction() )); transposed_inverse.transform(pl.orthogonal_direction() ));
} }
else else
{ {
return Plane_3( return Plane_3(
transform(pl.point() ), transform(pl.point() ),
-(transpose().inverse().transform(pl.orthogonal_direction() ))); -(transposed_inverse.transform(pl.orthogonal_direction() )));
} }
} }
template < class R >
CGAL_KERNEL_INLINE
typename Aff_transformation_repH3<R>::Plane_3
Aff_transformation_repH3<R>::
transform(const typename Aff_transformation_repH3<R>::Plane_3& pl) const
{
return transform(pl, is_even(), transpose().inverse());
}
template < class R > template < class R >
CGAL_KERNEL_INLINE CGAL_KERNEL_INLINE
typename Aff_transformation_repH3<R>::Aff_transformation_3 typename Aff_transformation_repH3<R>::Aff_transformation_3
@ -805,6 +836,15 @@ transform(const typename Translation_repH3<R>::Plane_3& pl) const
return Plane_3( transform( pl.point() ), pl.orthogonal_vector() ); return Plane_3( transform( pl.point() ), pl.orthogonal_vector() );
} }
template < class R >
inline
typename Translation_repH3<R>::Plane_3
Translation_repH3<R>::
transform(const typename Translation_repH3<R>::Plane_3& pl, bool, const typename Translation_repH3<R>::Aff_transformation_3&) const
{
return transform(pl);
}
template < class R > template < class R >
inline inline
typename Translation_repH3<R>::Aff_transformation_3 typename Translation_repH3<R>::Aff_transformation_3
@ -1018,6 +1058,13 @@ Aff_transformationH3<R>::
transform(const typename Aff_transformationH3<R>::Plane_3& pl) const transform(const typename Aff_transformationH3<R>::Plane_3& pl) const
{ return this->Ptr()->transform(pl); } { return this->Ptr()->transform(pl); }
template < class R >
inline
typename Aff_transformationH3<R>::Plane_3
Aff_transformationH3<R>::
transform(const typename Aff_transformationH3<R>::Plane_3& pl, bool is_even, const typename Aff_transformationH3<R>::Aff_transformation_3& transposed_inverse) const
{ return this->Ptr()->transform(pl, is_even, transposed_inverse); }
template < class R > template < class R >
inline inline
typename Aff_transformationH3<R>::Aff_transformation_3 typename Aff_transformationH3<R>::Aff_transformation_3

View File

@ -107,6 +107,11 @@ public:
return t.transform(*this); return t.transform(*this);
} }
Plane_3 transform(const Aff_transformation_3 &t, bool is_even, const Aff_transformation_3 &transposed_inverse) const
{
return t.transform(*this, is_even, transposed_inverse);
}
Plane_3 opposite() const Plane_3 opposite() const
{ {
return R().construct_opposite_plane_3_object()(*this); return R().construct_opposite_plane_3_object()(*this);

View File

@ -134,15 +134,19 @@ public:
Halffacet_const_iterator facets_begin() { return facet_list.begin(); } Halffacet_const_iterator facets_begin() { return facet_list.begin(); }
Halffacet_const_iterator facets_end() { return facet_list.end(); } Halffacet_const_iterator facets_end() { return facet_list.end(); }
void transform(const Aff_transformation_3& t) { void transform(const Aff_transformation_3& t, bool is_even, const Aff_transformation_3& transposed_inverse) {
if(left_node != nullptr) { if(left_node != nullptr) {
CGAL_assertion(right_node != nullptr); CGAL_assertion(right_node != nullptr);
left_node->transform(t); left_node->transform(t, is_even, transposed_inverse);
right_node->transform(t); right_node->transform(t, is_even, transposed_inverse);
splitting_plane = splitting_plane.transform(t); splitting_plane = splitting_plane.transform(t, is_even, transposed_inverse);
} }
} }
void transform(const Aff_transformation_3& t) {
transform(t, t.is_even(), t.transpose().inverse());
}
void add_facet(Halffacet_handle f, int depth) { void add_facet(Halffacet_handle f, int depth) {
if(left_node == nullptr) { if(left_node == nullptr) {
facet_list.push_back(f); facet_list.push_back(f);
@ -453,17 +457,20 @@ public:
V.post_visit(current); V.post_visit(current);
} }
void transform(const Aff_transformation_3& t) { void transform(const Aff_transformation_3& t, bool is_even, const Aff_transformation_3& transposed_inverse) {
if(root == nullptr){ if(root == nullptr){
return; return;
} }
root->transform(t); root->transform(t, is_even, transposed_inverse);
BBox_updater bbup; BBox_updater bbup;
visit_k3tree(root, bbup); visit_k3tree(root, bbup);
bounding_box = bbup.box(); bounding_box = bbup.box();
} }
void transform(const Aff_transformation_3& t) {
transform(t, t.is_even(), t.transpose().inverse());
}
#ifdef CODE_DOES_NOT_WORK_WITH_BOTH_KERNELS_AT_THE_SAME_TIME #ifdef CODE_DOES_NOT_WORK_WITH_BOTH_KERNELS_AT_THE_SAME_TIME
template <typename T> template <typename T>

View File

@ -111,6 +111,8 @@ public:
virtual void transform(const Aff_transformation_3& t) = 0; virtual void transform(const Aff_transformation_3& t) = 0;
virtual void transform(const Aff_transformation_3& t, bool is_even, const Aff_transformation_3& transposed_inverse) = 0;
virtual void add_facet(Halffacet_handle) {} virtual void add_facet(Halffacet_handle) {}
virtual void add_edge(Halfedge_handle) {} virtual void add_edge(Halfedge_handle) {}
@ -217,6 +219,10 @@ public:
candidate_provider->transform(t); candidate_provider->transform(t);
} }
virtual void transform(const Aff_transformation_3& t, bool is_even, const Aff_transformation_3& transposed_inverse) {
candidate_provider->transform(t, is_even, transposed_inverse);
}
virtual ~SNC_point_locator_by_spatial_subdivision() noexcept(!CGAL_ASSERTIONS_ENABLED) virtual ~SNC_point_locator_by_spatial_subdivision() noexcept(!CGAL_ASSERTIONS_ENABLED)
{ {
CGAL_destructor_warning(initialized || CGAL_destructor_warning(initialized ||

View File

@ -1757,11 +1757,15 @@ protected:
if( this->is_shared()) if( this->is_shared())
clone_rep(); clone_rep();
const Aff_transformation_3& transposed_inverse = aff.transpose().inverse();
bool is_even = aff.is_even();
// only linear transform for the origin-centered sphere maps // only linear transform for the origin-centered sphere maps
Aff_transformation_3 linear( aff.hm(0,0), aff.hm(0,1), aff.hm(0,2), Aff_transformation_3 linear( aff.hm(0,0), aff.hm(0,1), aff.hm(0,2),
aff.hm(1,0), aff.hm(1,1), aff.hm(1,2), aff.hm(1,0), aff.hm(1,1), aff.hm(1,2),
aff.hm(2,0), aff.hm(2,1), aff.hm(2,2), aff.hm(2,0), aff.hm(2,1), aff.hm(2,2),
aff.hm(3,3)); aff.hm(3,3));
const Aff_transformation_3& linear_transposed_inverse = linear.transpose().inverse();
bool linear_is_even = linear.is_even();
SNC_constructor cstr(snc()); SNC_constructor cstr(snc());
@ -1794,7 +1798,7 @@ protected:
vi->point() = vi->point().transform( aff); vi->point() = vi->point().transform( aff);
if(! translate){ if(! translate){
SM_decorator sdeco(&*vi); SM_decorator sdeco(&*vi);
sdeco.transform( linear); sdeco.transform( linear, linear_is_even, linear_transposed_inverse);
} }
} }
} }
@ -1804,7 +1808,7 @@ protected:
CGAL_forall_facets(fi, snc()) { CGAL_forall_facets(fi, snc()) {
if(!is_standard(fi) || is_bounded(fi)) continue; if(!is_standard(fi) || is_bounded(fi)) continue;
Plane_3 pt = fi->plane(); Plane_3 pt = fi->plane();
pt = pt.transform(aff); pt = pt.transform(aff, is_even, transposed_inverse);
std::list<Point_3> points(Infi_box::find_points_of_box_with_plane(cstr,pt)); std::list<Point_3> points(Infi_box::find_points_of_box_with_plane(cstr,pt));
std::list<Vertex_handle> newVertices; std::list<Vertex_handle> newVertices;
newVertices = Infi_box::create_vertices_on_infibox(cstr, newVertices = Infi_box::create_vertices_on_infibox(cstr,
@ -1914,7 +1918,7 @@ protected:
Halffacet_iterator fi; Halffacet_iterator fi;
CGAL_forall_halffacets(fi,snc()) { CGAL_forall_halffacets(fi,snc()) {
if(is_standard(fi) || ninety) { if(is_standard(fi) || ninety) {
fi->plane() = fi->plane().transform( aff); fi->plane() = fi->plane().transform( aff, is_even, transposed_inverse);
} }
} }
@ -1935,7 +1939,7 @@ protected:
pl()->initialize(&snc()); pl()->initialize(&snc());
delete old_pl; delete old_pl;
} }
else pl()->transform(aff); else pl()->transform(aff, is_even, transposed_inverse);
} }
SNC_constructor C(snc()); SNC_constructor C(snc());

View File

@ -757,7 +757,7 @@ The macros are then |CGAL_forall_svertices_of(v,V)|,
|CGAL_forall_shalfedges_of(e,V)|, |CGAL_forall_sedges_of(e,V)|, |CGAL_forall_shalfedges_of(e,V)|, |CGAL_forall_sedges_of(e,V)|,
|CGAL_forall_sfaces_of(f,V)|, |CGAL_forall_sface_cycles_of(fc,F)|.}*/ |CGAL_forall_sfaces_of(f,V)|, |CGAL_forall_sface_cycles_of(fc,F)|.}*/
void transform( const Aff_transformation_3& linear) { void transform( const Aff_transformation_3& linear, bool is_even, const Aff_transformation_3& transposed_inverse) {
// CGAL_NEF_TRACEN("transform sphere map of vertex" << center_vertex()->point()); // CGAL_NEF_TRACEN("transform sphere map of vertex" << center_vertex()->point());
// The affine transformation is linear, i.e., no translation part. // The affine transformation is linear, i.e., no translation part.
CGAL_precondition( linear.hm(0,3) == 0 && CGAL_precondition( linear.hm(0,3) == 0 &&
@ -768,15 +768,19 @@ void transform( const Aff_transformation_3& linear) {
for (SVertex_iterator i = svertices_begin(); i != svertices_end(); ++i) for (SVertex_iterator i = svertices_begin(); i != svertices_end(); ++i)
i->point() = normalized(Sphere_point( i->point().transform( linear))); i->point() = normalized(Sphere_point( i->point().transform( linear)));
for (SHalfedge_iterator i = shalfedges_begin(); i !=shalfedges_end(); ++i) for (SHalfedge_iterator i = shalfedges_begin(); i !=shalfedges_end(); ++i)
i->circle() = Sphere_circle( i->circle().transform( linear)); i->circle() = Sphere_circle( i->circle().transform( linear, is_even, transposed_inverse));
if ( has_shalfloop()) { if ( has_shalfloop()) {
shalfloop()->circle() = Sphere_circle(shalfloop()->circle() shalfloop()->circle() = Sphere_circle(shalfloop()->circle()
.transform( linear)); .transform( linear, is_even, transposed_inverse));
shalfloop()->twin()->circle() shalfloop()->twin()->circle()
= Sphere_circle(shalfloop()->twin()->circle().transform( linear)); = Sphere_circle(shalfloop()->twin()->circle().transform( linear, is_even, transposed_inverse));
} }
} }
void transform( const Aff_transformation_3& linear) {
return transform(linear, linear.is_even(), linear.transpose().inverse());
}
void extract_complement() { void extract_complement() {
SVertex_handle sv; SVertex_handle sv;