# Dynamically resizing an offset polygon by specifying area

Playing with a Coverage/FAR tool that is constrained on 3 sides and dynamically offsets to meet an area slider. Works fine on a rectangle (top definition) but more complex on the lower when the polygon has different sides. Without using code (only GH components, but can use Expression Editor), any idea how I can make the lower one work like the top one?

Code Exercise 4 Sided Polygon.gh (29.3 KB)

Can you explain the problem again/better?

In the definition, there are two definitions, and I want the second definition to work like the first one:

• The top definition is based on a rectangular parcel/lot that divides an area by the length of a line to determine the offset of the line to achieve that area (using width by depth for the area of a rectangle). This example shows how I would like the second to function similarly
• The bottom definition is for a non-rectangular 4-sided polygon that I would like to function the same way but cannot find an area formula for that I can use to do the same thing.

umm…

This definition:

target polygon area.gh (18.0 KB)
given an area factor, calculate the needed offset distance of a planar XY polyline.
There is a small c# script to ensure the polyline is counterclockwise and a cluster that does the main math and outputs the needed offset distance.

The c# script:

`````` private void RunScript(Curve C, ref object CCWC)
{
if(C.ClosedCurveOrientation() == Rhino.Geometry.CurveOrientation.Clockwise) C.Reverse();
CCWC = C;
}
``````

The cluster:

Works with any point-count polyline.
Works also for >1 factors, meaning the final area will be larger than the original curve’s.
Fails if self-intersections happens in original or final curve…

Barely tested.

I still am unable to “navigate” your definition, but I hope this cluster will helps you somehow…