[Paraview] About 2D Glyph orientation
Eric E. Monson
emonson at cs.duke.edu
Fri May 14 07:51:06 EDT 2010
Hey Luc,
One option you have with many things like this is, once you create your complicated filter you can create a "custom filter" out of it, and just expose the parameters you need to adjust. I'll attach an example (where all I exposed was the glyph type and filled/not -- I'm sure in a real use case you'd also want to expose the scaling factor, etc).
To load this go to Tools->Manage Custom Filters and click Import. To create one you highlight all of the elements you want to include and then go to Tools->Create Custom Filter. Here's a page the might get you started:
http://www.paraview.org/Wiki/Custom_Filters
Good luck,
-Eric
On May 13, 2010, at 9:26 PM, luc scholtes wrote:
> Excellent!
>
> This is exactly what I needed even if it is not really direct though... Does someone know if there is a way to "automatize" this procedure, as with a custom glyph? I tried to make a Custom Glyph but without any success (probably missed all the steps necessary for such a combination). Or maybe I could include the rotation of 90 degrees around Y-axis during the recording of my data...
>
> Cheers
>
> Luc
>
> 2010/5/13 Eric E. Monson <emonson at cs.duke.edu>
> 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
>
> <alt_circles.png>
>
> 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/20100514/a54a0ba5/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CircleGlyph.cpd
Type: application/octet-stream
Size: 8939 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100514/a54a0ba5/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100514/a54a0ba5/attachment-0003.htm>
More information about the ParaView
mailing list