Scaling a plane means scaling Plane_3::d()

This commit is contained in:
Andreas Fabri 2021-04-15 13:14:42 +01:00
parent a841ee4d1a
commit 01cc9ec653
4 changed files with 38 additions and 0 deletions

View File

@ -144,6 +144,9 @@ public:
Plane_3
transform(const Plane_3& p) const
{
if(is_scaling()){
return this->Ptr()->transform(p);
}
if (is_even())
return Plane_3(transform(p.point()),
transpose().inverse().transform(p.orthogonal_direction()));
@ -162,6 +165,7 @@ public:
bool is_odd() const { return ! (this->Ptr()->is_even()); }
bool is_translation() const { return this->Ptr()->is_translation(); }
bool is_scaling() const { return this->Ptr()->is_scaling(); }
FT cartesian(int i, int j) const { return this->Ptr()->cartesian(i,j); }

View File

@ -31,6 +31,7 @@ public:
typedef typename R::Point_3 Point_3;
typedef typename R::Vector_3 Vector_3;
typedef typename R::Direction_3 Direction_3;
typedef typename R::Plane_3 Plane_3;
typedef typename R::Aff_transformation_3 Aff_transformation_3;
virtual ~Aff_transformation_rep_baseC3(){}
@ -38,6 +39,7 @@ public:
virtual Point_3 transform(const Point_3 &p) const = 0;
virtual Vector_3 transform(const Vector_3 &v) const = 0;
virtual Direction_3 transform(const Direction_3 &d) const = 0;
virtual Plane_3 transform(const Plane_3& p) const = 0;
virtual Aff_transformation_3 operator*(
const Aff_transformation_rep_baseC3 &t) const = 0;
@ -55,6 +57,7 @@ public:
virtual Aff_transformation_3 transpose() const = 0;
virtual bool is_even() const = 0;
virtual bool is_translation() const = 0;
virtual bool is_scaling() const = 0;
virtual FT cartesian(int i, int j) const = 0;
virtual std::ostream &print(std::ostream &os) const = 0;
};
@ -128,6 +131,12 @@ public:
t31 * v.x() + t32 * v.y() + t33 * v.z());
}
virtual Plane_3 transform(const Plane_3& p) const
{
return p; // fix or never call
}
// Note that Aff_transformation is not defined yet,
// so the following 6 functions have to be implemented
// outside class body
@ -151,6 +160,11 @@ public:
return false;
}
virtual bool is_scaling() const
{
return false;
}
virtual FT cartesian(int i, int j) const
{
switch (i)

View File

@ -34,6 +34,7 @@ public:
typedef typename Transformation_base_3::Point_3 Point_3;
typedef typename Transformation_base_3::Vector_3 Vector_3;
typedef typename Transformation_base_3::Direction_3 Direction_3;
typedef typename Transformation_base_3::Plane_3 Plane_3;
typedef typename Transformation_base_3::Aff_transformation_3
Aff_transformation_3;
@ -59,6 +60,12 @@ public:
return d;
}
virtual Plane_3 transform(const Plane_3 &p) const
{
// direction ( which is (p.a(), p.b(), p.c())) does not change
return Plane_3(p.a(),p.b(),p.c(), p.d()*scalefactor_);
}
virtual Aff_transformation_3 operator*(const Transformation_base_3 &t) const
{
return t.compose(*this);
@ -126,6 +133,10 @@ public:
return false;
}
virtual bool is_scaling() const
{
return true;
}
virtual FT cartesian(int i, int j) const
{

View File

@ -56,6 +56,11 @@ public:
return d;
}
virtual Plane_3 transform(const Plane_3 &d) const
{
return d; // fix or never call it
}
virtual Aff_transformation_3 operator*(const Transformation_base_3 &t) const
{
return t.compose(*this);
@ -130,6 +135,10 @@ public:
return true;
}
virtual bool is_scaling() const
{
return false;
}
virtual FT cartesian(int i, int j) const
{
if (j==i) return FT(1);