31 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
56 if (coords.size()>0) {
57 std::cerr << __PRETTY_FUNCTION__ <<
" TODO Check if point's are on path" << std::endl;
59 for (
auto &i : coords) {
66 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
78 for (
auto &entity1 : list1) {
79 if (
auto arc = std::dynamic_pointer_cast<const lc::geo::Arc>(entity1)) {
82 geovisit(v, *std::dynamic_pointer_cast<const lc::geo::Vector>(entity1).
get());
95 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
117 if (coords.size()>0) {
118 std::cerr << __PRETTY_FUNCTION__ <<
" TODO Check if point's are on path" << std::endl;
120 for (
auto &i : coords) {
127 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
138 for (
auto &entity1 : list1) {
139 if (
auto arc = std::dynamic_pointer_cast<const lc::geo::Arc>(entity1)) {
142 geovisit(l, *std::dynamic_pointer_cast<const lc::geo::Vector>(entity1).
get());
151 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
156 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
161 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
166 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
171 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
176 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
181 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
186 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
208 for (
auto &i : coords) {
216 if (
_method == Method::OnPath) {
220 for (
auto &point : coords) {
221 double a = (point - arc.
center()).angle();
233 if (coords.size()>0) {
234 std::cerr << __PRETTY_FUNCTION__ <<
" TODO Check if point's are on path" << std::endl;
236 for (
auto &i : coords) {
243 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
255 for (
auto &entity1 : list1) {
256 if (
auto arc = std::dynamic_pointer_cast<const lc::geo::Arc>(entity1)) {
259 geovisit(*std::dynamic_pointer_cast<const lc::geo::Vector>(entity1).
get(), a);
324 (*this)(circle, arc);
336 if (coords.size()>0) {
337 std::cerr << __PRETTY_FUNCTION__ <<
" TODO Check if point's are on path" << std::endl;
339 for (
auto &i : coords) {
346 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
357 for (
auto &entity1 : list1) {
358 if (
auto arc = std::dynamic_pointer_cast<const lc::geo::Arc>(entity1)) {
361 geovisit(*std::dynamic_pointer_cast<const lc::geo::Vector>(entity1).
get(), a1);
396 if (coords.size()>0) {
397 std::cerr << __PRETTY_FUNCTION__ <<
" TODO Check if point's are on path" << std::endl;
399 for (
auto &i : coords) {
406 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
411 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
447 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
452 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
501 for (
auto &entity1 : list1) {
502 for (
auto &entity2 : list2) {
503 if (
auto vector = std::dynamic_pointer_cast<const lc::geo::Vector>(entity1)) {
504 if (
auto arc = std::dynamic_pointer_cast<const lc::geo::Arc>(entity2)) {
505 geovisit(*vector.get(), *arc.get());
510 if (
auto arc = std::dynamic_pointer_cast<const lc::geo::Arc>(entity2)) {
511 geovisit(*std::dynamic_pointer_cast<const lc::geo::Arc>(entity1).
get(), *arc.get());
513 geovisit(*std::dynamic_pointer_cast<const lc::geo::Vector>(entity2).
get(),
514 *std::dynamic_pointer_cast<const lc::geo::Arc>(entity1).
get());
529 const double num = ((p4.
x() - p3.
x()) * (p1.
y() - p3.
y()) - (p4.
y() - p3.
y()) * (p1.
x() - p3.
x()));
530 const double div = ((p4.
y() - p3.
y()) * (p2.
x() - p1.
x()) - (p4.
x() - p3.
x()) * (p2.
y() - p1.
y()));
534 double u = num / div;
535 double xs = p1.
x() + u * (p2.
x() - p1.
x());
536 double ys = p1.
y() + u * (p2.
y() - p1.
y());
542 const bool a1b = a1.
inArea(coord);
543 const bool a2b = a2.
inArea(coord);
545 if (
_method == Method::OnPath) {
547 }
else if (a1b && a2b) {
550 (p1.
x() == p2.
x() && ys >= a1.
minP().
y() && ys <= a1.
maxP().
y() && a2b) ||
552 (p3.
x() == p4.
x() && ys >= a2.
minP().
y() && ys <= a2.
maxP().
y() && a1b) ||
554 (p1.
y() == p2.
y() && xs >= a1.
minP().
x() && xs <= a1.
maxP().
x() && a2b) ||
555 (p3.
y() == p4.
y() && xs >= a2.
minP().
x() && xs <= a2.
maxP().
x() && a1b)
565 if (
_method == Method::OnPath) {
569 for (
auto &point : coords) {
570 double a = (point - arc.
center()).angle();
581 if (
_method == Method::OnPath) {
585 for (
auto &point : coords) {
586 double a1 = (point - arc1.
center()).angle();
587 double a2 = (point - arc2.
center()).angle();
602 : _entities(entities), _method(method), _tolerance(tolerance) {
609 for (
size_t outer = 0; outer < (
_entities.size() - 1); outer++) {
610 for (
size_t inner = outer + 1; inner <
_entities.size(); inner++) {
611 visitorDispatcher<bool, lc::GeoEntityVisitor>(intersect, *
_entities.at(outer).get(), *
_entities.at(inner).get());
615 return intersect.
result();
627 _entities(entities), _others(others), _method(method), _tolerance(tolerance) {
640 std::cerr << __PRETTY_FUNCTION__ <<
" requires implementation" << std::endl;
642 return intersect.
result();
const Coordinate minP() const
std::vector< geo::Coordinate > _intersectionPoints
const Coordinate end() const
IntersectAgainstOthers(std::vector< entity::CADEntity_CSPtr >, std::vector< entity::CADEntity_CSPtr >, Intersect::Method, double tolerance)
double x() const
Returns x of Coordinate.
const Coordinate nearestPointOnEntity(const Coordinate &coord) const
calculate the intersection pojnts of 2 entities
void geovisit(const geo::Vector &, const geo::Vector &)
static std::vector< lc::geo::Coordinate > LineQuad(const Equation &l1, const Equation &q1)
double y() const
Returns y of Coordinate.
std::vector< geo::Coordinate > result() const
double radius() const
returns the radius of the circle.
bool CCW() const
Returns of the arc is in reversed direction.
double endAngle() const
Returns the EndAngle.
std::vector< geo::Coordinate > result() const
const Intersect::Method _method
A ellipse that can be put in a drawing.
const Intersect::Method _method
const maths::Equation equation() const
Returns equation of the circle.
A line that can be put in a drawing.
bool operator()(const lc::geo::Vector &, const lc::geo::Vector &)
std::vector< geo::Coordinate > result() const
IntersectMany(std::vector< entity::CADEntity_CSPtr >, Intersect::Method=Intersect::OnEntity, double tolerance=LCTOLERANCE)
const maths::Equation equation() const
static bool isAngleBetween(double a, double start, double end, bool CCW)
isAngleBetween, checks if angle is between
const maths::Equation equation() const
Returns the quadratic equation.
Intersect(Method method, double tolerance)
const Coordinate maxP() const
const Coordinate center() const
Returns the Center of circle.
static std::vector< geo::Coordinate > QuadQuad(const Equation &l1, const Equation &l2)
const Coordinate start() const
double distanceTo(const geo::Coordinate &c) const
bool inArea(const Coordinate &point, double tolerance=0.) const
Test of a specific point lies within area.
bool isAngleBetween(double angle) const
std::vector< entity::CADEntity_CSPtr > _entities
const maths::Equation equation() const
double startAngle() const
Returns the startAngle.
const Coordinate center() const
Returns center of Arc.
std::vector< CADEntity_CSPtr > const asEntities() const