[vtkusers] Concaved Polygon edge shown straight

John Platt jcplatt at lineone.net
Wed Feb 4 16:48:50 EST 2004


Hi users,

Thanks for your responses - I am humbled (I was taken in by Fig 14-15 in
the VTK User's Guide).

John

-----Original Message-----
From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org] On Behalf
Of Jeff Lee
Sent: 04 February 2004 14:09
To: John Platt
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Concaved Polygon edge shown straight

opengl cannot display concave polys - you must tessellate.  try triangle

filter, or there are some tesselate filters out there that will do the 
trick.
-Jeff

John Platt wrote:

> Hi users,
>
>  
>
> I have a single, plane, curvilinear quadrilateral with 2 straight 
> sides, 1 concaved side and 1 convexed side. This is defined using 6 
> points and VTK_POLYGON. This is the only cell in vtkUnstructuredGrid 
> which is input to vtkDataSetMapper.
>
>  
>
> The concaved edge is displayed straight while all other edges are 
> shown correctly. If the polygon is rotated, evidence of the correct 
> shape can be seen at certain orientations.
>
>  
>
> What am I missing? I have attached the cpp file used with vtk 4.5.0.
>
>  
>
> Many thanks.
>
>  
>
> John Platt
>
>  
>
> #include "stdafx.h"
>
> #include "vtkPoints.h"
>
> #include "vtkIdList.h"
>
> #include "vtkCellType.h"
>
> #include "vtkUnstructuredGrid.h"
>
> #include "vtkDataSetMapper.h"
>
> #include "vtkActor.h"
>
> #include "vtkProperty.h"
>
> #include "vtkRenderWindowInteractor.h"
>
> #include "vtkRenderWindow.h"
>
> #include "vtkRenderer.h"
>
>  
>
> int APIENTRY WinMain(HINSTANCE hInstance,
>
>                      HINSTANCE hPrevInstance,
>
>                      LPSTR     lpCmdLine,
>
>                      int       nCmdShow)
>
> {
>
>    // Define points.
>
>    vtkPoints* globalCoords = vtkPoints::New();
>
>    globalCoords->Initialize();
>
>       globalCoords->InsertNextPoint( 0,   0, 0 );
>
>       globalCoords->InsertNextPoint( 1, 0.5, 0 ); // concave
>
>       globalCoords->InsertNextPoint( 2,   0, 0 );
>
>       globalCoords->InsertNextPoint( 2,   2, 0 );
>
>       globalCoords->InsertNextPoint( 1, 2.5, 0 ); // convexed
>
>       globalCoords->InsertNextPoint( 0,   2, 0 );
>
>  
>
>    // Define the polygon topology.
>
>    vtkIdList* topology = vtkIdList::New();
>
>    for ( int nPts = 0; nPts < 6; nPts++ )
>
>       topology->InsertNextId( nPts );
>
>  
>
>    // Add the points and the single cell to an unstructired grid.
>
>    vtkUnstructuredGrid* UGrid = vtkUnstructuredGrid::New();
>
>    UGrid->SetPoints( globalCoords );
>
>    UGrid->InsertNextCell( VTK_POLYGON, topology );
>
>  
>
>    // Convert the cell to graphic primitives.
>
>    vtkDataSetMapper* faceMapper = vtkDataSetMapper::New();
>
>    faceMapper->SetInput( UGrid );
>
>    faceMapper->ScalarVisibilityOff();
>
>  
>
>    // Create an actor to represent the cell faces.
>
>    vtkActor* faceActor = vtkActor::New();
>
>    faceActor->SetMapper( faceMapper );
>
>    faceActor->GetProperty()->SetColor( 1, 0, 0 );
>
>  
>
>    // Create the Renderer, RenderWindow, and RenderWindowInteractor.
>
>    vtkRenderer* renderer = vtkRenderer::New();
>
>    renderer->AddActor( faceActor );
>
>  
>
>    vtkRenderWindow* renderWin = vtkRenderWindow::New();
>
>    renderWin->AddRenderer( renderer );
>
>  
>
>    vtkRenderWindowInteractor* interactor = 
> vtkRenderWindowInteractor::New();
>
>    interactor->SetRenderWindow( renderWin );
>
>  
>
>    interactor->Initialize();
>
>    renderWin->Render();
>
>  
>
>       // Main message loop:
>
>       MSG msg;
>
>       while (GetMessage(&msg, NULL, 0, 0))
>
>       {
>
>       TranslateMessage(&msg);
>
>             DispatchMessage(&msg);
>
>       }
>
>   
>
>    return 0;
>
> }
>
>  
>
>  
>
>  
>
>  
>
_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list