1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0026031: Visualization - fix out-of-range within Select3D_InteriorSensitivePointSet::GetPoints()

Removed unnecessary point duplication at initialization of planar polygons in Select3D_InteriorSensitivePointSet;

Test case for issue #26031
This commit is contained in:
vpa 2015-04-16 11:19:05 +03:00 committed by bugmaster
parent a21ab2c1a1
commit 7bb2b8293a
2 changed files with 33 additions and 3 deletions

View File

@ -115,7 +115,8 @@ Select3D_InteriorSensitivePointSet::Select3D_InteriorSensitivePointSet (const Ha
Standard_Real anAngle = aVec1.Dot (aVec2);
if (!aPlane.Contains (thePoints.Value (aPntIter)) || anAngle > Precision::Confusion())
{
Standard_Integer anUpperBound = aPntIter - aStartIdx;
// subtract 1 due to indexation from zero in sub-polygons
Standard_Integer anUpperBound = aPntIter - aStartIdx - 1;
Handle (TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt (0, anUpperBound);
for (Standard_Integer aIdx = aStartIdx; aIdx <= aStartIdx + anUpperBound; ++aIdx)
{
@ -217,7 +218,8 @@ Select3D_InteriorSensitivePointSet::Select3D_InteriorSensitivePointSet (const Ha
Standard_Real anAngle = aVec1.Dot (aVec2);
if (!aPlane.Contains (thePoints->Value (aPntIter)) || anAngle > Precision::Confusion())
{
Standard_Integer anUpperBound = aPntIter - aStartIdx;
// subtract 1 due to indexation from zero in sub-polygons
Standard_Integer anUpperBound = aPntIter - aStartIdx - 1;
Handle (TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt (0, anUpperBound);
for (Standard_Integer aIdx = aStartIdx; aIdx <= aStartIdx + anUpperBound; ++aIdx)
{
@ -284,7 +286,6 @@ void Select3D_InteriorSensitivePointSet::GetPoints (Handle(TColgp_HArray1OfPnt)&
const Handle(Select3D_SensitivePoly)& aPolygon = myPlanarPolygons.Value (anIdx);
aSize += aPolygon->NbSubElements();
}
aSize -= (myPlanarPolygons.Length() - 1) * 2;
theHArrayOfPnt = new TColgp_HArray1OfPnt (1, aSize);
Standard_Integer anOutputPntArrayIdx = 1;

29
tests/bugs/vis/bug26031 Normal file
View File

@ -0,0 +1,29 @@
puts "============"
puts "CR26031"
puts "============"
puts ""
##########################################################################################
# Visualization - fix out-of-range within Select3D_InteriorSensitivePointSet::GetPoints()
##########################################################################################
pload VISUALIZATION XDE
testreadiges [locate_data_file bug25747_pencil.igs] aPencil
vinit View1
vclear
vdefaults -autoTriang 0
vdisplay aPencil
vsetdispmode 1
vfit
# create a connected interactive
vconnectto aCopy 50 50 50 aPencil
vfit
# check that selection primitives for connected object were created successfully
vmoveto 220 133
checkcolor 220 133 0 1 1
vdump ${imagedir}/${casename}.png