<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi VTK developers,<div><br></div><div>I have an issue where my application crashed and/or fails to render a vtkXYPlotActor properly</div><div>when the input data needs to be clipped.</div><div><br></div><div>After some investigation, I tracked the issue down to vtkXYPlotActor::ClipPlotData(...).</div><div><br></div><div>Here is what I think is the code in cause here. The code test if x1 is out of range. If so, it assumes that x2 is in range,</div><div>which is not always the case for me. Therefore, I end up with an id of -1 in my cells.</div><div><br></div><div>Is that a bug, or some desired behaviour I am not getting here.</div><div><br></div><div>Thanks,</div><div><br></div><div>Mathieu</div><div><div>_________________________</div><div>Mathieu Coursolle, ing.jr., M.Ing.</div><div>Rogue Research Inc.</div><div><a href="http://www.rogue-research.com/">www.rogue-research.com</a></div></div><div><br></div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; color: rgb(20, 135, 11); "><font class="Apple-style-span" face="Helvetica">//intersect each segment with the four planes</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><span style="color: rgb(47, 39, 225); "><font class="Apple-style-span" face="Helvetica">if</font></span><font class="Apple-style-span" face="Helvetica"> ( (x1[0] < p1[0] && x2[0] < p1[0]) || (x1[0] > p2[0] && x2[0] > p2[0]) ||</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> (x1[1] < p1[1] && x2[1] < p1[1]) || (x1[1] > p2[1] && x2[1] > p2[1]) )</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-family: Monaco; "><font class="Apple-style-span" face="Helvetica"> {</font><span class="Apple-style-span" style="color: rgb(20, 135, 11); "><span style="color: rgb(0, 0, 0); "><font class="Apple-style-span" face="Helvetica"> </font></span></span></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><span class="Apple-style-span" style="color: rgb(20, 135, 11); "><span style="color: rgb(0, 0, 0); "><font class="Apple-style-span" face="Helvetica"> ;</font></span><font class="Apple-style-span" face="Helvetica">//trivial rejection</font></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> }</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> </font><span style="color: rgb(47, 39, 225); "><font class="Apple-style-span" face="Helvetica">else</font></span><font class="Apple-style-span" face="Helvetica"> </font><span style="color: rgb(47, 39, 225); "><font class="Apple-style-span" face="Helvetica">if</font></span><font class="Apple-style-span" face="Helvetica"> (x1[0] >= p1[0] && x2[0] >= p1[0] && x1[0] <= p2[0] && x2[0] <= p2[0] &&</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> x1[1] >= p1[1] && x2[1] >= p1[1] && x1[1] <= p2[1] && x2[1] <= p2[1] )</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; color: rgb(20, 135, 11); "><span style="color: rgb(0, 0, 0); "><font class="Apple-style-span" face="Helvetica"> {</font></span><font class="Apple-style-span" face="Helvetica">//trivial acceptance</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> newPts[0] = pointMap[pts[i]];</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> newPts[1] = pointMap[pts[i+1]];</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> newLines->InsertNextCell(2,newPts);</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> }</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> </font><span style="color: rgb(47, 39, 225); "><font class="Apple-style-span" face="Helvetica">else</font></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> {</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> </font><span style="color: rgb(47, 39, 225); "><font class="Apple-style-span" face="Helvetica">if</font></span><font class="Apple-style-span" face="Helvetica"> (x1[0] >= p1[0] && x1[0] <= p2[0] && x1[1] >= p1[1] && x1[1] <= p2[1] )</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; color: rgb(20, 135, 11); "><span style="color: rgb(0, 0, 0); "><font class="Apple-style-span" face="Helvetica"> {</font></span><font class="Apple-style-span" face="Helvetica">//first point in</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> newPts[0] = pointMap[pts[i]];</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> }</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> </font><span style="color: rgb(47, 39, 225); "><font class="Apple-style-span" face="Helvetica">else // << ****************************What if x2 is out of range ??? **********</font></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; color: rgb(20, 135, 11); "><span style="color: rgb(0, 0, 0); "><font class="Apple-style-span" face="Helvetica"> {</font></span><font class="Apple-style-span" face="Helvetica">//second point in</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> newPts[0] = pointMap[pts[i+1]];</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> }</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> </font><span style="color: rgb(47, 39, 225); "><font class="Apple-style-span" face="Helvetica">for</font></span><font class="Apple-style-span" face="Helvetica"> (j=0; j<4; j++)</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> {</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> </font><span style="color: rgb(47, 39, 225); "><font class="Apple-style-span" face="Helvetica">this</font></span><font class="Apple-style-span" face="Helvetica">->ClipPlanes->GetPoints()->GetPoint(j, px);</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> </font><span style="color: rgb(47, 39, 225); "><font class="Apple-style-span" face="Helvetica">this</font></span><font class="Apple-style-span" face="Helvetica">->ClipPlanes->GetNormals()->GetTuple(j, n);</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> </font><span style="color: rgb(47, 39, 225); "><font class="Apple-style-span" face="Helvetica">if</font></span><font class="Apple-style-span" face="Helvetica"> ( vtkPlane::IntersectWithLine(x1,x2,n,px,t,xint) && t >= 0 && t <= 1.0 )</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> {</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> newPts[1] = newPoints->InsertNextPoint(xint);</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> </font><span style="color: rgb(47, 39, 225); "><font class="Apple-style-span" face="Helvetica">break</font></span><font class="Apple-style-span" face="Helvetica">;</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> }</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "><font class="Apple-style-span" face="Helvetica"> </font>}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; "> }</div></div><div><br></div><br><br><div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline"></div></body></html>