Object placement

We would like to place benches and street lights along the paths. Even if paths are curved they are represented by polylines (linestring type of boost::geometry).

The idea is together with the previous post (region partitioning) to generate a simple park similar to a one of SimCity’s Large Parks.

SimCity_2014-08-09_20-03-17

In this simple example two paths (that connect the opposite edges) intersect somewhere close to the centre. To facilitate object placement we:

  1.  Split each of the polylines in two at the intersection point.
  2. Parametrise the polyline by length, add the start buffer and end buffer to the ends resulting in the segment in the middle.
  3. That segment we split into (i-1) times, where i is number of objects we want to place.
    • a single object is simply placed in the middle of the segment
  4. Compute tangent (because the path can be curve, even if represented with a polyline), and when placing objects they are rotated by arctan of the resulting value.

Below we show the result where the placed objects are arrows.

object-placement-arrows