[Paraview] About 2D Glyph orientation
Eric E. Monson
emonson at cs.duke.edu
Thu May 13 07:23:03 EDT 2010
Hey Luc,
Ah, I see. I'd actually never looked at which way the 2D glyphs are oriented. Interesting.
So with a slightly more complicated pipeline you can do it. From Sources create a 2D Glyph source. Apply a Transform filter to that, which only has a rotation of 90 degrees around the Y-axis. Then from your data, apply the Glyph With Custom Source filter, and when it pops up the dialog for choosing each, choose your data for Input and the Transform filter for Source.
Seems like there should be an easier way of doing this, but it works. (see screen shot)
Talk to you later,
-Eric
On May 12, 2010, at 6:59 PM, luc scholtes wrote:
> Thank you Eric, but I was probably not as clear as I thought. I have already seen that a 2D glyphs can be oriented given a defined vector, but, actually, I was wondering if we can make the 2D plane perpendicular/normal to this vector, as in the attached picture.
>
> Hope it is clearer now
>
> Regards
>
> Luc
>
> 2010/5/12 Eric E. Monson <emonson at cs.duke.edu>
> Hey Luc,
>
> If I understand you correctly, you want 2D glyphs on your points, but you want them oriented according to the normal vectors you've read from your file?
>
> If you apply the Glyph filter to your data set, and then choose 2D Glyph from the Glyph Type combo-box, then you can set the type of 2d glyphs to Circle. If you want them to be oriented by the normals you've calculated, then just make sure the Orient check-box is checked, and your normals are chosen in the Vectors combo-box. I'll attach an example screen shot of the output so you can see if this is what you're looking for. (Note, I've also checked Filled to fill in the circles, but this isn't necessary.)
>
> If I'm misunderstanding your question, feel free to rephrase it and we'll try again. :)
>
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
>
>
> On May 12, 2010, at 2:25 AM, luc scholtes wrote:
>
> > Hi all,
> >
> > I am new to Paraview and I could not find any clear information on how 2D glyphs are oriented. Is there a way to control their normals to the the 2D plane?
> >
> > Here is the code I use to generate a cloud of points from a text file to which I would like to assign different filters (it can be 3D or 2D, but circles oriented by their normals would be perfect...)
> >
> > /// here is the part to recover the data
> > std::ifstream file ("cracks.txt",std::ios::in);
> > if(file){
> > while ( !file.eof() ){
> > std::string line;
> > Real p0,p1,p2,s,o0,o1,o2;
> > while ( std::getline(file, line) ){
> > file >> p0 >> p1 >> p2 >> s >> o0 >> o1 >> o2;
> > vtkIdType pid[1];
> > pid[0] = crackPos->InsertNextPoint(p0, p1, p2);
> > crackCells->InsertNextCell(1,pid);
> > crackSize->InsertNextValue(s);
> > float n[3] = { o0,o1,o2 };
> > crackOri->InsertNextTupleValue(n);
> > }
> > }
> > file.close();
> > }
> >
> > /// here is the code to create the VTK file
> > vtkSmartPointer<vtkUnstructuredGrid> crackUg = vtkSmartPointer<vtkUnstructuredGrid>::New();
> > crackUg->SetPoints(crackPos);
> > crackUg->SetCells(VTK_VERTEX, crackCells);
> > crackUg->GetPointData()->AddArray(crackSize);
> > crackUg->GetPointData()->AddArray(crackOri);
> >
> > vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
> > string fn=fileName+"cracks."+lexical_cast<string>scene->currentIteration)+".vtu";
> > writer->SetFileName(fn.c_str());
> > writer->SetInput(crackUg);
> > writer->Write();
> >
> > Do you have any advice?
> >
> > Tahnks a lot in advance
> >
> > Luc
> >
> >
> >
> > _______________________________________________
> > 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.paraview.org/mailman/listinfo/paraview
>
>
>
> <CircleOrientation>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100513/6109376a/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alt_circles.png
Type: image/png
Size: 30279 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100513/6109376a/attachment-0001.png>
More information about the ParaView
mailing list