List of all members.
Public Member Functions |
| GGen_Data_1D (GGen_Size length, GGen_Height value) |
void | Abs () |
void | Add (GGen_Height value) |
void | AddArray (GGen_Data_1D *addend) |
void | AddArrayMasked (GGen_Data_1D *addend, GGen_Data_1D *mask, bool relative) |
void | AddMasked (GGen_Height value, GGen_Data_1D *mask, bool relative) |
void | AddTo (GGen_Data_1D *addend, GGen_CoordOffset offset) |
void | Clamp (GGen_Height min, GGen_Height max) |
GGen_Data_1D * | Clone () |
void | Fill (GGen_Height value) |
void | Flip () |
void | Flood (double land_amount) |
GGen_Size | GetLength () |
GGen_Height | GetValue (GGen_Coord x) |
GGen_Height | GetValueInterpolated (GGen_Coord x, GGen_Size scale_to_length) |
void | Gradient (GGen_Coord from, GGen_Coord to, GGen_Height from_value, GGen_Height to_value, bool fill_outside) |
void | Intersection (GGen_Data_1D *victim) |
void | Invert () |
GGen_Height | Max () |
GGen_Height | Min () |
void | Monochrome (GGen_Height threshold) |
void | Multiply (double factor) |
void | MultiplyArray (GGen_Data_1D *factor) |
void | Noise (GGen_Size min_feature_size, GGen_Size max_feature_size, GGen_Amplitudes *amplitudes) |
void | Normalize (GGen_Normalization_Mode mode) |
void | ResizeCanvas (GGen_Size new_length, GGen_CoordOffset new_zero) |
void | Scale (double ratio, bool scale_values) |
void | ScaleTo (GGen_Size new_length, bool scale_values) |
void | ScaleValuesTo (GGen_Height new_min, GGen_Height new_max) |
void | SetValue (GGen_Coord x, GGen_Height value) |
void | SetValueInRange (GGen_Coord from, GGen_Coord to, GGen_Height value) |
void | Shift (GGen_CoordOffset offset, GGen_Overflow_Mode overflow_mode) |
void | SlopeMap () |
void | Smooth (GGen_Distance radius) |
GGen_Path * | ToPath (uint16 point_count) |
void | Union (GGen_Data_1D *victim) |
Detailed Description
GGen_Data_1D represents a simple 1D array of values. It can be used to create more complex 2D maps using methods like GGen_Data_2D::Project, GGen_Data_2D::Gradient or GGen_Data_2D::TransformValues.
Constructor & Destructor Documentation
Creates new GGen_Data_1D object of given length.
- Parameters:
-
length | Length of the array. |
value | Default value for all cells. |
Member Function Documentation
void GGen_Data_1D::Abs |
( |
| ) |
|
Replaces each value with its absolute value (removes all negative signs).
Adds an integer to all values in the array.
- Parameters:
-
value | Value to be added to values in the array. |
Adds another array to the current array.
- Parameters:
-
addend | Array to be added. This array will be scaled to match the original array. |
Adds another array to the current array. The percentage of each value from the addend will depend on corresponding value from the mask.
- Parameters:
-
addend | Array to be added. This array will be scaled to match the original array. |
mask | Array used to mask the added value. |
relative | Toggles relative mode. |
- Note:
- 0 in the mask always means the original value won't be changed. In relative mode, maximum value found in the mask then means 100%, otherwise 32767 means 100%.
Adds a percentage of an integer to all values in the array. The percentage added will depend on corresponding value from the mask.
- Parameters:
-
value | Value to be added to values in the array. |
mask | Array used to mask the added value. This array will be scaled to match the current array. |
relative | Toggles relative mode. |
- Note:
- 0 in the mask always means the original value won't be changed. In relative mode, maximum value found in the mask then means 100%, otherwise 32767 means 100%.
Adds another array to the current array. Its coordinates will be shifted by an offset.
- Parameters:
-
addend | Array to be added. This array will NOT be scaled to match the original array. |
offset | Coordinates of the addend will be shifted by this value. |
Clamps all values to range.
- Parameters:
-
min | New minimum value. |
max | New maximum value. |
- Note:
- All values outside the given range will be set either to min or max, whichever is closer.
Creates a 1:1 copy of the current object.
- Returns:
- Copy of the object.
Sets all values in the array.
- Parameters:
-
void GGen_Data_1D::Flip |
( |
| ) |
|
Flips order of values in the array, so the first value is the last.
void GGen_Data_1D::Flood |
( |
double |
land_amount | ) |
|
Changes the values so given percentage of values is higher than 0.
- Parameters:
-
land_amount | The percentage of values to be higher than 0. 0 means no "land", 1.0 means no "water". |
Returns length of the array.
- Returns:
- Length of the array.
Returns one value from the array.
- Parameters:
-
- Returns:
- Value in the tile.
Return one value from the array interpolated to a different array length.
- Parameters:
-
x | Tile coordinate (in the interpolated array). |
scale_to_length | Interpolated array length. |
- Returns:
- Interpolated value in the tile.
- Note:
- If the interpolated size is larger than the original, interpolated values will be calculated using the linear interpolation algorithm. Otherwise, interpolated values will be chosen using the nearest neighbor algorithm.
Creates a smooth gradient between two coords. The values will make transition between two values.
- Parameters:
-
from | The left bound coordinate. |
to | The right bound coordinate. |
from_value | The left transition base. |
to_value | The right transition base. |
fill_outside | Should the values outside gradient interval be filled as well? |
- Note:
- If fill_flat is set to true, values with coord lower than left bound will be filled with from_value< and value with coord higher than the right bound will be filled with to_value.
Performs a set intersection of the array graphs (higher of two respective values is applied).
- Parameters:
-
victim | The intersection array. This array will be scaled to match the original array. |
void GGen_Data_1D::Invert |
( |
| ) |
|
Flips sign of all values in the array.
Returns the maximum of all values in the array.
- Returns:
- The maximum.
Returns the minimum of all values in the array.
- Returns:
- The minimum.
Replaces each value with 0 if it is less than equal than the threshold or 1 otherwise.
- Parameters:
-
threshold | Values above threshold will be 1, otherwise 0. |
void GGen_Data_1D::Multiply |
( |
double |
factor | ) |
|
Multiplies each value in the array by a real number.
- Parameters:
-
factor | Real number to multiply all values in the array. |
Multiplies each value in the array by a corresponding value from factor.
- Parameters:
-
factor | Array to be multiplied by. This array will be scaled to match the original array. |
Makes sure that there are no slopes steeper than 45° in the array. Steeper slopes will be dealt with according to mode.
- Parameters:
-
mode | The normalization mode (see GGen_Normalization_Mode). |
Crops or expands the array without changing its values.
- Parameters:
-
new_length | New array length. |
new_zero | Coordinate of new origin relative to the original zero. |
- Note:
- All values outside new length will be discarded. Newly created values will be set to 0.
void GGen_Data_1D::Scale |
( |
double |
ratio, |
|
|
bool |
scale_values |
|
) |
| |
Scales length of the array by a real number.
- Parameters:
-
ratio | Scaling ratio (0.5 = 50%, 2.0 = 200%). |
scale_values | Multiply the values by the ratio as well? |
- Note:
- If the new size is larger than the original, the new values will be calculated using the linear interpolation algorithm. Otherwise, the new values will be chosen using the nearest neighbor algorithm.
void GGen_Data_1D::ScaleTo |
( |
GGen_Size |
new_length, |
|
|
bool |
scale_values |
|
) |
| |
Scales length of the array to new length.
- Parameters:
-
new_length | Target array length. |
scale_values | Scale the valuess correspondingly as well? |
- Note:
- If the new size is larger than the original, the new values will be calculated using the linear interpolation algorithm. Otherwise, the new values will be chosen using the nearest neighbor algorithm.
Scales values in the array to fit a new value range.
- Parameters:
-
new_min | New minimum value. |
new_max | New maximum value. |
Sets value in one tile.
- Parameters:
-
x | Coordinate to set. |
value | Value to use. |
Sets value in all tiles in range (bounds are included).
- Parameters:
-
from | Starting point. |
to | Ending point. |
value | Value to use. |
Shifts all values by a distance.
- Parameters:
-
offset | Coordinate of new origin relative to the original zero. |
overflow_mode | Overflow mode (see GGen_Overflow_Mode). |
- Note:
- All values outside the array will be discarded. Newly created values will be set to 0.
void GGen_Data_1D::SlopeMap |
( |
| ) |
|
Replaces values in the array with information about steepness of slope (change in value) in that particular value.
Smooths differences between values in the array. Uses linear smoothing algorithm.
- Parameters:
-
radius | Smoothing kernel radius. |
GGen_Path * GGen_Data_1D::ToPath |
( |
uint16 |
point_count | ) |
|
Creates a GGen_Path object from current object.
- Parameters:
-
point_count | Number of points in the newly created path object. |
- Note:
- Point's coordinates are calculated as [value index, value].
Performs a set union of the array graphs (higher of two respective values is applied).
- Parameters:
-
victim | The union array. This array will be scaled to match the original array. |
The documentation for this class was generated from the following files: