Merge branch 'master' of git://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad

This commit is contained in:
jrheinlaender 2012-12-17 04:28:07 +04:30
commit 67e44adb9b
2 changed files with 19 additions and 7 deletions

View File

@ -292,8 +292,8 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
bool on = rGrp.GetBool("ZoomAtCursor", false);
_viewer->navigationStyle()->setZoomAtCursor(on);
}
else if (strcmp(Reason,"ZoomSetp") == 0) {
float val = rGrp.GetFloat("ZoomSetp", 0.0f);
else if (strcmp(Reason,"ZoomStep") == 0) {
float val = rGrp.GetFloat("ZoomStep", 0.0f);
_viewer->navigationStyle()->setZoomStep(val);
}
else if (strcmp(Reason,"EyeDistance") == 0) {

View File

@ -572,15 +572,27 @@ const bool SketchBased::checkLineCrossesFace(const gp_Lin &line, const TopoDS_Fa
continue;
BRepExtrema_SupportType type = distss.SupportTypeShape1(i);
if (type == BRepExtrema_IsOnEdge) {
//This further check is not really needed
return true;
//
TopoDS_Edge edge = TopoDS::Edge(distss.SupportOnShape1(i));
BRepAdaptor_Curve adapt(edge);
// create a plane (pnt,dir) that goes through the intersection point and is built of
// the vectors of the sketch normal and the rotation axis
const gp_Dir& normal = BRepAdaptor_Surface(face).Plane().Axis().Direction();
gp_Dir dir = line.Direction().Crossed(normal);
gp_Pnt pnt = distss.PointOnShape1(i);
Standard_Real t;
distss.ParOnEdgeS1(i, t);
if (t > adapt.FirstParameter() && t < adapt.LastParameter()) {
return true;
gp_Pnt p_eps1 = adapt.Value(std::max<double>(adapt.FirstParameter(), t-10*Precision::Confusion()));
gp_Pnt p_eps2 = adapt.Value(std::min<double>(adapt.LastParameter(), t+10*Precision::Confusion()));
// now check if we get a change in the sign of the distances
Standard_Real dist_p_eps1_pnt = gp_Vec(p_eps1, pnt).Dot(gp_Vec(dir));
Standard_Real dist_p_eps2_pnt = gp_Vec(p_eps2, pnt).Dot(gp_Vec(dir));
// distance to the plane must be noticable
if (fabs(dist_p_eps1_pnt) > 5*Precision::Confusion() &&
fabs(dist_p_eps2_pnt) > 5*Precision::Confusion()) {
if (dist_p_eps1_pnt * dist_p_eps2_pnt < 0)
return true;
}
}
else if (type == BRepExtrema_IsVertex) {