<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=iso-8859-7>
<META content="MSHTML 6.00.6000.16640" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px"
bgColor=#ffffff leftMargin=0 topMargin=0 CanvasTabStop="true"
name="Compose message area">
<DIV><FONT face=Arial>Hello,</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>I am using the following code to create a polygon in
3D.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>vtkPolygon* polygon1 =
vtkPolygon::New(); <BR>vtkPoints* polygonPoints1 =
vtkPoints::New();<BR>vtkPolyData* polyData1 =
vtkPolyData::New();<BR>vtkPolyDataMapper* polygonMapper1 =
vtkPolyDataMapper::New(); <BR>vtkTriangleFilter* tri1=
vtkTriangleFilter::New();</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT
face=Arial>polygonPoints1->SetNumberOfPoints(4);<BR>polygon1->GetPointIds()->SetNumberOfIds(4);</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>polygonPoints1->InsertPoint(0, x1, y1,
z1);</FONT></DIV>
<DIV><FONT face=Arial>polygon1->GetPointIds()->SetId(0, 0);</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>polygonPoints1->InsertPoint(1, x2, y2,
z2);</FONT></DIV>
<DIV><FONT face=Arial>polygon1->GetPointIds()->SetId(1,
1);</FONT></DIV><FONT face=Arial>
<DIV><BR>polygonPoints1->InsertPoint(2, x3, y3, z3);</DIV>
<DIV>polygon1->GetPointIds()->SetId(2, 2);</DIV>
<DIV><BR>polygonPoints1->InsertPoint(3, x4, y4, z4);</DIV>
<DIV>polygon1->GetPointIds()->SetId(3, 3);<BR></FONT></DIV>
<DIV><FONT
face=Arial>polyData1->Allocate();<BR>polyData1->InsertNextCell(polygon1->GetCellType(),polygon1->GetPointIds());<BR>polyData1->SetPoints(polygonPoints1);</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT
face=Arial>tri1->SetInput(polyData1);<BR>polygonMapper1->SetInput(tri1->GetOutput());</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>What i am trying to do is get the area of the
polygon.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>I am using the following code but i get 0 for the
area</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>vtkMassProperties* polygonProperties =
vtkMassProperties::New(); <BR>polygonProperties->SetInputConnection(tri1->GetOutputPort());</FONT></DIV>
<DIV><FONT face=Arial>double area =
polygonProperties->SurfaceArea;</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>Can someone tell me what i am doing wrong or is there any
other way to compute the area of a polygon.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>Maybe there is a way to find the number of pixels that a
polygon has on the screen and multiply that number with the pixel
size?</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>Thanks in advance,</FONT></DIV>
<DIV><FONT face=Arial>Polys</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV></BODY></HTML>