4side polygon with fixed lengths and area

Hi
how can i get to a polygon with fixed side lengths and area?

Like this:
target_area_length.gh (12.5 KB)

1 Like

thanks a lot

How about more sides like this?

There are some caveats to this solution, eh?

• More than one possible solution for the same target area and segment lengths?
• A limited range of target areas for given segment lengths?
• A limited range of segments lengths for a given target area?

Do you expect some of those segments / vertices to remain fixed while allowing the others to move? Which ones are fixed?

hi ! Thanks for the response
we just want one point (the starting point) to be fixed .

What are you trying to achieve exactly? As @Joseph_Oster there isnâ€™t a single solution to this problem. It is easy to see what this means by simply inputing different starting polygons to @DanielPiker algorithm.
If you are after an exact solution (i.e.: searching a specific polygon) you need to introduce more constraints such as internal angles between specific sides. Alternatively you may use internal diagonals. RoomSurveyor will allow you to do this .

1 Like

Thatâ€™s not a sufficient constraint on possible solutions. Having one edge fixed (two vertices) would narrow down the possibilities considerably.

actually we tested it by"base curve" to achieve â€śtarget curveâ€ť but the result â€śsolved curveâ€ť was totally diffrent of target one !

target_area_length_rev.gh (13.4 KB)

For 4 sides with specified lengths and area, I think there are generally 2 discrete possible solutions (one convex and one concave).
When there are more sides you can use the same definition and still get exact solutions, but there are likely to be continuous families of possible solutions. You can easily add more constraints though, such as angles or diagonals to limit it to a single one.
You need to decide though what are the properties you want the shape to have besides lengths and area.

1 Like

For example, by adding a grab component to your last definition you can explore the possible shapes while keeping the given lengths and area:

target_area_length_rev.gh (15.9 KB)
2 Likes

Yes, that is correct if self-similar transformations are not important. But it is important to note that as the number of sides increases the number of possible solutions increase exponentially (maybe the Catalan number). Also, using the area as a target may generate self-intersecting polygons as the @maryam has shown. Iâ€™m not sure what area calculation you are using for those cases but the algorithm converges and GH area component returns a smaller area.

2 Likes

As shown in the clip above, number of solutions is not even finite in general for shapes with more than 4 sides - there is a continuum of solutions, with degrees of freedom increasing with more sides.
And yes, if no additional constraints are included and the target area and lengths are wildly different from the initial geometry, clearly more information is needed about what kind of result the user actually wants, or they just use the grab tool to move within the constraint space to a shape they like.
Directly preventing self intersecting solutions I think should be easy enough to add if needed, but I think better here would be restricting or guiding within the solution space in a more sensible way from the start.

1 Like

agreed

I assume your easy enough solution involves kangaroo so Iâ€™m curious .

1 Like

This could be one way of preventing self intersection:
area_collision.gh (18.3 KB)

1 Like

Thanks! It comes with some meshedit component that I donâ€™t haveâ€¦but I guess I get the idea. You are trying to prevent the collisions of the lines using the Collider component.

1 Like

these are greatâ€¦thanks a lot