## Constructor

#### new PolygonArea(geod, polylineopt)

Initialize a PolygonArea object.

##### Parameters:

Name | Type | Attributes | Default | Description |
---|---|---|---|---|

`geod` |
object | a Geodesic object. |
||

`polyline` |
bool |
<optional> |
false | if true the new PolygonArea object describes a polyline instead of a polygon. |

##### Properties:

Name | Type | Description |
---|---|---|

`a` |
number | the equatorial radius (meters). |

`f` |
number | the flattening. |

`polyline` |
bool | whether the PolygonArea object describes a polyline or a polygon. |

`num` |
number | the number of vertices so far. |

`lat` |
number | the current latitude (degrees). |

`lon` |
number | the current longitude (degrees). |

- Source:

### Methods

#### AddEdge(azi, s)

Add the next edge to the polygon.

This specifies the new vertex in terms of the edge from the current vertex.

##### Parameters:

Name | Type | Description |
---|---|---|

`azi` |
number | the azimuth at the current the point (degrees). |

`s` |
number | the length of the edge (meters). |

- Source:

#### AddPoint(lat, lon)

Add the next vertex to the polygon.

This adds an edge from the current vertex to the new vertex.

##### Parameters:

Name | Type | Description |
---|---|---|

`lat` |
number | the latitude of the point (degrees). |

`lon` |
number | the longitude of the point (degrees). |

- Source:

#### Clear()

Clear the PolygonArea object, setting the number of vertices to 0.

- Source:

#### Compute(reverse, sign) → {object}

Compute the perimeter and area of the polygon.

If the object is a polygon (and not a polygon), the perimeter includes the length of a final edge connecting the current point to the initial point. If the object is a polyline, then area is nan. More points can be added to the polygon after this call.

##### Parameters:

Name | Type | Description |
---|---|---|

`reverse` |
bool | if true then clockwise (instead of counter-clockwise) traversal counts as a positive area. |

`sign` |
bool | if true then return a signed result for the area if the polygon is traversed in the "wrong" direction instead of returning the area for the rest of the earth. |

- Source:

##### Returns:

r where r.number is the number of vertices, r.perimeter
is the perimeter (meters), and r.area (only returned if polyline is
false) is the area (meters^{2}).

- Type
- object

#### TestEdge(azi, s, reverse, sign) → {object}

Compute the perimeter and area of the polygon with a tentative new edge.

A new vertex is *not* added to the polygon.

##### Parameters:

Name | Type | Description |
---|---|---|

`azi` |
number | the azimuth of the edge (degrees). |

`s` |
number | the length of the edge (meters). |

`reverse` |
bool | if true then clockwise (instead of counter-clockwise) traversal counts as a positive area. |

`sign` |
bool | if true then return a signed result for the area if the polygon is traversed in the "wrong" direction instead of returning the |

- Source:

##### Returns:

r where r.number is the number of vertices, r.perimeter
is the perimeter (meters), and r.area (only returned if polyline is
false) is the area (meters^{2}).

- Type
- object

#### TestPoint(lat, lon, reverse, sign) → {object}

Compute the perimeter and area of the polygon with a tentative new vertex.

A new vertex is *not* added to the polygon.

##### Parameters:

Name | Type | Description |
---|---|---|

`lat` |
number | the latitude of the point (degrees). |

`lon` |
number | the longitude of the point (degrees). |

`reverse` |
bool | if true then clockwise (instead of counter-clockwise) traversal counts as a positive area. |

`sign` |
bool | if true then return a signed result for the area if the polygon is traversed in the "wrong" direction instead of returning the |

- Source:

##### Returns:

r where r.number is the number of vertices, r.perimeter
is the perimeter (meters), and r.area (only returned if polyline is
false) is the area (meters^{2}).

- Type
- object