<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi David,<br>
<br>
Actually I've solved my problem. There goes my working code:<br>
<br>
<b>vtkUnstructuredGridGeometryFilter</b> *geom;<br>
geom=vtkUnstructuredGridGeometryFilter::New();<br>
<br>
geom->SetInput(aGrid);<br>
vtkTessellatorFilter * tf = vtkTessellatorFilter::New();<br>
tf->SetOutputDimension(3);<br>
tf->SetInput(geom->GetOutput());<br>
tf->Update();<br>
<br>
vtkDataSetMapper * aMapper = vtkDataSetMapper::New();<br>
aMapper->SetInput(tf->GetOutput());<br>
aMapper->SetScalarRange(0, 270);<br>
aMapper->Update();<br>
vtkActor * aActor = vtkActor::New();<br>
aActor->SetMapper(aMapper); <br>
<br>
<br>
If I use the <b>vtkUnstructuredGridGeometryFilter</b> prior to
feeding the TessellatorFilter it works fine ! The thing is for me
that this is not documented. My code is working fine now, the nodes
ordering is ok as well.<br>
One thing I am not sure is whether I've solved the problem or I
just bypass it.<br>
One thing I didn't mention was that in case one wants to render
the triQuadraticHex... without the necessity of having its surfaces
smoothed the code also works fine, (in that case the
TessellatorFilter is not needed). This for me indicates that the
documentation for the TessellatorFilter is incomplete.<br>
I've found the solution googling on this link:<br>
<a
href="http://paraview.sourcearchive.com/documentation/3.6.2/TestUnstructuredGridGeometryFilter_8cxx-source.html">http://paraview.sourcearchive.com/documentation/3.6.2/TestUnstructuredGridGeometryFilter_8cxx-source.html</a><br>
Search for the use of <b>vtkUnstructuredGridGeometryFilter</b>
and see that it is receiving the Output() from a UnstructuredGrid
with triQuadraticHex on it. Well, that solved my problem.<br>
In case I wasn't clear or if you need some more information just
let me know.<br>
Best Regards.<br>
Gustavo.<br>
passing my Unstructured<br>
On 25/02/2011 18:47, Thompson, David C wrote:
<blockquote
cite="mid:1C9079C90336A64BBF5612428BC98E1F3AB2F0E737@ES04SNLNT.srn.sandia.gov"
type="cite">
<pre wrap="">Hi Gustavo,
Can you say exactly how the hexahedral case doesn't work? Does it fail to compile? Is the rendering incorrect?
If the rendering looks malformed, it might be because the points are not ordered the way VTK expects.
Thanks,
David
________________________________________
From: <a class="moz-txt-link-abbreviated" href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a> [<a class="moz-txt-link-abbreviated" href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a>] On Behalf Of Gustavo C Longhin [<a class="moz-txt-link-abbreviated" href="mailto:longhin@simworx.com.br">longhin@simworx.com.br</a>]
Sent: Friday, February 25, 2011 10:30
To: <a class="moz-txt-link-abbreviated" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>
Subject: [vtkusers] Rendering vtkTriQuadraticHexahedron
Hi All,
I am trying to render a vtkTriQuadraticHexahedron passing it
through a vtkTessellatorFilter so I can get smoothed surfaces / edges etc.
It worked perfectly with a vtkQuadraticTetra.
Can some of you tell me what am I missing ?
I am running VTK 5.6.1 (under windows :-().
My code:
vtkPoints * aPoints = vtkPoints::New();
aPoints->SetNumberOfPoints(27);
const int nNPFace = 9;
int BottomNodes[nNPFace] = {0,8,1,9,2,10,3,11,24};
int MiddleNodes[nNPFace] = {16,22,17,21,18,23,19,20,26};
int TopNodes[nNPFace] = {4,12,5,13,6,14,7,15,25};
aPoints->InsertPoint(BottomNodes[0], 0.5, 0, 0);
aPoints->InsertPoint(BottomNodes[1], 2, 0, 0);
aPoints->InsertPoint(BottomNodes[2], 4, 0, 0);
aPoints->InsertPoint(BottomNodes[3], 4, 2.5, 0.1);
aPoints->InsertPoint(BottomNodes[4], 4, 4, 0);
aPoints->InsertPoint(BottomNodes[5], 2, 4, 0);
aPoints->InsertPoint(BottomNodes[6], 0.5, 4, 0);
aPoints->InsertPoint(BottomNodes[7], 0, 2.1, 0);
aPoints->InsertPoint(BottomNodes[8], 2, 2, 0);
aPoints->InsertPoint(MiddleNodes[0], 0, 0, 2);
aPoints->InsertPoint(MiddleNodes[1], 2, 0.5, 2);
aPoints->InsertPoint(MiddleNodes[2], 4, 0, 2);
aPoints->InsertPoint(MiddleNodes[3], 4, 2, 2);
aPoints->InsertPoint(MiddleNodes[4], 4, 4.1, 2);
aPoints->InsertPoint(MiddleNodes[5], 2, 4, 2);
aPoints->InsertPoint(MiddleNodes[6], 0, 4, 2.1);
aPoints->InsertPoint(MiddleNodes[7], 0, 2, 2);
aPoints->InsertPoint(MiddleNodes[8], 2, 2, 2.1);
aPoints->InsertPoint(TopNodes[0], 0, 0, 4);
aPoints->InsertPoint(TopNodes[1], 2.1, 0, 4);
aPoints->InsertPoint(TopNodes[2], 4, 0, 4);
aPoints->InsertPoint(TopNodes[3], 4, 2.1, 5);
aPoints->InsertPoint(TopNodes[4], 4, 4, 4.1);
aPoints->InsertPoint(TopNodes[5], 2, 4, 4);
aPoints->InsertPoint(TopNodes[6], 0.1, 4, 4);
aPoints->InsertPoint(TopNodes[7], 0, 2, 5);
aPoints->InsertPoint(TopNodes[8], 2, 2, 4.1);
vtkTriQuadraticHexahedron * aHexa = vtkTriQuadraticHexahedron::New();
for(int i = 0; i < nNPFace; i++)
{
aHexa->GetPointIds()->SetId(BottomNodes[i], BottomNodes[i]);
aHexa->GetPointIds()->SetId(MiddleNodes[i], MiddleNodes[i]);
aHexa->GetPointIds()->SetId(TopNodes[i], TopNodes[i]);
}
vtkFloatArray * Scalars = vtkFloatArray::New();
Scalars->SetName("Temperature");
for(int i = 0; i < 27; i++)
{
Scalars->InsertNextValue(i*10+1);
}
vtkUnstructuredGrid * aGrid = vtkUnstructuredGrid::New();
aGrid->Allocate(1, 1);
aGrid->InsertNextCell(aHexa->GetCellType(), aHexa->GetPointIds());
aGrid->SetPoints(aPoints);
aGrid->GetPointData()->SetScalars(Scalars);
vtkTessellatorFilter * tf = vtkTessellatorFilter::New();
tf->SetOutputDimension(2);
tf->SetInput(aGrid);
tf->Update();
vtkDataSetMapper * aMapper = vtkDataSetMapper::New();
aMapper->SetInput(tf->GetOutput());
aMapper->SetScalarRange(0, 270);
aMapper->Update();
vtkActor * aActor = vtkActor::New();
aActor->SetMapper(aMapper);
.
.
.
.
The aActor object is then used in a GetRenderer()->AddActor(aActor) call.
In the same code, exchanging the vtkTriQuadraticHexahedron with
vtkQuadraticTetra (and obviously correcting the Point Information) works
perfectly. I must be missing something.
Thanks a lot.
Best regards.
Gustavo
--
Gustavo C Longhin
Coord. Eng. de Software
SimWorx Eng P&D
+55 (19) 92854509
+55 (19) 37466155
+55 (19) 32891800
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Gustavo C Longhin
Coord. Eng. de Software
SimWorx Eng P&D
+55 (19) 92854509
+55 (19) 37466155
+55 (19) 32891800
</pre>
</body>
</html>