Object is to draw a line with vtkLineSource from an xml file, so, I get the values in the vector from an XML file, Then I pass the loop through the vectors in the nested loop to restore the values and pass them in logical form to do the drawing work.
Here is my code
for (std:: vector double>: iterator i = tab_recupere_X1.begin (); i! = Tab_recupere_X1 .end (); i ++) {p0 [0] = * i; Std :: cout & lt; & Lt; "P0 [0]" & lt; & Lt; P0 [0] to be & lt; & Lt; Std :: endl; (Std :: vector & lt; double & gt; :: iterator j = tab_recupere_Y1.begin (); j! = Tab_recupere_Y1.end (); j ++) {p0 [1] = * j; Std :: cout & lt; & Lt; "P0 [1]" & lt; & Lt; P0 [1] is referred to as & lt; & Lt; Std :: endl; // break; (Std :: vector & lt; double & gt; :: heerator k = tab_recupere_X2.begin (); k! = Tab_recupere_X2.end (); K ++) {p1 [0] = * k; Std :: cout & lt; & Lt; "P1 [0]" & lt; & Lt; P1 [0] is referred to as & lt; & Lt; Std :: endl; (Std :: vector & lt; double & gt; :: heerator p = tab_recupere_Y2.begin (); p! = Tab_recupere_Y2.end (); p ++) {p1 [1] = * p; Std :: cout & lt; & Lt; "P1 [1]" & lt; & Lt; P1 [1] is referred to as & lt; & Lt; Std :: endl; VtkSmartPointer & LT; VtkLineSource & gt; LineSource = vtkSmartPointer & lt; VtkLineSource & gt; :: new (); LineSource-> SetPoint1 (p0); LineSource-> SetPoint2 (p1); LineSource-> Updates (); VtkSmartPointer & LT; VtkPolyDataMapper & gt; Mapper = vtkSmartPointer & lt; VtkPolyDataMapper & gt; :: new (); Mapper-> SetInputConnection (lineSource-> GetOutputPort ()); VtkSmartPointer & LT; VtkActor & gt; Actor = vtkSmartPointer & lt; VtkActor & gt; :: new (); Actor & gt; SetMapper (Map Maker); Actor & gt; GetProperty () - & gt; SetLineWidth (4); VtkSmartPointer & LT; VtkRenderer & gt; Renderer = vtkSmartPointer & lt; VtkRenderer & gt; :: new (); VtkSmartPointer & LT; VtkRenderWindow & gt; RenderWindow = vtkSmartPointer & lt; VtkRenderWindow & gt; :: new (); RenderWindow- & gt; AddRenderer (Renderer); VtkSmartPointer & LT; VtkRenderWindowInteractor & gt; RenderWindowInteractor = vtkSmartPointer & lt; VtkRenderWindowInteractor & gt; :: new (); RenderWindowInteractor-> SetRenderWindow (renderWindow); Renderer-> AddActor (actor); RenderWindow- & gt; Submitted (); RenderWindowInteractor-> Start (); }}}} But the last loop runs indefinitely without stopping, and nothing has been prepared. I used (break) but nothing has improved.
My purpose is for every walk, retrieve the values of X and Y and draw the line.
Can you please help me! Thank you in advance.
OK, I think it's a bit hard to understand what's your wrong code. I can not see anything clear (maybe someone else will be there) but here are some of the problems that help you find out what's going on:
-
Work in your last loop (with the Iterator P)? Does this work when you do this?
-
You probably do not want to perform any of this big loop, you should make everything or draw a picture, when only expire
-
Redefining this code would be a good idea, you can know what you are doing now but how in 6 months? I am also not mentioning the fact that nobody else can be seen by looking at this code or it must be fully understood or rewritten, even if the bug was a character.
No comments:
Post a Comment