Terrain Processor: Line: Random

From Bohemia Interactive Community
Jump to navigation Jump to search

Task details

Task name : Line: Random

Dll plugin name : BITasksPlugin.dll

Geometry type : Polyline, PolylineM, PolylineZ

Heightmap : No


Description

Random placement of multiple objects on linear shapes specified in the given shapefile. Very easy, random positions only one condition - minimal distance from another objects.

Task parameters

  • RANDOM SEED - number used to initialize pseudorandom number generator.
  • MAXDISTANCE - maximal object distance from centreline.
  • DENSHA - The density of the filling in number of objects for hectare. For example 100 objects for hectare means an average distance of about 10 meters between objects.
  • Spline interpolation - Use bezier spline instead of original polyline.

Object prototype parameters

  • OBJECT - Object's prototype name
  • PROB - Object's probability
  • MINHEIGHT - Minimal size in %
  • MAXHEIGHT - Maximal size in %
  • MINDIST - Minimal distance in meters

Usage

Very simple algorithm, it places objects randomly on linear shape. Can be used for sparse positioning of trees along a line, or for creating random strings of bushes (e.g. in the forests).

Algorithm

For each shape (linear) do :

  1. instances_count = shape_length * LDENSITY
  2. For instances_count try to find position :
    1. Random parameter in range 0 ... shape_length
    2. Compute real coordinate for parameter
    3. Random distance from line in range 0 ... MAXDISTANCE
    4. Random angle
    5. newCoordinate = coordinate_on_line + angle * random_distance
    6. If newCoordinate is in collision with other instances, go to a.
    7. Insert newCoordinate with object prototype in output.