scatter operation

Syntax

  • scatter(domain, nPoints, distributionType) { operations }
  • scatter(domain, nPoints, gaussian, scatterMean, scatterStddev) { operations }

Parameters

  1. domainselector
    { surface | volume | scope }—Where to distribute the points. Note that volume only works if applied to a closed surface geometry; i.e. the mesh is not closed, the operation falls back to surface.
  2. nPointsfloat
    The number of points to distribute.
  3. distributionTypeselector
    { uniform | gaussian }—The random distribution type.
  4. scatterMeanselector
    { center | front | back | left | right | top | bottom }— The position in the scope to use as the mean for the gaussian normal distribution. Default value is center.
  5. scatterStddevfloat
    The standard deviation for the gaussian normal distribution. Note that this parameter can also be given in relative coordinates (leading to axis-specific standard deviations according to the dimensions of the scope). Default value is 0.16.
  6. operations
    A sequence of CGA operations to execute.

Description

The scatter operation places point shapes in or on the geometry of the current shape. The parameter nPoints determines how many point shapes are created. The first parameter domain chooses where to distribute the points. Two different random distributions can be used (uniform or gaussian; the optional parameter mean describes the center position of the point cluster relative to the current shape. It currently can be either center (default), front, back, left, right, top, or bottom. The optional parameter deviation describes the standard deviation.

Note that this parameter can also be given in relative coordinates (leading to axis-specific standard deviations according to the dimensions of the scope). Per default the value of deviation is set to '0.16.

The scatter operation does not affect the rotation of the children shapes except if the domain is set to surface. Then the children's scopes are oriented such that the y-direction corresponds to the surface normal.

Note:
  • The children shape's scope sizes are set to 0.
  • The children shape's geometry only contains one vertex, you probably want to insert a geometry using the i operation.

Examples

Point distribution on a surface

Uniform point distribution on a surface.

Init-->
   scatter(surface, 100, uniform) { Leaf }
   
Leaf-->
   primitiveCube()
   s(0.2,0.3,0.1)
   color("#ff0000")
Uniform point distribution on a surface

Gaussian normal point distribution on a surface.

Init-->
   scatter(surface, 100, gaussian) { Leaf }
   
Leaf-->
   primitiveCube()
   s(0.2,0.3,0.1)
   color("#ff0000")
Gaussian normal point distribution on a surface

Gaussian normal point distribution again; the mean of the distribution is moved to the scope's left side and a smaller standard deviation is used.

Init-->
   scatter(surface, 100, gaussian, left, '0.1) { Leaf }
   
Leaf-->
   primitiveCube()
   s(0.2,0.3,0.1)
   color("#ff0000")
Gaussian normal point distribution with scope moved left

In this topic