<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">Hi,</span><br style="font-family: arial,helvetica,sans-serif;"><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">I want to display analog &amp; digital signals in a cartesian coordinate system which </span><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">should be zoomable. I have tried several approaches and simply do not get further.</span><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">So I need help.</span><br style="font-family: arial,helvetica,sans-serif;"><br style="font-family:
 arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">One of the approaches which I try is vtkActor2D. Problem is, that if I change the</span><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">window size, it does not change the size of the 2D actor. First position of the</span><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">2D actor I can wonderfully set up, but position2 cannot be changed. Height and</span><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">width of the 2D actor remains always constant.</span><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">Is it possible to zoom with vtkActor2D? If so, how?</span><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family:
 arial,helvetica,sans-serif;">Which additional functions do I need?</span><br style="font-family: arial,helvetica,sans-serif;"><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">.luxtheme.</span><br><br><span style="font-family: arial,helvetica,sans-serif;">my code:</span><br><br>#include "vtkRenderWindow.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "vtkRenderer.h"<br>#include "vtkPolyDataMapper2D.h"<br>#include "vtkCellArray.h"<br>#include "vtkPoints.h"<br>#include "vtkPolyData.h"<br>#include "vtkActor2D.h"<br>#include "vtkcamera.h"<br><br>#include &lt;cstdlib&gt;<br>#include &lt;ctime&gt;<br><br>//random signal<br>void random_Signal (int timeLine, int *event_array_time, <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int *event_array_bit, int &amp;array_index) <br>{<br>&nbsp;&nbsp;&nbsp; srand((unsigned)time(0));<br>&nbsp;&nbsp;&nbsp;
 int time=0;<br>&nbsp;&nbsp;&nbsp; int counter=0;<br>&nbsp;&nbsp;&nbsp; int start_bit = 0;<br><br>&nbsp;&nbsp;&nbsp; while(time&lt;timeLine)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; counter++;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; event_array_time[counter-1]=time;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; event_array_bit[counter-1]=start_bit;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int random_event = (rand()%500)+1;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; time+=random_event;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; start_bit=(start_bit+1)%2;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; event_array_time[counter-1]=timeLine;<br><br>&nbsp;&nbsp;&nbsp; array_index=counter;<br>}<br><br>//line<br>void create_Line(double x1, double y1, double x2, double y2, <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;vtkPoints *points, vtkCellArray *lines, int &amp;pID)<br>{<br>&nbsp;&nbsp;&nbsp;
 points-&gt;InsertNextPoint(x1,y1,0);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; points-&gt;InsertNextPoint(x2,y2,0);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; lines-&gt;InsertNextCell(2);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; lines-&gt;InsertCellPoint(pID);&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; lines-&gt;InsertCellPoint(pID+1);&nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; pID+=2;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>}<br><br>//MAIN<br>void main()<br>{<br>&nbsp;&nbsp;&nbsp; const int events=100; <br>&nbsp;&nbsp;&nbsp; int event_array_time[events];<br>&nbsp;&nbsp;&nbsp; int event_array_bit[events];<br>&nbsp;&nbsp;&nbsp; int timeLine = 2000;&nbsp; <br>&nbsp;&nbsp;&nbsp; int array_index = 0;<br><br>&nbsp;&nbsp;&nbsp; vtkPoints *points =
 vtkPoints::New();<br>&nbsp;&nbsp;&nbsp; vtkCellArray *lines = vtkCellArray::New();<br>&nbsp;&nbsp;&nbsp; int pID = 0;<br><br>&nbsp;&nbsp;&nbsp; // generate random signal<br>&nbsp;&nbsp;&nbsp; random_Signal(timeLine, event_array_time, event_array_bit, array_index);<br>&nbsp;&nbsp;&nbsp; cout &lt;&lt; "\n\nAI: " &lt;&lt; array_index &lt;&lt; endl;<br><br>&nbsp;&nbsp;&nbsp; //plot signal<br>&nbsp;&nbsp;&nbsp; create_Line(800.0/timeLine*event_array_time[0],<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 300*event_array_bit[0], &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //position1<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 800.0/timeLine*event_array_time[1],&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 300*event_array_bit[0],&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;  //position2<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; points,
 lines, pID);<br><br>&nbsp;&nbsp;&nbsp; for (int i=1; i&lt;array_index-1; i++) {<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // toggle line<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; create_Line(800.0/timeLine*event_array_time[i], 300*event_array_bit[i],<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 800.0/timeLine*event_array_time[i], 300*event_array_bit[i+1],<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; points, lines, pID);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // High-/ Low-line<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; create_Line(800.0/timeLine*event_array_time[i], 300*event_array_bit[i],<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 800.0/timeLine*event_array_time[i+1], 300*event_array_bit[i],<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; points, lines, pID);<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; // Create 2d-actor<br>&nbsp;&nbsp;&nbsp; vtkPolyData* polyData =
 vtkPolyData::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; polyData-&gt;SetPoints(points);&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; polyData-&gt;SetLines(lines);&nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; vtkPolyDataMapper2D *mapper = vtkPolyDataMapper2D::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mapper-&gt;SetInput(polyData);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; vtkActor2D *actor = vtkActor2D::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; actor-&gt;SetMapper(mapper);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //actor-&gt;GetPositionCoordinate()-&gt;SetCoordinateSystemToNormalizedViewport(); //OK<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //actor-&gt;GetPositionCoordinate()-&gt;SetValue(.2,.5); //OK<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; actor-&gt;SetWidth(0.7); // no effect<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; actor-&gt;SetHeight(0.1); // no
 effect<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //actor-&gt;SetPosition(0.1,0.1); //OK<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; actor-&gt;GetPosition2Coordinate()-&gt;SetCoordinateSystemToNormalizedViewport(); <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //^no effect<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; actor-&gt;GetPosition2Coordinate()-&gt;SetValue(.2,.5); //no effect<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; actor-&gt;SetPosition2(0.9,0.9); //no effect<br><br>&nbsp;&nbsp;&nbsp; // Create a renderer<br>&nbsp;&nbsp;&nbsp; vtkRenderer* ren = vtkRenderer::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ren-&gt;SetBackground(0.75,0.25,0.25);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ren-&gt;AddActor(actor);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ren-&gt;GetActiveCamera()-&gt;ParallelProjectionOff(); //no effect<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ren-&gt;GetActiveCamera()-&gt;Zoom(5); //no effect<br><br>&nbsp;&nbsp;&nbsp; // Create a render
 window<br>&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();<br>&nbsp;&nbsp;&nbsp; vtkRenderWindow* renWin = vtkRenderWindow::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renWin-&gt;AddRenderer(ren);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renWin-&gt;SetSize( 800,300 );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renWin-&gt;SetInteractor( iren );<br><br>&nbsp;&nbsp;&nbsp; iren-&gt;Initialize();<br>&nbsp;&nbsp;&nbsp; renWin-&gt;Render();<br>&nbsp;&nbsp;&nbsp; iren-&gt;Start();<br><br>&nbsp;&nbsp;&nbsp; //...<br>}<br><br></div></div><br>


      </body></html>