mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51: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:
parent
a21ab2c1a1
commit
7bb2b8293a
@ -115,7 +115,8 @@ Select3D_InteriorSensitivePointSet::Select3D_InteriorSensitivePointSet (const Ha
|
|||||||
Standard_Real anAngle = aVec1.Dot (aVec2);
|
Standard_Real anAngle = aVec1.Dot (aVec2);
|
||||||
if (!aPlane.Contains (thePoints.Value (aPntIter)) || anAngle > Precision::Confusion())
|
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);
|
Handle (TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt (0, anUpperBound);
|
||||||
for (Standard_Integer aIdx = aStartIdx; aIdx <= aStartIdx + anUpperBound; ++aIdx)
|
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);
|
Standard_Real anAngle = aVec1.Dot (aVec2);
|
||||||
if (!aPlane.Contains (thePoints->Value (aPntIter)) || anAngle > Precision::Confusion())
|
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);
|
Handle (TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt (0, anUpperBound);
|
||||||
for (Standard_Integer aIdx = aStartIdx; aIdx <= aStartIdx + anUpperBound; ++aIdx)
|
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);
|
const Handle(Select3D_SensitivePoly)& aPolygon = myPlanarPolygons.Value (anIdx);
|
||||||
aSize += aPolygon->NbSubElements();
|
aSize += aPolygon->NbSubElements();
|
||||||
}
|
}
|
||||||
aSize -= (myPlanarPolygons.Length() - 1) * 2;
|
|
||||||
|
|
||||||
theHArrayOfPnt = new TColgp_HArray1OfPnt (1, aSize);
|
theHArrayOfPnt = new TColgp_HArray1OfPnt (1, aSize);
|
||||||
Standard_Integer anOutputPntArrayIdx = 1;
|
Standard_Integer anOutputPntArrayIdx = 1;
|
||||||
|
29
tests/bugs/vis/bug26031
Normal file
29
tests/bugs/vis/bug26031
Normal 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
|
Loading…
x
Reference in New Issue
Block a user