[vtkusers] How to pass a triangle without its point set?

Bill Lorensen bill.lorensen at gmail.com
Sun Nov 1 08:43:20 EST 2009


vtkTriangle is used if you want to operate on an individual triangle.
For example, GetNextCell() applied to a dataset returns a triangle,
voxel, quad, etc. Then you can compute normals, areas, etc.

The datasets are containers. The cells (e.g. vtkTriangle) are the
primitives. As you noted, there is no AddCell. I suppose there could
have been. If you grep all of vtk for vtkTriangle you will see that it
is mainly used to get a concrete representation that can be operated
on.

So, I'm not sure these two examples accomplish anything. They do show
2 different ways to create a triangle, but the ultimate use of the two
cases is different.


On Sun, Nov 1, 2009 at 8:08 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> David,
> I'll take a look.
>
> Bill
>
> On Sat, Oct 31, 2009 at 8:27 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
>> On Sat, Oct 24, 2009 at 12:47 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>> vtkTriangle is a vtkCell. It only has 3 points and 3 point ids. The
>>> points and ids are created as construction. In your original example,
>>> how would expect triangle to know about the points you created.
>>>
>>> SetPoint and InsertPoint have different semantics. In this case,
>>> SetPoint is better, since range checking is not required.
>>>
>>> From the vtkPoints.h
>>>  // Description:
>>>  // Insert point into object. No range checking performed (fast!).
>>>  // Make sure you use SetNumberOfPoints() to allocate memory prior
>>>  // to using SetPoint().
>>>  void SetPoint(vtkIdType id, const float x[3]) { this->Data->SetTuple(id,x);};
>>>  void SetPoint(vtkIdType id, const double x[3]) { this->Data->SetTuple(id,x);};
>>>  void SetPoint(vtkIdType id, double x, double y, double z);
>>>
>>>  // Description:
>>>  // Insert point into object. Range checking performed and memory
>>>  // allocated as necessary.
>>>  void InsertPoint(vtkIdType id, const float x[3])
>>>    { this->Data->InsertTuple(id,x);};
>>>  void InsertPoint(vtkIdType id, const double x[3])
>>>    {this->Data->InsertTuple(id,x);};
>>>  void InsertPoint(vtkIdType id, double x, double y, double z);
>>>
>>> vtkPolyData has a large array of points that can be indexed.
>>> vtkTriangle is about working with an individual to do things like
>>> compute areas, normals, etc.
>>>
>>> Bill
>>
>>
>> Bill,
>>
>> Would you mind reading the text at the top of these and making sure it
>> is clear/correct?
>>
>> http://www.vtk.org/Wiki/Triangle_%28on_large_point_array%29
>> http://www.vtk.org/Wiki/Triangle_%28self_contained%29
>>
>> Thanks,
>>
>> David
>> _______________________________________________
>> 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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>



More information about the vtkusers mailing list