#include <intersectionhandler.h>
|
static std::vector
< lc::geo::Coordinate > | LineLine (const Equation &l1, const Equation &l2) |
|
static std::vector
< lc::geo::Coordinate > | LineQuad (const Equation &l1, const Equation &q1) |
|
static std::vector
< geo::Coordinate > | QuadQuad (const Equation &l1, const Equation &l2) |
|
static std::vector
< geo::Coordinate > | bezierLine (geo::BB_CSPtr B, const geo::Vector &V) |
|
static std::vector
< geo::Coordinate > | bezierCircle (geo::BB_CSPtr B, const geo::Circle &C) |
|
static std::vector
< geo::Coordinate > | bezierArc (geo::BB_CSPtr B, const geo::Arc &A) |
|
static std::vector
< geo::Coordinate > | bezierEllipse (geo::BB_CSPtr B, const geo::Ellipse &E) |
|
static std::vector
< geo::Coordinate > | bezierBezier (geo::BB_CSPtr B1, geo::BB_CSPtr B2) |
|
static std::vector
< geo::Coordinate > | splineLine (geo::Spline B, const geo::Vector &V) |
|
static std::vector
< geo::Coordinate > | splineCircle (geo::Spline B, const geo::Circle &C) |
|
static std::vector
< geo::Coordinate > | splineArc (geo::Spline B, const geo::Arc &A) |
|
static std::vector
< geo::Coordinate > | splineEllipse (geo::Spline B, const geo::Ellipse &E) |
|
static std::vector
< geo::Coordinate > | splineBezier (geo::Spline B1, geo::BB_CSPtr B2) |
|
static std::vector
< geo::Coordinate > | splineSpline (geo::Spline B1, geo::Spline B2) |
|
static std::vector
< geo::Coordinate > | bezCircleIntersect (lc::geo::BB_CSPtr bez, const geo::Coordinate &ec, double rx, double ry) |
|
Definition at line 18 of file intersectionhandler.h.
Definition at line 224 of file intersectionhandler.cpp.
225 auto bb1 = B1->boundingBox();
226 auto bb2 = B2->boundingBox();
228 if(!bb1.overlaps(bb2)) {
233 ret.push_back(B1->getCP().at(1));
237 auto b1split = B1->splitHalf();
238 auto b2split = B2->splitHalf();
239 bezBez(b1split[0], b2split[0], ret);
240 bezBez(b1split[1], b2split[0], ret);
241 bezBez(b1split[0], b2split[1], ret);
242 bezBez(b1split[1], b2split[1], ret);
static void bezBez(const geo::BB_CSPtr B1, const geo::BB_CSPtr B2, std::vector< geo::Coordinate > &ret)
Definition at line 245 of file intersectionhandler.cpp.
246 std::vector<geo::Coordinate> results;
247 auto coords = bez->getCP();
248 auto p1 = coords.at(0);
249 auto p2 = coords.at(1);
250 auto p3 = coords.at(2);
251 auto p4 = coords.at(3);
256 auto d = a + b + c + p4;
275 c3.x()*c3.x()*ryry + c3.y()*c3.y()*rxrx,
277 2*(c3.x()*c2.x()*ryry + c3.y()*c2.y()*rxrx),
279 2*(c3.x()*c1.x()*ryry + c3.y()*c1.y()*rxrx) + c2.
x()*c2.x()*ryry + c2.y()*c2.y()*rxrx,
281 2*c3.
x()*ryry*(c0.
x() - ec.
x()) + 2*c3.y()*rxrx*(c0.
y() - ec.
y()) +
282 2*(c2.x()*c1.x()*ryry + c2.y()*c1.y()*rxrx),
284 2*c2.
x()*ryry*(c0.
x() - ec.
x()) + 2*c2.y()*rxrx*(c0.
y() - ec.
y()) +
285 c1.
x()*c1.x()*ryry + c1.y()*c1.y()*rxrx,
287 2*c1.
x()*ryry*(c0.
x() - ec.
x()) + 2*c1.y()*rxrx*(c0.
y() - ec.
y()),
289 c0.
x()*c0.
x()*ryry - 2*c0.
y()*ec.
y()*rxrx - 2*c0.
x()*ec.
x()*ryry +
290 c0.
y()*c0.
y()*rxrx + ec.
x()*ec.
x()*ryry + ec.
y()*ec.
y()*rxrx - rxrx*ryry
293 for(
const auto& t : roots) {
294 if(t > 0.000000000 && t < 1.000000000) {
295 results.push_back(c3*t*t*t + c2*t*t + c1*t + c0);
double x() const
Returns x of Coordinate.
static std::vector< double > sexticSolver(const std::vector< double > &ce)
double y() const
Returns y of Coordinate.
Definition at line 140 of file intersectionhandler.cpp.
147 std::vector<geo::Coordinate> ret;
150 for(
const auto & pt : points) {
static std::vector< geo::Coordinate > bezierCircle(geo::BB_CSPtr B, const geo::Circle &C)
double radius() const
Returns the radius of Arc.
bool isAngleBetween(double angle) const
const Coordinate center() const
Returns center of Arc.
Definition at line 217 of file intersectionhandler.cpp.
219 std::vector<geo::Coordinate> ret;
static void bezBez(const geo::BB_CSPtr B1, const geo::BB_CSPtr B2, std::vector< geo::Coordinate > &ret)
Definition at line 91 of file intersectionhandler.cpp.
94 std::vector<geo::Coordinate> ret;
101 std::vector<double>roots;
103 auto points = B->getCP();
105 if(points.size()== 3) {
111 auto a = points.at(0).x();
112 auto b = points.at(1).x();
113 auto c = points.at(2).x();
115 auto e = points.at(0).y();
116 auto f = points.at(1).y();
117 auto g = points.at(2).y();
119 auto t4 = (g*g + (2*e - 4*f)*g + 4* f*f - 4* e * f + e*e + c*c + (2*a-4*b)*c + 4*b*b - 4*a*b + a*a);
120 auto t3 = ((4*f - 4*e)*g - 8*f*f + 12*e*f - 4*e*e + (4*b - 4*a)*c - 8*b*b + 12*a*b -4*a*a)/t4;
121 auto t2 = ((-2*g + 4*f -2*e)*h + 2*e*g + 4*f*f - 12*e*f + 6*e*e + (-2*c + 4*b - 2*a)*d + 2*a*c + 4*b*b -12*a*b + 6*a*a)/t4;
122 auto t1 = ((4*e - 4*f)*h + 4*e*f - 4*e*e + (4*a - 4*b)*d + 4*a*b -4*a*a)/t4;
123 auto coeff = (-r*r + h*h -2 *e*h + e*e + d*d - 2*a*d + a*a)/t4;
127 for(
const auto &root : roots) {
128 if(root > 0 && root < 1) {
129 ret.push_back(B->DirectValueAt(root));
double x() const
Returns x of Coordinate.
static std::vector< geo::Coordinate > bezCircleIntersect(lc::geo::BB_CSPtr bez, const geo::Coordinate &ec, double rx, double ry)
double y() const
Returns y of Coordinate.
double radius() const
returns the radius of the circle.
const Coordinate center() const
Returns the Center of circle.
static std::vector< double > quarticSolver(const std::vector< double > &ce)
Definition at line 159 of file intersectionhandler.cpp.
161 std::vector<double> roots;
162 std::vector<geo::Coordinate> arc_ret, ret;
169 auto bez = B->move(-E.
center())
174 auto points = B->getCP();
176 if(points.size()== 3) {
177 auto r = C.minorRadius();
178 auto d = C.center().x();
179 auto h = C.center().y();
181 auto a = points.at(0).x();
182 auto b = points.at(1).x();
183 auto c = points.at(2).x();
185 auto e = points.at(0).y();
186 auto f = points.at(1).y();
187 auto g = points.at(2).y();
189 auto t4 = (g*g + (2*e - 4*f)*g + 4* f*f - 4* e * f + e*e + c*c + (2*a-4*b)*c + 4*b*b - 4*a*b + a*a);
190 auto t3 = ((4*f - 4*e)*g - 8*f*f + 12*e*f - 4*e*e + (4*b - 4*a)*c - 8*b*b + 12*a*b -4*a*a)/t4;
191 auto t2 = ((-2*g + 4*f -2*e)*h + 2*e*g + 4*f*f - 12*e*f + 6*e*e + (-2*c + 4*b - 2*a)*d + 2*a*c + 4*b*b -12*a*b + 6*a*a)/t4;
192 auto t1 = ((4*e - 4*f)*h + 4*e*f - 4*e*e + (4*a - 4*b)*d + 4*a*b -4*a*a)/t4;
193 auto coeff = (-r*r + h*h -2 *e*h + e*e + d*d - 2*a*d + a*a)/t4;
201 for(
const auto &root : roots) {
202 if(root > 0 && root < 1) {
203 ret.push_back(B->DirectValueAt(root));
207 for(
const auto &r: ret) {
209 arc_ret.push_back(r);
double startAngle() const
startAngle, Returns Start elliptic!! angle of ellipse
double ratio() const
ratio of major radius to minor radius
double getAngle() const
getAngle of MajorP
double endAngle() const
endAngle, Return the end elliptic!! angle of ellipse
static std::vector< double > quarticSolver(const std::vector< double > &ce)
const Coordinate center() const
center, Returns Center point of Ellipse
double minorRadius() const
minorRadius, Returns the minor radius of ellipse
const Coordinate majorP() const
majorP, Returns major point of the ellipse, relative to center
bool isAngleBetween(double angle) const
Definition at line 51 of file intersectionhandler.cpp.
54 std::vector<geo::Coordinate> ret;
55 std::vector<double> roots;
57 auto pts = B->getCP();
61 auto rotate_angle = -ml.
Angle1();
62 auto cps = B->move(-V.
start())->rotate(ml.start(), rotate_angle)->getCP();
64 auto t2 = cps[0].y() - 2*cps[1].y() + cps[2].y();
65 auto t1 = 2*(cps[1].y() - cps[0].y())/t2;
66 auto coeff = cps[0].y()/t2;
71 auto rotate_angle = -ml.
Angle1();
72 auto cps = B->move(-V.
start())->rotate(ml.start(), rotate_angle)->getCP();
74 auto t3 = -cps[0].y() + 3*cps[1].y() - 3*cps[2].y() + cps[3].y();
75 auto t2 = (3*cps[0].y() - 6*cps[1].y() + 3*cps[2].y())/t3;
76 auto t1 = (-3*cps[0].y() +3*cps[1].y())/t3;
77 auto coeff = cps[0].y()/t3;
81 for(
const auto &root : roots) {
82 if(root > 0 && root < 1) {
83 ret.push_back(B->DirectValueAt(root));
static std::vector< double > quadraticSolver(const std::vector< double > &ce)
quadraticSolver, Quadratic equations solver
const Coordinate end() const
static std::vector< double > cubicSolver(const std::vector< double > &ce)
const Coordinate start() const
Definition at line 5 of file intersectionhandler.cpp.
7 std::vector<lc::geo::Coordinate> ret;
8 const auto &m1 = l1.
Matrix();
9 const auto &m2 = l2.
Matrix();
13 M << m1(2,0) + m1(0,2), m1(2,1) + m1(1,2),
14 m2(2,0) + m2(0,2), m2(2,1) + m2(1,2);
15 V << -m1(2,2), -m2(2,2);
17 Eigen::Vector2d R = M.colPivHouseholderQr().solve(V);
18 ret.emplace_back(R[0], R[1]);
const Eigen::Matrix3d Matrix() const
Matrix Returns matrix of equation.
Definition at line 22 of file intersectionhandler.cpp.
25 std::transform(tcoords.begin(), tcoords.end(), tcoords.begin(), [](
const lc::geo::Coordinate &c) {
return std::move(c.flipXY()); });
const Equation flipXY() const
flipXY Flips the matrix values
static std::vector< geo::Coordinate > QuadQuad(const Equation &l1, const Equation &l2)
Definition at line 29 of file intersectionhandler.cpp.
31 const auto &m1 = l1.
Matrix();
32 const auto &m2 = l2.
Matrix();
44 std::vector<std::vector<double> > ce(0);
const Eigen::Matrix3d Matrix() const
Matrix Returns matrix of equation.
const std::vector< double > Coefficients() const
Coefficients of the equation.
static std::vector< lc::geo::Coordinate > LineQuad(const Equation &l1, const Equation &q1)
static std::vector< lc::geo::Coordinate > LineLine(const Equation &l1, const Equation &l2)
static std::vector< lc::geo::Coordinate > simultaneousQuadraticSolverFull(const std::vector< std::vector< double > > &m)
simultaneousQuadraticSolverFull
Definition at line 323 of file intersectionhandler.cpp.
324 std::vector<geo::Coordinate> ret;
326 for(
const auto & bezier : beziers) {
328 ret.insert(ret.end(), vecret.begin(), vecret.end());
const std::vector< BB_CSPtr > beziers() const
static std::vector< geo::Coordinate > bezierArc(geo::BB_CSPtr B, const geo::Arc &A)
Definition at line 356 of file intersectionhandler.cpp.
357 std::vector<geo::Coordinate> ret;
359 for(
const auto & bezier : beziers) {
361 ret.insert(ret.end(), vecret.begin(), vecret.end());
const std::vector< BB_CSPtr > beziers() const
static std::vector< geo::Coordinate > bezierBezier(geo::BB_CSPtr B1, geo::BB_CSPtr B2)
Definition at line 313 of file intersectionhandler.cpp.
314 std::vector<geo::Coordinate> ret;
316 for(
const auto & bezier : beziers) {
318 ret.insert(ret.end(), vecret.begin(), vecret.end());
static std::vector< geo::Coordinate > bezierCircle(geo::BB_CSPtr B, const geo::Circle &C)
const std::vector< BB_CSPtr > beziers() const
Definition at line 333 of file intersectionhandler.cpp.
334 std::vector<geo::Coordinate> ret;
336 for(
const auto & bezier : beziers) {
338 ret.insert(ret.end(), vecret.begin(), vecret.end());
const std::vector< BB_CSPtr > beziers() const
static std::vector< geo::Coordinate > bezierEllipse(geo::BB_CSPtr B, const geo::Ellipse &E)
Definition at line 302 of file intersectionhandler.cpp.
303 std::vector<geo::Coordinate> ret;
305 for(
const auto bezier : beziers) {
307 std::cout << vecret.size() << std::endl;
308 ret.insert(ret.end(), vecret.begin(), vecret.end());
const std::vector< BB_CSPtr > beziers() const
static std::vector< geo::Coordinate > bezierLine(geo::BB_CSPtr B, const geo::Vector &V)
Definition at line 343 of file intersectionhandler.cpp.
344 std::vector<geo::Coordinate> ret;
347 for(
const auto & bezier : beziers) {
348 for(
const auto & bezier2 : beziers2) {
350 ret.insert(ret.end(), vecret.begin(), vecret.end());
const std::vector< BB_CSPtr > beziers() const
static std::vector< geo::Coordinate > bezierBezier(geo::BB_CSPtr B1, geo::BB_CSPtr B2)
The documentation for this class was generated from the following files: