<p>It is possible to generate geometry from constraints. However, some of your constraints are hard to formulate as continuous functions that can be minimized or maximized. Also the ones that can be  formulated this way have a staggering number of dimensions making gradient descents quite costly.</p>

<p>This means, you can not use a gradient descent method to find the solution. In turn this makes the problem computationally harder to do as the only way to do so is by trying a number of solutions. </p>

<p>So you would need to take some points by initial condition then solve for the constraints that can be made continuous. And then reevaluate if no solution is found. So some genetic algorithm should work fine, although it would be very inefficient.</p>

<p>But more likely your looking for some sort of clustering solutions. But if i were to do this with this vague instructions (which would surely fail) i would start by building a voronoi diagram, as it would help me find the connectivity. </p>

CC BY-SA 3.0
2017-07-16T22:52:41.590Z
2017-07-17T19:57:09.087Z
2017-07-17T19:57:09.087Z
joojaa
<p>I have a bounding box of 1000m x 1000m. I randomly generate 10000 points (sites) inside it. Now, how can I create 'n' polygons (geometries) within the bounding box based on a given constrain. </p>

<p>The constrain could be anything. For example:</p>

<ol>
<li>number of sites inside each polygon are same for all polygons</li>
<li>sum of distances from points inside the geometry to the centroid of geometry are same for all polygons</li>
<li>let's say, I assign a weight to each site then constrain i sum of weights inside each polygon are same for all polygons </li>
<li>area of each polygon is same</li>
<li>etc.</li>
</ol>

<p>Is there a way to generate such a geometry?</p>

<p>P.S. -- would be great if someone can also point me in the right direction and then give down vote.  </p>

CC BY-SA 3.0
2017-07-15T12:27:07.363Z
Yes, but the best way depends on what the particular constraint is, so you need to be more specific. What's the actual problem you're trying to solve?
Dan Hulme
CC BY-SA 3.0
2017-07-15T12:47:52.530Z
Thanks @DanHulme, let's say, I would like to have it for first constrain. I am a novice in this area so probably, not even sure if I am looking in the right direction.
novice
CC BY-SA 3.0
2017-07-16T16:12:35.407Z
If you edit the question to show just a single question, it will be better received and it will be easier for people to write good answers. You can then post the other points as separate questions later.
trichoplax is on Codidact now
<geometry><polygon>
constrain based dynamic geometry generation
novice
# constrain based dynamic geometry generation

(Asked by: username_0 on 2017-07-15)

I have a bounding box of 1000m x 1000m. I randomly generate 10000 points (sites) inside it. Now, how can I create 'n' polygons (geometries) within the bounding box based on a given constrain.

The constrain could be anything. For example:

1. number of sites inside each polygon are same for all polygons
2. sum of distances from points inside the geometry to the centroid of geometry are same for all polygons
3. let's say, I assign a weight to each site then constrain i sum of weights inside each polygon are same for all polygons
4. area of each polygon is same
5. etc.

Is there a way to generate such a geometry?

P.S. -- would be great if someone can also point me in the right direction and then give down vote.

**Tags:** geometry, polygon

> **Comments:**
> **username_1**: Yes, but the best way depends on what the particular constraint is, so you need to be more specific. What's the actual problem you're trying to solve?  
> **username_0**: Thanks @username_1, let's say, I would like to have it for first constrain. I am a username_0 in this area so probably, not even sure if I am looking in the right direction.  
> **username_2**: If you edit the question to show just a single question, it will be better received and it will be easier for people to write good answers. You can then post the other points as separate questions later.  

---

## 1 answers

### Answer by username_3 on 2017-07-16. Score: 3

It is possible to generate geometry from constraints. However, some of your constraints are hard to formulate as continuous functions that can be minimized or maximized. Also the ones that can be formulated this way have a staggering number of dimensions making gradient descents quite costly.

This means, you can not use a gradient descent method to find the solution. In turn this makes the problem computationally harder to do as the only way to do so is by trying a number of solutions.

So you would need to take some points by initial condition then solve for the constraints that can be made continuous. And then reevaluate if no solution is found. So some genetic algorithm should work fine, although it would be very inefficient.

But more likely your looking for some sort of clustering solutions. But if i were to do this with this vague instructions (which would surely fail) i would start by building a voronoi diagram, as it would help me find the connectivity.


---

