Anonymous | Login | 2021-07-26 04:45 MSK |

My View | View Issues | Change Log | Roadmap |

View Revisions: Issue #17899 | [ All Revisions ] [ Back to Issue ] | ||

Summary | 0017899: OCC Forum: Select3D_Box2d does not handle "void" correctly | ||

Revision | 2011-12-15 16:30 by abv | ||

Description | "void" state of Select3D_Box2d class is initalized and processed incorrectly. "void" currently means all four coordinates of a 2d box are zeros. Therefore, if Update() method is called with a point lying in a negative quadrant, 2d box is computed incorrectly: xmax and ymax remain zeros. Similar problem happens to xmin and ymin if a point lying in a positive quadrant is passed to Update(): xmin and ymin remain zeros. It is necessary either to introduce "isVoid" field in the 2d box class and take this flag into account in Update() method, or to use some "invalid" values for coordinates of a "void" box in order to detect this state correctly in Update(). ============================================== Original messages from the forum (http://www.opencascade.org/org/forum/thread_12459 [^]) Stephane Routelous 2007-11-20 15:20 I encounter the problem with Select3D_SensitiveCurve after the first rotation. This means the second time the detection areas are computed, I end up with a Select3d_Box2d "using" the point (0,0) as maximum. This cause the detection areas to be messed up. The original code will not work correctly if you add only positive of negative points to your box the problem is not in the IsVoid test, but in the Update method : ex : if you have Select3D_Box2d b; b.Update(gp_Pnt2d(-10,10)); b.Update(gp_Pnt2d(-20,-20)); you will endup with xmin=ymin=-20 xmax=ymax=0 instead of xmax=ymax=-10 because of the "aBox.Update(xmin, ymin, xmax, ymax);" inline void Update(const gp_Pnt2d& thePnt) { Bnd_Box2d aBox; aBox.Set(thePnt); if ( !isVoid ) //if you don't add that, the 2d box will be wrong aBox.Update(xmin, ymin, xmax, ymax); SetField(aBox); } |
||

Revision | 2009-06-23 16:40 by abv | ||

Description | "void" state of Select3D_Box2d class is initalized and processed incorrectly. "void" currently means all four coordinates of a 2d box are zeros. Therefore, if Update() method is called with a point lying in a negative quadrant, 2d box is computed incorrectly: xmax and ymax remain zeros. Similar problem happens to xmin and ymin if a point lying in a positive quadrant is passed to Update(): xmin and ymin remain zeros. It is necessary either to introduce "isVoid" field in the 2d box class and take this flag into account in Update() method, or to use some "invalid" values for coordinates of a "void" box in order to detect this state correctly in Update(). ============================================== Original messages from the forum (http://www.opencascade.org/org/forum/thread_12459 [^]) Stephane Routelous 2007-11-20 15:20 I encounter the problem with Select3D_SensitiveCurve after the first rotation. This means the second time the detection areas are computed, I end up with a Select3d_Box2d "using" the point (0,0) as maximum. This cause the detection areas to be messed up. The original code will not work correctly if you add only positive of negative points to your box the problem is not in the IsVoid test, but in the Update method : ex : if you have Select3D_Box2d b; b.Update(gp_Pnt2d(-10,10)); b.Update(gp_Pnt2d(-20,-20)); you will endup with xmin=ymin=-20 xmax=ymax=0 instead of xmax=ymax=-10 because of the "aBox.Update(xmin, ymin, xmax, ymax);" inline void Update(const gp_Pnt2d& thePnt) { Bnd_Box2d aBox; aBox.Set(thePnt); if ( !isVoid ) //if you don't add that, the 2d box will be wrong aBox.Update(xmin, ymin, xmax, ymax); SetField(aBox); } |

Copyright © 2000 - 2021 MantisBT Team |