[vtkusers] FW:  Help with drawing lines
    Sercani 
    sercanimailgroups at gmail.com
       
    Thu Jan 22 07:03:44 EST 2009
    
    
  
Hi Eliya, i’m copying this to mail list. Keep the discussion on list so people can contribute to it…
 
From: Sercani [mailto:sercanimailgroups at gmail.com] 
Sent: Thursday, January 22, 2009 1:58 PM
To: 'אליה מירוב'
Subject: RE: [vtkusers] Help with drawing lines
 
Hi;
I think you should use vtkSpline or vtkParametricSpline but i don’t know how...I’ll need curves soon on my Project, keep in touch so we can share our experimentations…But i think you must set a vtkPointSet or some data set like this to convert your polynomial equation to vtkPoints. If you use a dataset like this, you can use it at a vtkPolyDataMapper and vtkActor couple…
 
Sercani…
 
From: אליה מירוב [mailto:eliya.mir at gmail.com] 
Sent: Wednesday, January 21, 2009 9:48 PM
To: Sercani
Subject: Re: [vtkusers] Help with drawing lines
 
Hi,
Im new to VTK 
and Im trying to figure out how to manage curves and lines in 3D
defined by polynomials.
i.e
a line between two given points:(1,0,0) and (0,1,0) is {(t,1-t,0): 0=<t<=1}
so I defined the line with a simple polynomial of three variables/coordinates.
my goal is to write (with PythonVtk) the Bézier_curve <http://en.wikipedia.org/wiki/B%C3%A9zier_curve> 
for my academic work.
if you can tell me where to look i will greatly appreciate it.
Eliya M.
2009/1/20 Sercani <sercanimailgroups at gmail.com>
Check out this tutorial:
http://vtkblog.blogspot.com/2007/06/point-and-line-plotter-in-vtk-simple.html
 
From: Konstantinos Kelg [mailto:kkelgeor at yahoo.gr] 
Sent: Tuesday, January 20, 2009 5:45 PM
To: Andre Gouws; Sercani; vtkusers at vtk.org
Subject: RE: [vtkusers] Help with drawing lines
 
Actually, the lines I have to draw are too many (more than 100.000). So I don't think drawing each line with a different actor would be a good idea. Isn't there any way to define all the lines in a single object and then render them with one actor ?
I thought that "vtkCellArray" would do the job, but I guess I was wrong. Perhaps I'm missing sth...
--- Στις Δευτ., 19/01/09, ο/η Andre Gouws <andre at ynic.york.ac.uk> έγραψε:
Από: Andre Gouws <andre at ynic.york.ac.uk>
Θέμα: Re: [vtkusers] vtkAVIWriter problem.
Προς: kkelgeor at yahoo.gr
Κοιν.: vtkusers at vtk.org
Ημερομηνία: Δευτέρα, 19 Ιανουάριος 2009, 9:44
I usually
 just use vtkLineSource (has SetPoint1 and SetPoint2 calls once you
have calculated the positions) .. example from the vtk source (Python sorry)
 
rake = vtk.vtkLineSource()
rake.SetPoint1(15, -5, 32)
rake.SetPoint2(15, 5, 32)
rake.SetResolution(21)
 
..... addmapper ...
 
..... addactor ... etc.
 
 
 
> 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
>   
  
  
  
  
  
  
i think vtkLineRepresentation  (or vtkLinewidget) is a better way to draw lines in a scene…you must set the properties of the line the  way you like, add it to the renderer  and simply set the coordinates(in world coordinates) of two end points of the line …
  
  
  
  
  
  
 
  
  
  
  
  
  
  
====================================================
  
  
  
  
  
  
  
  
  
  
  
  
  
Hi. I need to render some vectors in 3D space and I've decided to draw them as lines. However my code doesn't seem to work (I see nothing). Does anyone know why ?
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
vtkCellArray *cellArrayNorm = vtkCellArray::New();
  
  
  
  
  
  
vtkPoints *points2 = vtkPoints::New();
  
  
  
  
  
  
points2->Allocate(2*m_NumOfVertices*3*sizeof(float));
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
for(int k=0; k<m_NumOfVertices; k++)
  
  
  
  
  
  
  {
  
  
  
  
  
  
  float* fp = VerticesP[k].coords; // Get vertex coords.
  
  
  
  
  
  
  
  
  
  
  
  
  
  float* fpN = NormP[k].coords; // Get vertex normal.
  
  
  
  
  
  
  points2->SetPoint(k, fp); // Set 1st point
  
  
  
  
  
  
  points2->SetPoint(m_NumOfVertices + k, // Set 2nd point.
  
  
  
  
  
  
  
    fp[0]+fpN[0], // x+dx
  
  
  
  
  
  
      fp[1]+fpN[1], // y+dy
  
  
  
  
  
  
      fp[2]+fpN[2]);// z+dz
  
  
  
  
  
  
  // Set up new (line) cell and insert.
  
  
  
  
  
  
  int pts[2] = {k, m_NumOfVertices+k};
  
  
  
  
  
  
  cellArrayNorm->InsertNextCell(2, pts);
  
  
  
  
  
  
  }
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  vtkPolyData *polyDataNorm = vtkPolyData::New();
  
  
  
  
  
  
  polyDataNorm->SetPoints(points2);
  
  
  
  
  
  
  polyDataNorm->SetPolys(cellArrayNorm);
  
  
  
  
  
  
  
  
  
  
  
  
  
  vtkPolyDataMapper *polyDataMapperNorm = vtkPolyDataMapper::New();
  
  
  
  
  
  
  polyDataMapperNorm->SetInput(polyDataNorm);
  
  
  
  
  
  
  
  
  
  
  
  
  
  ActorNorm->SetMapper(polyDataMapperNorm);
  
  
  
  
  
  
  ren1->AddActor(ActorNorm);
  
  
  
  
  
  
  
  
  
  
  
  
  
  vtkProperty *prop = vtkProperty::New();
  
  
  
  
  
  
  prop->SetColor(1.0, 0.0, 0.0);
  
  
  
  
  
  
  ActorNorm->SetProperty(prop);
  
  
  
  
  
  
  
  
  
  
  
  
  
  points2->Delete();
  
  
  
  
  
  
  cellArrayNorm->Delete();
  
  
  
  
  
  
  polyDataNorm->Delete();
  
  
  
  
  
  
  polyDataMapperNorm->Delete();
  
  
  
  
  
  
  prop->Delete();
  
  
  
  
  
  
  
  
  
  
  
  
  
Thanks.
 
  _____  
Χρησιμοποιείτε Yahoo!
Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων 
http://login.yahoo.com/config/mail?.intl=gr 
_______________________________________________
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
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090122/ca3ae86a/attachment.htm>
    
    
More information about the vtkusers
mailing list