<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=iso-8859-1>
<META content="MSHTML 6.00.6000.16640" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px; WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"
bgColor=#ffffff leftMargin=0 topMargin=0 CanvasTabStop="true"
name="Compose message area">
<DIV><FONT face=Arial size=2>Thanks Michael. That worked</FONT></DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=marice@knology.net
href="mailto:marice@knology.net">Michael Rice</A> </DIV>
<DIV><B>Sent:</B> Wednesday, May 07, 2008 3:35 PM</DIV>
<DIV><B>To:</B> <A
href="mailto:polys_poly@hotmail.compolys_poly@hotmail.com">polys_poly@hotmail.compolys_poly@hotmail.com</A></DIV>
<DIV><B>Subject:</B> Re: [vtkusers] Calculating the area of a
polygon</DIV></DIV></DIV>
<DIV><BR></DIV>Did you call polygonProperties->Update() before trying to use
the polygonProperties->SurfaceArea?
<DIV><BR></DIV>
<DIV>Michael<BR>
<DIV><BR>
<DIV>On May 6, 2008, at 8:00 AM, <<A
href="mailto:polys_poly@hotmail.com">polys_poly@hotmail.com</A>> <<A
href="mailto:polys_poly@hotmail.com">polys_poly@hotmail.com</A>> wrote:<BR
class=Apple-interchange-newline>
<BLOCKQUOTE type="cite">
<DIV id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px"
name="Compose message area" bgcolor="#ffffff" leftmargin="0" topmargin="0"
canvastabstop="true">
<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></FONT>
<DIV><FONT face=Arial>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></DIV>_______________________________________________<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">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">http://www.vtk.org/mailman/listinfo/vtkusers</A><BR></BLOCKQUOTE></DIV><BR></DIV></DIV></BODY></HTML>