Gerrick,<br><br>Thanks for the response. I'm using C++, and created this method to create a triangle object:<br><br> // Create the objects<br> Points = vtkPoints::New();<br> Array = vtkFloatArray::New();<br> Triangle = vtkTriangle::New();<br>
Grid = vtkUnstructuredGrid::New();<br> TriangleMapper = vtkDataSetMapper::New();<br> aTriangle = vtkActor::New();<br><br> // Triangles have three points<br> Points->SetNumberOfPoints(3);<br><br> // Add some dummy points to the vtkPoints object<br>
Points->InsertPoint(0, 0.0, 0.0, 0.0);<br> Points->InsertPoint(1, 0.0, 0.0, 0.0);<br> Points->InsertPoint(2, 0.0, 0.0, 0.0);<br><br> // Set up the float array<br> Array->SetNumberOfComponents(3);<br>
Array->SetNumberOfTuples(3);<br> Array->InsertTuple3(0, 1, 1, 1);<br> Array->InsertTuple3(1, 2, 2, 2);<br> Array->InsertTuple3(2, 3, 3, 3);<br><br> // Set up the triangle object<br> Triangle->GetPointIds()->SetId(0, 0);<br>
Triangle->GetPointIds()->SetId(1, 1);<br> Triangle->GetPointIds()->SetId(2, 2);<br><br> // Set up the unstructured grid object<br> Grid->Allocate(1, 1);<br> Grid->InsertNextCell(Triangle->GetCellType(), Triangle->GetPointIds());<br>
Grid->SetPoints(Points);<br> Grid->GetPointData()->SetTCoords(Array);<br><br> // Set up the mapper<br> TriangleMapper->SetInput(Grid);<br><br> // Set up the Actor<br> aTriangle->SetMapper(TriangleMapper);<br>
<br> aTriangle->GetProperty()->SetColor(1.0, 1.0, 0.0);// Yellow<br><br> // Add it to the scene<br> Renderer->GetRenderer()->AddActor(aTriangle);<br><br>After I create the triangle, I call an update method that does this:<br>
<br> Points->SetPoint(0, Node1.X, Node1.Y, Node1.Z);<br> Points->SetPoint(1, Node2.X, Node2.Y, Node2.Z);<br> Points->SetPoint(2, Node3.X, Node3.Y, Node3.Z);<br><br> // Re-render the scene<br> Renderer->GetRenderer()->Render();<br>
<br>The first time I call this update function, the triangle is displayed correctly. Subsequent calls, however, do not update the position of the triangle. I tried changing the update method to include most of the procedure for creating the object, but I still get no change in the object's position. Is there something I can do to update the position of the triangle after it has been created? Do you know why my update function works the first time but has no effect after the first time it is called?<br>
<br>Thanks for your help!<br><br>-Kerry<br><br><div class="gmail_quote">On Wed, Jan 7, 2009 at 9:31 PM, Gerrick Bivins <span dir="ltr"><<a href="mailto:gbivins@objectreservoir.com">gbivins@objectreservoir.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<font face="Calibri, Verdana, Helvetica, Arial"><span style="font-size: 11pt;">You have to create a data set (vtkPolyData) and add the triangle as a cell and the points are specified as well.<br>
Look hear for an example:<br>
<a href="http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Examples/DataManipulation/Python/BuildUGrid.py?root=VTK&content-type=text/plain" target="_blank">http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Examples/DataManipulation/Python/BuildUGrid.py?root=VTK&content-type=text/plain</a><br>
<br>
Gerrick<div><div></div><div class="Wj3C7c"><br>
<br>
On 1/7/09 8:18 PM, "Kerry Loux" <<a href="http://louxkr@gmail.com" target="_blank">louxkr@gmail.com</a>> wrote:<br>
<br>
</div></div></span></font><blockquote><font face="Calibri, Verdana, Helvetica, Arial"><span style="font-size: 11pt;"><div><div></div><div class="Wj3C7c">Hello,<br>
<br>
For my application, I need to display a single triangle in 3-space. The triangle is not necessarily equilateral. What is the easiest way to create a triangle object? I considered vtkTriangle and vtkTriangleStrip, but I'm not clear on how to assign the locations of the vertices. Also, as far as I can tell the vtkTriangle (and vtkCell) classes don't have any kind of GetOutput() function. How do you map these classes to an actor? I was hoping for some kind of primitive shape source, similar to vtkCyliderSource or vtkSphereSource, but there doesn't seem to be any.<br>
<br>
I'm still using the 5.0.4 release.<br>
<br>
Thanks for your advice!<br>
<br>
-Kerry<br>
<br>
</div></div><hr size="3" width="95%" align="center"></span></font><font size="2"><font face="Consolas, Courier New, Courier"><span style="font-size: 10pt;">_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</span></font></font></blockquote>
</div>
</blockquote></div><br>