[vtkusers] Actor Disappeared
Alex Malyushytskyy
alexmalvtk at gmail.com
Tue Dec 6 18:46:17 EST 2011
Even if somebody wanted to look at your code there is no way to
provide you any reliable advice cause you did not provide a compilable
example.
Simple examples:
- depending on the variable type you may or may not have problems in
various places.
- sizeof also may produce a problem, if for example used with
dynamically allocated array.
Also I doubt you don't get memory leaks. For example
tPoints = GenerateNewPoints(temp_para, count);
is called multiple times within loop:
while(abs(CurErr - PreErr) > threshold)
when only once
tPoints->Delete();
is called
I would recommend you to get a debugger and check every line and
compare results with your expectations.
Regards,
Alex
On Tue, Dec 6, 2011 at 2:58 PM, Wenlong Wang <scc.wwl at gmail.com> wrote:
> Dear all,
>
> I'm trying to do a gradient descent in my application. It was working well.
> But as I tried to lower the threshold(which means more iterations are
> happening), the application just stop rendering and give me a blank screen.
> Most misterious is, there is no error happens. No memory leak, no access
> vialation, no nothing. The program just jump out of the loop. I am really
> confused by this.
>
> Here is my code
>
> while(abs(CurErr - PreErr) > threshold)
> {
> PreErr = CurErr;
> tPoints->Delete();
>
> for (int i = 0; i<sizeof(para)/sizeof(double); i++)
> {
> temp_para[i] = para[i];
> }
>
> for(int index = 0; index < sizeof(para)/sizeof(double); index++)
> {
> temp_para[index] = temp_para[index] + temp_para[index]*step;
>
>
> tCamera->DeepCopy(markCamera);
> tPoints = GenerateNewPoints(temp_para, count);
>
> double err = Dist_2DLandmarks(tPoints, tCamera);
> temp_para[index] = para[index];
> par_der[index] = (err - CurErr) / temp_para[index]*step;
>
> }
>
> for(int i = 0; i < sizeof(para)/sizeof(double); i++)
> {
> para[i] = para[i] - par_der[i] * step;
> }
>
> tPoints = GenerateNewPoints(para, count);
>
> tCamera->DeepCopy(markCamera);
>
> CurErr = Dist_2DLandmarks(tPoints, tCamera);
> count ++;
> }
>
> Thank you very much for any suggestions.
>
> Best regards
> Long
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list