QList<RVector> RShape::getIntersectionPointsAE(const RArc& arc1, const REllipse& ellipse2, bool limited) { QList<RVector> candidates = RShape::getIntersectionPointsCE( RCircle(arc1.getCenter(), arc1.getRadius()), ellipse2); if (!limited) { return candidates; } QList<RVector> res; for (int i=0; i<candidates.count(); i++) { RVector c = candidates[i]; if (arc1.isOnShape(c)) { if (!ellipse2.isFullEllipse()) { double a1 = ellipse2.getCenter().getAngleTo(ellipse2.getStartPoint()); double a2 = ellipse2.getCenter().getAngleTo(ellipse2.getEndPoint()); double a = ellipse2.getCenter().getAngleTo(c); if (!RMath::isAngleBetween(a, a1, a2, ellipse2.isReversed())) { continue; } } res.append(c); } } return res; }
QList<RVector> RShape::getIntersectionPointsEE(const REllipse& ellipse1, const REllipse& ellipse2, bool limited) { QList<RVector> candidates = getIntersectionPointsEE(ellipse1, ellipse2); if (!limited) { return candidates; } QList<RVector> ret; for (int i=0; i<candidates.length(); i++) { RVector c = candidates[i]; bool onShape = true; double a1 = ellipse1.getCenter().getAngleTo(ellipse1.getStartPoint()); double a2 = ellipse1.getCenter().getAngleTo(ellipse1.getEndPoint()); double a = ellipse1.getCenter().getAngleTo(c); if (!RMath::isAngleBetween(a, a1, a2, ellipse1.isReversed())) { // qDebug() << "1) angle NOT between: " // << " a: " << RMath::rad2deg(a) // << " a1: " << RMath::rad2deg(a1) // << " a2: " << RMath::rad2deg(a2) // << " r: " << ellipse1.isReversed(); //ret.append(c); onShape = false; } a1 = ellipse2.getCenter().getAngleTo(ellipse2.getStartPoint()); a2 = ellipse2.getCenter().getAngleTo(ellipse2.getEndPoint()); a = ellipse2.getCenter().getAngleTo(c); if (!RMath::isAngleBetween(a, a1, a2, ellipse2.isReversed())) { // qDebug() << "2) angle NOT between: " // << " a: " << RMath::rad2deg(a) // << " a1: " << RMath::rad2deg(a1) // << " a2: " << RMath::rad2deg(a2) // << " r: " << ellipse2.isReversed(); //ret.append(c); onShape = false; } if (onShape) { ret.append(c); } } return ret; }