TransWikia.com

Determinant of Gauss (Area of a polygon of n vertices) how to implement

Mathematica Asked on August 1, 2021

A very useful procedure to find the area of ​​any irregular polygon is through the Gauss determinant.

It involves drawing the figure on a Cartesian plane, setting the coordinates of each of the vertices of the polygon.

Drawing of the choice and enumeration of the irregular pentagon points for the Gauss determinant.

Any of them is chosen at random and the pairs are placed in the following formula. The polygon must be traversed counterclockwise, taking into account that the first pair of coordinates corresponds to the chosen vertex and, after traveling all the vertices counterclockwise, the last pair must be the initial torque

https://www.universoformulas.com/imagenes/formulas/matematicas/geometria/area-poligono-irregular-determinante-gauss.jpg

Let the vertices of the polygon be: (x1, y1), (x2, y2), …, (xN, yN). The formula is as follows:

[FORMULA]]

Formula of the irregular polygon area using the Gauss Determinant

Solving it by the known procedure, we will have quickly found the area of ​​the irregular polygon.

This method is applicable to any polygon with any number of sides, both in the case of concave and convex polygons.

My question is how can I create a script that asks me
a) Number of Vertices (n)
b) Ask me to enter the n points between those n vertices
that is
$$(x_1, y_1)$$
$$(x_2, y_2)$$
……………………
$$(x_n, y_n)$$
c) Can calculate the area given the formula stated

n = Input[“Number of Vertices”, n]
(Input (x1,y1) ,(x2,y2)…..(xn,yn)) ?? ??
A=(1/2)det[x1,y1) ,(x2,y2)…..(xn,yn] ???

can you help me ? , I searched the forum but I can’t find any example that I can adapt

One Answer

What you describe is known as the shoelace formula. It has previously been implemented by J.M. here.

I can find no way to improve on J.M.'s implementation, so I will simply repeat it:

pts = CirclePoints[6];
area = Total[Det /@ Partition[pts, 2, 1, 1]]/2

(3 Sqrt[3])/2

Area@Polygon@pts

(3 Sqrt[3])/2

Another implementation is provided by Chip Hurst here. A 3D version of the shoelace formula can be found here, by george2079.

Answered by C. E. on August 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP