[vtkusers] Help - Drawing multiple lines.

Bob Palank bob at stlcc.org
Mon Jun 23 10:34:35 EDT 2008


So what is the recommended approach to drawing 100 lines given 3D coordinate
endpoints  - 100 instances of vtkLineSource?
Bob

-----Original Message-----
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
Of Amy Squillacote
Sent: Friday, June 20, 2008 8:03 AM
To: prakash vtk; vtkusers
Subject: Re: [vtkusers] Help - Drawing multiple lines.

Hi Prakash,

Please keep the discussion on the vtkusers list rather than replying to 
me directly.

No, it is not possible to use on vtkLineSource to draw intersecting 
lines. I have not looked into the speed issues, but I wouldn't expect 
this to be a problem unless (possibly) you are using very many of them 
in your scene.

- Amy

prakash vtk wrote:
> Hi Amy,
>
> Thank you very much for your reply and help. Now, I am using two 
> instances of vtklinesource to create it. But my question is can't we 
> do it using one. If I use two instances, is it not slow, as we add 
> actors to rendering window?
>
>
> Thanks and regards
> Prakash Kotre.
>
> On Tue, Jun 17, 2008 at 6:43 PM, Amy Squillacote <ahs at cfdrc.com 
> <mailto:ahs at cfdrc.com>> wrote:
>
>     Hi Prakash,
>
>     Is there any reason you cannot use two instances of vtkLineSource:
>     one going from (x0, y0) to (x1, y1) and another going from (x2,
>     y2) to (x3, y3)? vtkLineSource is intended to create a single
>     straight line between two points.
>
>     - Amy
>
>     prakash vtk wrote:
>
>         Hi all,
>
>         How do we draw multiple lines in vtk?
>
>         I want to draw a two lines intersecting perpendicularly at the
>         center in my MPR project- like             x2,y2
>                        |
>         x0,y0--------|--------x1,y1
>                        |
>                     x3,y4                                       Here ,
>         y0 and y1;  x2 and x3 are equal;
>
>         I am using vtklinesource in my program.
>
>         code snippet:
>
>             vtkLineSource *linea=vtkLineSource::New();
>            vtkPolyDataMapper2D *mapper=vtkPolyDataMapper2D::New();
>            vtkActor2D *actor=vtkActor2D::New();
>            vtkRenderer *render=vtkRenderer::New();
>            vtkRenderWindow *ventana=vtkRenderWindow::New();
>            vtkRenderWindowInteractor
>         *interac=vtkRenderWindowInteractor::New();
>              vtkInteractorStyleImage *imageStyle =
>         vtkInteractorStyleImage::New();
>             linea->SetResolution(4);
>            linea->Update();  
>          linea->GetOutput()->GetPoints()->SetNumberOfPoints(4);
>           // Try.
>            linea->GetOutput()->GetPoints()->SetPoint(0,150,0,0);
>            linea->GetOutput()->GetPoints()->SetPoint(1,150,300,0);
>            linea->GetOutput()->GetPoints()->SetPoint(2,0,150,0);
>            linea->GetOutput()->GetPoints()->SetPoint(3,300,150,0);
>            /*                                        _p
>            Dirty fix out put:                 q|_|_
>            int x=1024,y=740;                  |    //Line p & q are
>         outside the rendering window.
>            linea->GetOutput()->GetPoints()->SetPoint(0,x/2,0,0);
>            linea->GetOutput()->GetPoints()->SetPoint(1,x/2,y,0);
>            linea->GetOutput()->GetPoints()->SetPoint(2,0,y,0);
>            linea->GetOutput()->GetPoints()->SetPoint(3,0,y/2,0);
>            linea->GetOutput()->GetPoints()->SetPoint(4,x,y/2,0);*/
>
>            mapper->SetInput(linea->GetOutput());
>            actor->SetMapper(mapper);
>            actor->GetProperty()->SetColor(1.0,0.0,0.0);
>
>            render->AddActor2D(actor);
>            render->SetBackground(0.1,0.2,0.4);
>
>            ventana->AddRenderer(render);
>            interac->SetInteractorStyle(imageStyle);
>            interac->SetRenderWindow(ventana);
>              ventana->Render();
>
>           interac->Render();
>          //cleanup codes..
>
>          //Code ends here...
>
>         But, using vtklinesource, I am getting continuous line as
>         attached snapshot. I have fixed it. but its a dirty fix which
>         I dont want to integrate in my project. ( you can see the code
>         for dirty fix and its output in attachment).
>
>         Is there any way using vtklinesource to get what I expected?
>
>         vtklinesource draws a continuous line, I guess. I might be
>         wrong here...
>
>         Or Are there any other classes which help me to do this?
>         Or how can I get this done in vtk?
>
>         Please help me ...
>
>         Regards
>         Prakash,
>
------------------------------------------------------------------------
>
>         _______________________________________________
>         This is the private VTK discussion list.
>         Please keep messages on-topic. Check the FAQ at:
>         http://www.vtk.org/Wiki/VTK_FAQ
>         Follow this link to subscribe/unsubscribe:
>         http://www.vtk.org/mailman/listinfo/vtkusers
>          
>
>
>     -- 
>     Amy Squillacote                    Phone: (256) 726-4839
>     Computer Scientist                 Fax: (256) 726-4806
>     CFD Research Corporation           Web: http://www.cfdrc.com
>     215 Wynn Drive, Suite 501
>     Huntsville, AL  35805
>
>
>

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805


_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers


-- 
No virus found in this incoming message.
Checked by AVG. 
Version: 7.5.524 / Virus Database: 270.4.1/1510 - Release Date: 6/19/2008
3:21 PM





More information about the vtkusers mailing list