[Insight-developers] itkBoundingBox... surprising behavior

Jean-Philippe Guyon piloo@unc.edu
Mon, 4 Mar 2002 12:11:34 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_0083_01C1C375.BA36FB80
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello Folks,

I have just noticed something which seems weird in the SetPoints() =
function of the itkBoundingBox class.
When you call the SetPoints() function, it is first checking if the =
pointer passed as argument is the same as the one currently stored in =
the member variable m_PointsContainer. If that is the same, then the =
points container pointer is not updated, and the Modified flag is not =
turned on.
So, if you are using the bounding box the following way:

PointContainerPointer p =3D BB->GetPoints();
p->InsertElement();=20
// ...or any other function to modify the point container
BB->SetPoints();

the pointer won't be updated, and that make sense. But, the modified =
flag won't be turned on as well, and then the next call to the =
ComputeBoundingBox() function will not take into consideration the fact =
that the point container has been modified, since it is only checking =
for the Modified flag of the BoundingBox class, and it doesn't keep =
track of the last time the point container has been updated.

So, to curb that problem, I need to create a new point container every =
time I want to update the BoundingBox, and then to call the SetPoints() =
function... that doesn't seem to be the best way to go in my opinion :)
=20
Please, let me know if there is anything I'm doing wrong when I'm using =
the bounding box class.
I might do not understand the way to use it.=20

Jean-Philippe

------=_NextPart_000_0083_01C1C375.BA36FB80
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello Folks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have just noticed something which =
seems weird in=20
the SetPoints() function of the itkBoundingBox class.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>When you call the SetPoints() function, =
it is first=20
checking if the pointer passed as argument is the same as the one =
currently=20
stored in the member variable m_PointsContainer. If&nbsp;that is the =
same, then=20
the points container pointer is not updated, and the Modified flag is =
not turned=20
on.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>So, if you are using the bounding box =
the following=20
way:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>PointContainerPointer p =3D=20
BB-&gt;GetPoints();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>p-&gt;InsertElement(); </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>// ...or any other function to modify =
the point=20
container</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>BB-&gt;SetPoints();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>the pointer won't be updated, and that =
make sense.=20
But, the modified flag won't be turned on as well, and then the next =
call=20
to&nbsp;the ComputeBoundingBox() function will not take into =
consideration the=20
fact that the point container has been modified, since it is only =
checking for=20
the Modified flag of the BoundingBox class, and it doesn't keep track of =
the=20
last time the point container has been updated.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>So, to curb that problem, I need to =
create a new=20
point container every time I want to update the BoundingBox, and then to =
call=20
the SetPoints() function... that doesn't seem to be the best way to go =
in my=20
opinion :)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Please, let me know if there is =
anything I'm doing=20
wrong when I'm using the bounding box class.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I might do not understand the way to =
use it.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>Jean-Philippe</FONT></DIV></BODY></HTML>

------=_NextPart_000_0083_01C1C375.BA36FB80--