# Re: Hello, How I can calculate an area (or surface) of a points list? And perimeter?

• To: mathgroup@smc.vnet.net
• Subject: [mg11748] Re: Hello, How I can calculate an area (or surface) of a points list? And perimeter?
• From: jtischer@pitagoras.univalle.edu.co
• Date: Thu, 26 Mar 1998 03:09:16 -0500
• Organization: Deja News - The Leader in Internet Discussion
• References: <6esdr8\$5d5@smc.vnet.net>

```Hi Joan,
have you thought about using DelaunayTriangulation
(<<DiscreteMath`ComputationalGeometry`)? That does the job, if your
surface is projectable onto a plane. In that case you first project
your points, then use DelaunayTriangulation to get a nice triangulation
of the plane point set, and finally add up the areas of the resulting
(three-dimensional) triangles. An example follows:

In[1]:= li= Table[With[{x=Random[],y=Random[]},{x,y,2Sin[x y]}],{50}];

In[2]:= proj=li[[Range[50],{1,2}]];

In[3]:= <<DiscreteMath`

In[4]:= dt=DelaunayTriangulation[proj];

(*You can plot your surface with TriangularSurfacePlot[li], also in
DiscreteMath`ComputationalGeometry.*)

In[5]:= tri[n_,m_]:={n,m,First[Intersection[dt[[n,2]],dt[[m,2]]]]}

In[6]:= tri[{n_,li_List}]:=tri[n,#]&/@li

In[7]:= triangulos=Union[Sort/@Flatten[tri/@dt,1]];

In[8]:= norm[x_] = Sqrt[x . x];

In[9]:= dist[x_,y_]:=norm[x-y]

In[10]:= area[{x_, y_, z_}] :=
With[{a = dist[x, y], b = dist[y, z], c = dist[z, x]},
1/4 Sqrt[(a + b - c)(a - b + c)(-a + b + c)(a + b + c)]]

In[11]:= area[{n_Integer,m_Integer,o_Integer}]:=
area[{li[[n]],li[[m]],li[[o]]}]

In[12]:= Plus@@area/@triangulos

Out[12]= 1.5032

(* End of example *)

As to the perimeter, if what you want is the length of the surrounding
polygon, the idea is to search for connecting segments which occur just
once in the triangles. If you need it and don't see how to do it, let
me know.

Jurgen

In article <6esdr8\$5d5@smc.vnet.net>,
joan_garcia@hotmail.com (Joan Garcia) wrote:
>
> Hello,
>
> I don't know how I can calculate an area (or surface) of a points list.
> How I can to do this?
>
> I have a points list, this list define a surface (similar a star), I
> want know the surface.
>
> Thanks
>
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading

```

• Prev by Date: Re: Re: Re: Mathematica frustrations...
• Next by Date: Re: Data Extraction from List {{x1,y1}..{xn,yn}}where ##<x<##
• Prev by thread: Re: Hello, How I can calculate an area (or surface) of a points list? And perimeter?
• Next by thread: Speed of writing in Mathematica 3.01