Commit 000b41f0 authored by JasonPries's avatar JasonPries
Browse files

Change Sketch Variable and Vertex vectors from raw pointers to shared pointers

parent 305f7d04
...@@ -70,14 +70,15 @@ ...@@ -70,14 +70,15 @@
<sourceFolder url="file://$MODULE_DIR$/CMakeLists.txt" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/CMakeLists.txt" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Curve.cpp" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Curve.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_LineSegment.cpp" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_LineSegment.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Pattern.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Sketch.cpp" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Sketch.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_MirrorCopy.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Contour.cpp" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Contour.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_CircularArc.cpp" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_CircularArc.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Vertex.cpp" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Vertex.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Star.cpp" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Star.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Sketch.hpp" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_RotateCopy.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Constraint.cpp" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Constraint.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/Sketch/test_Sketch.hpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/main.cpp" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/test/main.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/CMakeLists.txt" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/test/CMakeLists.txt" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/UseCases/test_Rotor.cpp" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/test/UseCases/test_Rotor.cpp" isTestSource="false" />
......
...@@ -10,9 +10,11 @@ public: ...@@ -10,9 +10,11 @@ public:
Point(double x, double y) : X{x}, Y{y} {}; Point(double x, double y) : X{x}, Y{y} {};
Point(Vertex const &v) : X{v.x()}, Y{v.y()} {}; //Point(Vertex const &v) : X{v.x()}, Y{v.y()} {};
Point(Vertex const *v) : X{v->x()}, Y{v->y()} {}; Point(std::shared_ptr<Vertex>v) : X{v->x()}, Y{v->y()} {};
Point(sPoint const pp) : X{pp.x()}, Y{pp.y()} {};
//double W; // Nurbs weight? //double W; // Nurbs weight?
double X; double X;
......
...@@ -94,10 +94,10 @@ double CircularArc::arc_angle() const { ...@@ -94,10 +94,10 @@ double CircularArc::arc_angle() const {
return (a1 - a0); return (a1 - a0);
} }
Vertex CircularArc::point(double s) const { sPoint CircularArc::point(double s) const {
double a = s_to_a(s); double a = s_to_a(s);
return Vertex{center()->x() + radius() * cos(a), center()->y() + radius() * sin(a)}; return sPoint{center()->x() + radius() * cos(a), center()->y() + radius() * sin(a)};
} }
Vertex CircularArc::tangent(double s, bool orientation) const { Vertex CircularArc::tangent(double s, bool orientation) const {
...@@ -167,7 +167,7 @@ std::pair<double, double> CircularArc::supremum() const { ...@@ -167,7 +167,7 @@ std::pair<double, double> CircularArc::supremum() const {
double s = a_to_s(center()->atan()); double s = a_to_s(center()->atan());
if (s > 0.0 && s < 1.0) { if (s > 0.0 && s < 1.0) {
Vertex v = point(s); sPoint v = point(s);
xx = v.x(); xx = v.x();
yy = v.y(); yy = v.y();
val = sqrt(xx * xx + yy * yy); val = sqrt(xx * xx + yy * yy);
...@@ -216,7 +216,7 @@ bool CircularArc::is_identical(const Curve *c) const { ...@@ -216,7 +216,7 @@ bool CircularArc::is_identical(const Curve *c) const {
} }
} }
bool CircularArc::is_identical(const Curve *c, const Vertex *origin, const double angle) const { bool CircularArc::is_identical(const Curve *c, std::shared_ptr<Vertex> origin, const double angle) const {
const CircularArc *cc = dynamic_cast<const CircularArc *>(c); const CircularArc *cc = dynamic_cast<const CircularArc *>(c);
if (cc == nullptr) { if (cc == nullptr) {
...@@ -302,7 +302,7 @@ bool CircularArc::on_segment(const double x, const double y) const { ...@@ -302,7 +302,7 @@ bool CircularArc::on_segment(const double x, const double y) const {
} }
} }
void CircularArc::replace_verticies(std::vector<Vertex *> oldv, std::vector<Vertex *> newv) { void CircularArc::replace_verticies(std::vector<std::shared_ptr<Vertex>> oldv, std::vector<std::shared_ptr<Vertex>> newv) {
auto i = std::find(oldv.begin(), oldv.end(), Start); auto i = std::find(oldv.begin(), oldv.end(), Start);
if (i != oldv.end()) { if (i != oldv.end()) {
size_t j = i - oldv.begin(); size_t j = i - oldv.begin();
......
...@@ -14,23 +14,23 @@ public: ...@@ -14,23 +14,23 @@ public:
friend class Tangency; friend class Tangency;
// Constructors // Constructors
CircularArc() : Curve(), Radius(new Variable(0.0)) {}; CircularArc() : Curve(), Radius(std::make_shared<Variable>(0.0)) {};
CircularArc(const CircularArc *c) : Curve(c->Start, c->End, c->ForConstruction), Center(c->Center), Radius(c->Radius) {}; CircularArc(const CircularArc *c) : Curve(c->Start, c->End, c->ForConstruction), Center(c->Center), Radius(c->Radius) {};
CircularArc(Vertex &v0, Vertex &v1, Vertex &c, bool fc = false) : Curve(v0, v1, fc), Center(&c) {}; CircularArc(std::shared_ptr<Vertex> v0, std::shared_ptr<Vertex> v1, std::shared_ptr<Vertex> c, bool fc = false) : Curve(v0, v1, fc), Center(c) {};
CircularArc(Vertex &v0, Vertex &v1, Vertex &c, double r, bool fc = false) : Curve(v0, v1, fc), Center(&c), Radius(new Variable{r}) {}; CircularArc(std::shared_ptr<Vertex> v0, std::shared_ptr<Vertex> v1, std::shared_ptr<Vertex> c, double r, bool fc = false) : Curve(v0, v1, fc), Center(c), Radius(std::make_shared<Variable>(r)) {};
CircularArc(Vertex &v0, Vertex &v1, Vertex &c, Variable &r, Sketch &s, bool fc = false) : Curve(v0, v1, fc), Center(&c), Radius(&r) {}; CircularArc(std::shared_ptr<Vertex> v0, std::shared_ptr<Vertex> v1, std::shared_ptr<Vertex> c, std::shared_ptr<Variable> r, Sketch &s, bool fc = false) : Curve(v0, v1, fc), Center(c), Radius(r) {};
// Accessors // Accessors
const Vertex *center() const { return Center; }; std::shared_ptr<Vertex> center() const { return Center; };
double radius() const { return Radius->value(); }; double radius() const { return Radius->value(); };
// Virtual Function Implementation // Virtual Function Implementation
void get_verticies(std::list<Vertex *> &v) const override { void get_verticies(std::list<std::shared_ptr<Vertex>> &v) const override {
v.push_back(Start); v.push_back(Start);
v.push_back(End); v.push_back(End);
v.push_back(Center); v.push_back(Center);
...@@ -46,7 +46,7 @@ public: ...@@ -46,7 +46,7 @@ public:
void update(Eigen::MatrixXd &J, Eigen::VectorXd &r) override; void update(Eigen::MatrixXd &J, Eigen::VectorXd &r) override;
// Calculation // Calculation
Vertex point(double s) const override; sPoint point(double s) const override;
Vertex tangent(double s, bool orientation) const override; Vertex tangent(double s, bool orientation) const override;
...@@ -68,18 +68,18 @@ public: ...@@ -68,18 +68,18 @@ public:
// Curve-Curve Comparison // Curve-Curve Comparison
bool is_identical(const Curve *c) const override; bool is_identical(const Curve *c) const override;
bool is_identical(const Curve *c, const Vertex *origin, const double angle) const override; bool is_identical(const Curve *c, std::shared_ptr<Vertex> origin, const double angle) const override;
bool is_coincident(const Curve *c) const override; bool is_coincident(const Curve *c) const override;
// Modification // Modification
Curve *clone() const override { return new CircularArc(this); }; Curve *clone() const override { return new CircularArc(this); };
void replace_verticies(std::vector<Vertex *> oldv, std::vector<Vertex *> newv) override; void replace_verticies(std::vector<std::shared_ptr<Vertex>> oldv, std::vector<std::shared_ptr<Vertex>> newv) override;
protected: protected:
Vertex *Center; std::shared_ptr<Vertex> Center;
Variable *Radius; std::shared_ptr<Variable> Radius;
bool on_manifold(const double x, const double y) const override; bool on_manifold(const double x, const double y) const override;
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
template<class T> template<class T>
class Coincident : public Constraint { class Coincident : public Constraint {
public: public:
Vertex *Point; std::shared_ptr<Vertex> Point;
T *Element; T *Element;
// Constructors // Constructors
Coincident(Vertex &p, T &e) : Point(&p), Element(&e) {}; Coincident(std::shared_ptr<Vertex> p, T &e) : Point(p), Element(&e) {};
// Public Member Functions // Public Member Functions
size_t set_equation_index(size_t i) override { size_t set_equation_index(size_t i) override {
......
...@@ -7,10 +7,10 @@ Contour::Contour(const std::vector<const Curve *> &c) { ...@@ -7,10 +7,10 @@ Contour::Contour(const std::vector<const Curve *> &c) {
Curves = std::vector<const Curve *>(); Curves = std::vector<const Curve *>();
Curves.reserve(c.size()); Curves.reserve(c.size());
std::vector<const Vertex *> start; std::vector<std::shared_ptr<Vertex>> start;
start.reserve(c.size()); start.reserve(c.size());
std::vector<const Vertex *> end; std::vector<std::shared_ptr<Vertex>> end;
end.reserve(c.size()); end.reserve(c.size());
for (size_t i = 0; i < c.size(); i++) { for (size_t i = 0; i < c.size(); i++) {
...@@ -73,8 +73,8 @@ bool Contour::initialize(const std::vector<const Curve *> &c, const std::vector< ...@@ -73,8 +73,8 @@ bool Contour::initialize(const std::vector<const Curve *> &c, const std::vector<
Orientation.push_back(dir[i]); Orientation.push_back(dir[i]);
size_t j = (i + 1) % c.size(); size_t j = (i + 1) % c.size();
const Vertex *vi = (dir[i] ? c[i]->end() : c[i]->start()); std::shared_ptr<Vertex> vi = (dir[i] ? c[i]->end() : c[i]->start());
const Vertex *vj = (dir[j] ? c[j]->start() : c[j]->end()); std::shared_ptr<Vertex> vj = (dir[j] ? c[j]->start() : c[j]->end());
if (vi != vj) { if (vi != vj) {
return false; return false;
} }
...@@ -119,8 +119,8 @@ double Contour::area() const { ...@@ -119,8 +119,8 @@ double Contour::area() const {
double area{0.0}; double area{0.0};
for (size_t i = 0; i != Curves.size(); ++i) { for (size_t i = 0; i != Curves.size(); ++i) {
const Vertex *v0 = Curves[i]->start(); std::shared_ptr<Vertex> v0 = Curves[i]->start();
const Vertex *v1 = Curves[i]->end(); std::shared_ptr<Vertex> v1 = Curves[i]->end();
const double da = Curves[i]->area() + v0->x() * v1->y() - v0->y() * v1->x(); const double da = Curves[i]->area() + v0->x() * v1->y() - v0->y() * v1->x();
if (Orientation[i]) { if (Orientation[i]) {
......
...@@ -13,7 +13,7 @@ public: ...@@ -13,7 +13,7 @@ public:
Contour(const std::vector<const Curve *> &c, const std::vector<bool> &dir); Contour(const std::vector<const Curve *> &c, const std::vector<bool> &dir);
//Public Member Functions //Public Member Functions
const Vertex *vertex(size_t i) const { return (Orientation[i] ? Curves[i]->start() : Curves[i]->end()); }; std::shared_ptr<Vertex> vertex(size_t i) const { return (Orientation[i] ? Curves[i]->start() : Curves[i]->end()); };
const Curve *curve(size_t i) const { return Curves[i]; }; const Curve *curve(size_t i) const { return Curves[i]; };
......
#include "Sketch.hpp" #include "Sketch.hpp"
Curve *Curve::split(Vertex *vnew, double s) { bool Curve::on_segment(std::shared_ptr<Vertex> v) const {
Curve *cnew = clone();
*(vnew) = point(s);
End = vnew;
cnew->Start = vnew;
return cnew;
}
bool Curve::on_segment(const Vertex *v) const {
return on_segment(v->x(), v->y()); return on_segment(v->x(), v->y());
} }
bool Curve::on_segment(const Vertex *v, const Vertex *origin, const double angle) const { bool Curve::on_segment(std::shared_ptr<Vertex> v, std::shared_ptr<Vertex> origin, const double angle) const {
double x, y; double x, y;
std::tie(x, y) = v->rotate(origin, angle); std::tie(x, y) = v->rotate(origin, angle);
return on_segment(x, y); return on_segment(x, y);
} }
bool Curve::on_manifold(const Vertex *v) const { bool Curve::on_manifold(std::shared_ptr<Vertex> v) const {
return on_manifold(v->x(), v->y()); return on_manifold(v->x(), v->y());
} }
bool Curve::on_manifold(const Vertex *v, const Vertex *origin, const double angle) const { bool Curve::on_manifold(std::shared_ptr<Vertex> v, std::shared_ptr<Vertex> origin, const double angle) const {
double x, y; double x, y;
std::tie(x, y) = v->rotate(origin, angle); std::tie(x, y) = v->rotate(origin, angle);
......
...@@ -10,23 +10,23 @@ public: ...@@ -10,23 +10,23 @@ public:
// Constructors // Constructors
Curve() : Start(nullptr), End(nullptr) {}; Curve() : Start(nullptr), End(nullptr) {};
Curve(Vertex &v0, Vertex &v1, bool fc = false) : Start(&v0), End(&v1), ForConstruction(fc) {}; Curve(std::shared_ptr<Vertex> v0, std::shared_ptr<Vertex>v1, bool fc = false) : Start(v0), End(v1), ForConstruction(fc) {};
Curve(Vertex *v0, Vertex *v1, bool fc = false) : Start(v0), End(v1), ForConstruction(fc) {}; //Curve(Vertex *v0, Vertex *v1, bool fc = false) : Start(v0), End(v1), ForConstruction(fc) {};
// Properties // Properties
bool ForConstruction = false; bool ForConstruction = false;
// Accessors // Accessors
const Vertex *start() const { return Start; }; std::shared_ptr<Vertex> start() const { return Start; };
const Vertex *end() const { return End; }; std::shared_ptr<Vertex> end() const { return End; };
virtual void get_verticies(std::list<Vertex *> &v) const = 0; virtual void get_verticies(std::list<std::shared_ptr<Vertex>> &v) const = 0;
// Calculation // Calculation
// #TODO: Add const to double_t and bool arguments where appropriate // #TODO: Add const to double_t and bool arguments where appropriate
virtual Vertex point(double s) const = 0; virtual sPoint point(double s) const = 0;
virtual Vertex tangent(double s, bool orientation) const = 0; virtual Vertex tangent(double s, bool orientation) const = 0;
...@@ -39,15 +39,15 @@ public: ...@@ -39,15 +39,15 @@ public:
virtual std::pair<double, double> supremum() const = 0; // maximum length of vector between origin and point on curve virtual std::pair<double, double> supremum() const = 0; // maximum length of vector between origin and point on curve
// Curve-Vertex Comparison // Curve-Vertex Comparison
virtual bool on_manifold(const Vertex *v) const final; // true if vertex is on manifold defined by curve virtual bool on_manifold(std::shared_ptr<Vertex> v) const final; // true if vertex is on manifold defined by curve
virtual bool on_manifold(const Vertex *v, const Vertex *origin, const double angle) const final; virtual bool on_manifold(std::shared_ptr<Vertex> v, std::shared_ptr<Vertex> origin, const double angle) const final;
virtual bool on_segment(const Vertex *v) const final; // true if vertex is on curve segment virtual bool on_segment(std::shared_ptr<Vertex> v) const final; // true if vertex is on curve segment
virtual bool on_segment(const Vertex *v, const Vertex *origin, const double angle) const final; virtual bool on_segment(std::shared_ptr<Vertex> v, std::shared_ptr<Vertex> origin, const double angle) const final;
// Curve-Curve Comparison // Curve-Curve Comparison
virtual bool is_identical(const Curve *c) const = 0; // true if (input curve) XOR (object curve) is a set with measure < tol virtual bool is_identical(const Curve *c) const = 0; // true if (input curve) XOR (object curve) is a set with measure < tol
virtual bool is_identical(const Curve *c, const Vertex *origin, const double angle) const = 0; virtual bool is_identical(const Curve *c, std::shared_ptr<Vertex> origin, const double angle) const = 0;
// #TODO: virtual bool is_overlapping(const Curve* c) const = 0; // true if (input curve) AND (object curve) is a set with measure > tol // #TODO: virtual bool is_overlapping(const Curve* c) const = 0; // true if (input curve) AND (object curve) is a set with measure > tol
// #TODO: virtual bool is_overlapping(const Curve* c, const Vertex* origin, const double_t angle) const = 0; // #TODO: virtual bool is_overlapping(const Curve* c, const Vertex* origin, const double_t angle) const = 0;
...@@ -56,16 +56,15 @@ public: ...@@ -56,16 +56,15 @@ public:
// #TODO: virtual bool is_coincident(const Curve* c, const Vertex* origin, const double_t angle) const = 0; // #TODO: virtual bool is_coincident(const Curve* c, const Vertex* origin, const double_t angle) const = 0;
// Modification // Modification
Curve *split(Vertex *v, double s);
void reverse() { std::swap(Start, End); }; void reverse() { std::swap(Start, End); };
virtual Curve *clone() const = 0; virtual Curve *clone() const = 0;
virtual void replace_verticies(std::vector<Vertex *> oldv, std::vector<Vertex *> newv) = 0; virtual void replace_verticies(std::vector<std::shared_ptr<Vertex>> oldv, std::vector<std::shared_ptr<Vertex>> newv) = 0;
protected: protected:
Vertex *Start, *End; std::shared_ptr<Vertex> Start;
std::shared_ptr<Vertex> End;
virtual bool on_manifold(const double x, const double y) const = 0; virtual bool on_manifold(const double x, const double y) const = 0;
......
...@@ -204,17 +204,17 @@ template ...@@ -204,17 +204,17 @@ template
class Distance<LineSegment>; class Distance<LineSegment>;
template<> template<>
size_t Distance<Vertex>::set_equation_index(size_t i) { size_t Distance<std::shared_ptr<Vertex>>::set_equation_index(size_t i) {
EquationIndex = i; EquationIndex = i;
return 1; return 1;
} }
template<> template<>
void Distance<Vertex>::update(Eigen::MatrixXd &J, Eigen::VectorXd &r) { void Distance<std::shared_ptr<Vertex>>::update(Eigen::MatrixXd &J, Eigen::VectorXd &r) {
const double x0 = Element0->x(); const double x0 = (*Element0)->x();
const double y0 = Element0->y(); const double y0 = (*Element0)->y();
const double x1 = Element1->x(); const double x1 = (*Element1)->x();
const double y1 = Element1->y(); const double y1 = (*Element1)->y();
double dx = x1 - x0; double dx = x1 - x0;
double dy = y1 - y0; double dy = y1 - y0;
...@@ -224,11 +224,11 @@ void Distance<Vertex>::update(Eigen::MatrixXd &J, Eigen::VectorXd &r) { ...@@ -224,11 +224,11 @@ void Distance<Vertex>::update(Eigen::MatrixXd &J, Eigen::VectorXd &r) {
r(EquationIndex) = dr - Dim; r(EquationIndex) = dr - Dim;
J(EquationIndex, Element0->X->get_index()) -= dx; J(EquationIndex, (*Element0)->X->get_index()) -= dx;
J(EquationIndex, Element0->Y->get_index()) -= dy; J(EquationIndex, (*Element0)->Y->get_index()) -= dy;
J(EquationIndex, Element1->X->get_index()) += dx; J(EquationIndex, (*Element1)->X->get_index()) += dx;
J(EquationIndex, Element1->Y->get_index()) += dy; J(EquationIndex, (*Element1)->Y->get_index()) += dy;
} }
template template
class Distance<Vertex>; class Distance<std::shared_ptr<Vertex>>;
\ No newline at end of file \ No newline at end of file
#include "Sketch.hpp" #include "Sketch.hpp"
Fixation::Fixation(Vertex &v) { Fixation::Fixation(std::shared_ptr<Vertex> v) {
Point = &v; Point = v;
Dim = new Vertex(v); Dim = sPoint(v->x(), v->y());
} }
void Fixation::update(Eigen::MatrixXd &J, Eigen::VectorXd &r) { void Fixation::update(Eigen::MatrixXd &J, Eigen::VectorXd &r) {
r(EquationIndex) = Point->x() - Dim->x(); r(EquationIndex) = Point->x() - Dim.X;
J(EquationIndex, Point->X->get_index()) += 1.0; J(EquationIndex, Point->X->get_index()) += 1.0;
r(EquationIndex + 1) = Point->y() - Dim->y(); r(EquationIndex + 1) = Point->y() - Dim.Y;
J(EquationIndex + 1, Point->Y->get_index()) += 1.0; J(EquationIndex + 1, Point->Y->get_index()) += 1.0;
} }
\ No newline at end of file
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
class Fixation : public Constraint { class Fixation : public Constraint {
public: public:
Vertex *Point; std::shared_ptr<Vertex> Point;
Vertex *Dim; sPoint Dim;
// Constructors // Constructors
Fixation(Vertex &v); Fixation(std::shared_ptr<Vertex> v);
// Public Member Functions // Public Member Functions
size_t set_equation_index(size_t i) override { size_t set_equation_index(size_t i) override {
......
#include "Sketch.hpp" #include "Sketch.hpp"
Vertex LineSegment::point(double s) const { sPoint LineSegment::point(double s) const {
const double x0 = start()->x(); const double x0 = start()->x();
const double y0 = start()->y(); const double y0 = start()->y();
const double x1 = end()->x(); const double x1 = end()->x();
const double y1 = end()->y(); const double y1 = end()->y();
return Vertex{x0 * (1.0 - s) + x1 * s, y0 * (1.0 - s) + y1 * s}; return sPoint{x0 * (1.0 - s) + x1 * s, y0 * (1.0 - s) + y1 * s};
} }
Vertex LineSegment::tangent(double s, bool orientation) const { Vertex LineSegment::tangent(double s, bool orientation) const {
...@@ -115,7 +115,7 @@ bool LineSegment::is_identical(const Curve *c) const { ...@@ -115,7 +115,7 @@ bool LineSegment::is_identical(const Curve *c) const {
} }
} }
bool LineSegment::is_identical(const Curve *c, const Vertex *origin, const double angle) const { bool LineSegment::is_identical(const Curve *c, std::shared_ptr<Vertex> origin, const double angle) const {
const LineSegment *l = dynamic_cast<const LineSegment *>(c); const LineSegment *l = dynamic_cast<const LineSegment *>(c);
if (l == nullptr) { if (l == nullptr) {
...@@ -162,7 +162,7 @@ bool LineSegment::is_coincident(const Curve *c) const { ...@@ -162,7 +162,7 @@ bool LineSegment::is_coincident(const Curve *c) const {
double LineSegment::length() const { return hypot(end()->x() - start()->x(), end()->y() - start()->y()); }; double LineSegment::length() const { return hypot(end()->x() - start()->x(), end()->y() - start()->y()); };