[vtkusers] question about implicit surfaces and extractPolyDataGeometry - triangle mesh: getting elongated triangles

Audette, Michel A. maudette at odu.edu
Thu Jul 18 17:00:23 EDT 2013


Hi David, 

you're right. But I'm still seeing very flat triangles (smallest angle about 5-10 degrees) on the sides of the cylinder if I give the resolution value a high value, say 500; if I give it a somewhat lesser value, 100, the triangles on the circumference of the cylinder get a little better, typically a smallest angle of about 30 degrees. 

Worst still however, the triangles comprising caps on both ends are even more absurdly elongated: essentially, the base of these trangles criss-crosses the whole disk at each end. Seems like a bug, but meanwhile, I have to subdivided these flat triangles in a manner that does not preserve this aspect ratio. The smallest angle is less than 5 degrees, and most of the subdivision classes in VTK seem to preserve aspect ratio...  

This is what I am using. 
  // Create a line
  vtkSmartPointer<vtkLineSource> lineSource = 
    vtkSmartPointer<vtkLineSource>::New();
  lineSource->SetPoint1(0.0, 0.0, 0.0);
  lineSource->SetPoint2(0.0, 0.0, 5.0);
  lineSource->SetResolution(50);
 
  // Create a mapper and actor
  vtkSmartPointer<vtkPolyDataMapper> lineMapper = 
    vtkSmartPointer<vtkPolyDataMapper>::New();
  lineMapper->SetInputConnection(lineSource->GetOutputPort());
  vtkSmartPointer<vtkActor> lineActor = 
    vtkSmartPointer<vtkActor>::New();
  lineActor->GetProperty()->SetColor(0.0,0.0,0.1); // Give some color to the line
  lineActor->SetMapper(lineMapper);
 
  // Create a tube (cylinder) around the line
  vtkSmartPointer<vtkTubeFilter> tubeFilter = 
    vtkSmartPointer<vtkTubeFilter>::New();
  tubeFilter->SetInputConnection(lineSource->GetOutputPort());
  tubeFilter->SetRadius(5.0); //default is .5
  tubeFilter->SetNumberOfSides(200);
  tubeFilter->CappingOn(); 
  tubeFilter->Update();

Thanks for your continued support. 

Michel

 

Michel Audette, Ph.D.
Assistant Professor,
Department of Modeling, Simulation and Visualization Engineering,
Old Dominion University,
Norfolk, VA.
________________________________________
From: David Gobbi [david.gobbi at gmail.com]
Sent: Thursday, July 18, 2013 4:32 PM
To: Audette, Michel A.
Cc: vtkusers at vtk.org
Subject: Re: question about implicit surfaces and extractPolyDataGeometry - triangle mesh: getting elongated triangles

Hi Michel,

Did you take my advice about using vtkLineSource::SetResolution() and
vtkTubeFilter::SetNumberOfSides() to specify how many triangles will
be produced?

The vtkTubeFilter will produce triangles directly, or to be more
precise, it produces triangle strips.

 - David

