implemented arc of ellipses touch mode (precision issue as well)

This commit is contained in:
SparkyCola
2017-10-04 22:04:54 +02:00
committed by wmayer
parent 899f3e26ea
commit c3c50c3e92

View File

@@ -2210,26 +2210,10 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
pnt2 = proj(pnt2);
bool pnt0Inside = polygon.Contains(Base::Vector2d(pnt0.x, pnt0.y));
if (pnt0Inside) {
std::stringstream ss;
ss << "Vertex" << VertexId - 1;
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
}
bool pnt1Inside = polygon.Contains(Base::Vector2d(pnt1.x, pnt1.y));
if (pnt1Inside) {
std::stringstream ss;
ss << "Vertex" << VertexId;
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
}
bool bpolyInside = true;
if (polygon.Contains(Base::Vector2d(pnt2.x, pnt2.y))) {
std::stringstream ss;
ss << "Vertex" << VertexId + 1;
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
}
if (pnt0Inside && pnt1Inside) {
if ((pnt0Inside && pnt1Inside) || touchMode) {
double startangle, endangle;
aoe->getRange(startangle, endangle, /*emulateCCW=*/true);
@@ -2238,7 +2222,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
double range = endangle-startangle;
int countSegments = std::max(2, int(12.0 * range / (2 * M_PI)));
if(touchMode)countSegments=countSegments*2.5;
double segment = (range) / countSegments;
// circumscribed polygon radius
@@ -2247,7 +2231,6 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
Base::Vector3d majdir = aoe->getMajorAxisDir();
Base::Vector3d mindir = Base::Vector3d(-majdir.y, majdir.x, 0.0);
bool bpolyInside = true;
pnt0 = aoe->getCenter();
double angle = (startangle) + segment/2;
for (int i = 0; i < countSegments; ++i, angle += segment) {
@@ -2257,6 +2240,9 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
pnt = proj(pnt);
if (!polygon.Contains(Base::Vector2d(pnt.x, pnt.y))) {
bpolyInside = false;
if(!touchMode)break;
} else if(touchMode){
bpolyInside = true;
break;
}
}
@@ -2267,6 +2253,23 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
}
}
if (pnt0Inside || (bpolyInside && touchMode)) {
std::stringstream ss;
ss << "Vertex" << VertexId - 1;
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
}
if (pnt1Inside || (bpolyInside && touchMode)) {
std::stringstream ss;
ss << "Vertex" << VertexId;
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
}
if (polygon.Contains(Base::Vector2d(pnt2.x, pnt2.y)) || (bpolyInside && touchMode)) {
std::stringstream ss;
ss << "Vertex" << VertexId + 1;
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());
}
} else if ((*it)->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()) {
// Check if arc lies inside box selection