On Thu, Jul 18, 2013 at 2:27 PM, Audette, Michel A. <maudette at odu.edu> wrote:
> Hi again,
>
> I am able to get a cylinder, but I would like to produce a triangulated surface. However the triangles that I am getting, based on a wireframe visualization, are extremely elongated. I realize that this is probably something fairly obvious for VTK expert, but... Is there are VTK object that can postprocess my polygonal cylinder and produce a number of more compact triangles, suitable for a a finite-element study?
>
> Cheers,
>
> Michel
>
> Michel Audette, Ph.D.
> Assistant Professor,
> Department of Modeling, Simulation and Visualization Engineering,
> Old Dominion University,
> Norfolk, VA.
> ________________________________________
> From: vtkusers-bounces at vtk.org [vtkusers-bounces at vtk.org] on behalf of Audette, Michel A. [maudette at odu.edu]
> Sent: Thursday, July 18, 2013 3:25 PM
> To: David Gobbi
> Cc: vtkusers at vtk.org
> Subject: [Spam:6.0 SpamScore] Re: [vtkusers] question about implicit surfaces and extractPolyDataGeometry - trying to produce a triangle mesh of a cylinder
>
> Hi David,
>
> thanks for your quick reply. I'll give it a try. I assume that a vtkTriangleFilter finishes the triangulation of the polydata.
>
> Best wishes,
>
> Michel
>
> Michel Audette, Ph.D.
> Assistant Professor,
> Department of Modeling, Simulation and Visualization Engineering,
> Old Dominion University,
> Norfolk, VA.
> ________________________________________
> From: David Gobbi [david.gobbi at gmail.com]
> Sent: Thursday, July 18, 2013 3:18 PM
> To: Audette, Michel A.
> Cc: vtkusers at vtk.org
> Subject: Re: [vtkusers] question about implicit surfaces and extractPolyDataGeometry - trying to produce a triangle mesh of a cylinder
>
> Hi Michel,
>
> The best way to produce a cylinder is usually to use vtkLineSource,
> followed by vtkTubeFilter.  Use vtkLineSource::SetResolution to set
> the resolution along the line, and vtkTubeFilter::SetNumberOfSides to
> set the resolution around the cylinder.
>
> Also, vtkTubeFilter::CappingOn() can be used to set whether the ends
> of the cylinder are open or closed.
>
>  - David
>
> On Thu, Jul 18, 2013 at 12:52 PM, Audette, Michel A. <maudette at odu.edu> wrote:
>> Dear VTK users,
>>
>> I would like to use a cylindrical implicit function in order to produce a
>> triangulated cylindrical mesh. Looking at the testing example
>> extractPolyData.tcl , which includes the code below, I see both a
>> cylindrical function used as implicit function, as well as a sphere source
>> which is used in conjunction with SetInputConnection. Can someone illuminate
>> me on what purpose is served by the latter?
>>
>> If not, how can I produce a triangulated surface mesh of a cylinder, e.g.
>> vtkCylinder?
>>
>> Here is the relevant code in the tcl test file.
>>
>> vtkSphereSource sphere
>>   sphere SetThetaResolution 8
>>   sphere SetPhiResolution 16
>>   sphere SetRadius 1.5
>>
>> # Extraction stuff
>> vtkTransform t
>>     t RotateX 90
>> vtkCylinder cylfunc
>>     cylfunc SetRadius 0.5
>>     cylfunc SetTransform t
>> vtkExtractPolyDataGeometry extract
>>     extract SetInputConnection [sphere GetOutputPort]
>>     extract SetImplicitFunction cylfunc
>>     extract ExtractBoundaryCellsOn
>>
>> vtkPolyDataMapper  sphereMapper
>>     sphereMapper SetInputConnection [extract GetOutputPort]
>>     sphereMapper GlobalImmediateModeRenderingOn
>>
>> vtkActor sphereActor
>>     sphereActor SetMapper sphereMapper
>>
>> Thanks for your support.
>>
>> Michel
>> Michel Audette, Ph.D.
>> Assistant Professor,
>> Department of Modeling, Simulation and Visualization Engineering,
>> Old Dominion University,
>> Norfolk, VA.


--
BEGIN-ANTISPAM-VOTING-LINKS
------------------------------------------------------


Teach CanIt if this mail (ID 03K1UE1cl) is spam:

Spam:        https://www.spamtrap.odu.edu/canit/b.php?i=03K1UE1cl&m=5a4005fdd737&t=20130718&c=s

Not spam:    https://www.spamtrap.odu.edu/canit/b.php?i=03K1UE1cl&m=5a4005fdd737&t=20130718&c=n

Forget vote: https://www.spamtrap.odu.edu/canit/b.php?i=03K1UE1cl&m=5a4005fdd737&t=20130718&c=f
------------------------------------------------------
END-ANTISPAM-VOTING-LINKS




More information about the vtkusers mailing list