GeoGen Script reference
Classes | Global Functions
Standard library

Classes

class  Array
 Ordered map associating values to keys. More...
 
class  Boolean
 Either true or false boolean value. More...
 
class  Coordinate
 Coordinate in one-dimensional space. More...
 
class  HeightMap
 Two-dimensional height map. More...
 
class  HeightProfile
 One-dimensional height profile. More...
 
class  Number
 Double precision floating point number as specified by the IEEE 754 standard. More...
 
class  Point
 Point in two-dimensional space. More...
 
class  String
 Sequence of Unicode characters. More...
 

Global Functions

Array CreateNoiseLayers (Number minimumWaveLength, Number maximumWaveLength, Number persistence)
 Creates an array of noise layer configurations for HeightMap.Noise and HeightProfile.Noise. More...
 
Number Min (Number n1, Number n2,...)
 Returns the least of any number of numbers. More...
 
Number Max (Number n1, Number n2,...)
 Returns the greatest of any number of numbers. More...
 
Number Sin (Number x)
 Returns value of sine of x radians. More...
 
Number Cos (Number x)
 Returns value of cosine of x radians. More...
 
Number Tan (Number x)
 Returns value of tangent of x radians. More...
 
Number Asin (Number x)
 Returns value of arc sine of x. More...
 
Number Acos (Number x)
 Returns value of arc cosine of x. More...
 
Number Atan (Number x)
 Returns value of arc tangent of x. More...
 
Number Atan2 (Number x, Number y)
 Returns value of arc tangent of y/x. More...
 
Number DegToRad (Number x)
 Converts angle of x degrees to radians. More...
 
Number RadToDeg (Number x)
 Converts angle of x radians to degrees. More...
 
Number Log (Number x, Number base)
 Returns the value of logarithm of x in base. More...
 
Number Pow (Number x, Number power)
 Returns the value of x raised to power. More...
 
Number Sqrt (Number x)
 Returns the value of square root of x. More...
 
Number Ceil (Number x)
 Returns the smallest integral number greater than x. More...
 
Number Floor (Number x)
 Returns the smallest integral number lesser than x. More...
 
Number Round (Number x)
 Returns the integer closest to x. More...
 
Number Abs (Number x)
 Returns the absolute value of x. More...
 
 Print (String message, Object arg1, Object arg2,...)
 Sends a text message to the API. More...
 
 TriggerError (String message, Object arg1, Object arg2,...)
 Terminates execution of the script with a text message. More...
 
Number Random (Number min, Number max)
 Returns a random number from specified range. More...
 

Detailed Description

Function Documentation

Number Abs ( Number  x)

Returns the absolute value of x.

var a = Abs(-13); // a will be 13
Parameters
xThe x.
Returns
Absolute value of x.
Number Acos ( Number  x)

Returns value of arc cosine of x.

var a = RadToDeg(Acos(1)); // a will be 0
Parameters
xThe angle in radians. Must be greater than -1 and less than 1.
Returns
Arc cosine of x, expressed in radians
Number Asin ( Number  x)

Returns value of arc sine of x.

var a = RadToDeg(Asin(1)); // a will be 90
Parameters
xThe angle in radians. Must be greater than -1 and less than 1.
Returns
Arc sine of x, expressed in radians.
Number Atan ( Number  x)

Returns value of arc tangent of x.

var a = RadToDeg(Atan(1)); // a will be 45
Parameters
xThe angle in radians.
Returns
Arc tangent of x, expressed in radians
Number Atan2 ( Number  x,
Number  y 
)

Returns value of arc tangent of y/x.

To compute the value, the function takes into account the sign of both arguments in order to determine the quadrant (unlike Atan). At least x or y must be non-zero.

var a = RadToDeg(Atan2(1, 2)); // a will be ~26.57
Parameters
yProportion of the y coordinate.
xProportion of the x coordinate.
Returns
Principal arc tangent of y/x, expressed in radians.
Number Ceil ( Number  x)

Returns the smallest integral number greater than x.

var a = Ceil(5.2); // a will be 6
Parameters
xThe x.
Returns
x rounded up.
Number Cos ( Number  x)

Returns value of cosine of x radians.

var a = Cos(0); // a will be 1
Parameters
xThe angle in radians.
Returns
Cosine of x.
Examples:
conflux.ggs, and ouroboros.ggs.
Array CreateNoiseLayers ( Number  minimumWaveLength,
Number  maximumWaveLength,
Number  persistence 
)

Creates an array of noise layer configurations for HeightMap.Noise and HeightProfile.Noise.

The default version called without any arguments creates the same noise as HeightMap.Noise/HeightProfile.Noise called without any arguments:

yield HeightMap.Noise(CreateNoiseLayers(), 2); // This is useful if you want to provide a custom seed

.

std_createnoiselayers_default.png

When called with a single argument, that parameter is used as maximumWaveLength, with minimumWaveLength of 1 and persistence of 0.5.

yield HeightMap.Noise(CreateNoiseLayers(64), 2); // This is useful if you want to provide a custom seed

.

std_createnoiselayers_64.png

Calling the function with 2 arguments still uses the persistence of 0.5.

yield HeightMap.Noise(CreateNoiseLayers(32, 256), 2);

.

std_createnoiselayers_32_256.png

The third parameter specifies persistence, determining how chaotic the resulting noise will be.

yield HeightMap.Noise(CreateNoiseLayers(1, 512, 0.2), 2);

.

std_createnoiselayers_1_512_20.png
Parameters
minimumWaveLength(Optional) The minimum wave length. Used as maximumWaveLength if it is not specified. Default value is 1.
maximumWaveLength(Optional) The maximum wave length. If neither minimumWaveLength and maximumWaveLength is specified, 256 is used.
persistence(Optional) The persistence. 0.5 is used if not specified. Must be greater than or equal to 0.1 and less than or equal to 0.9. Lower persistence produces more noisy and chaotic results.
Returns
The noise layer array.
Examples:
marshlands.ggs, ouroboros.ggs, and tepui.ggs.
Number DegToRad ( Number  x)

Converts angle of x degrees to radians.

var a = Sin(DegToRad(30)); // a will be 0.5
Parameters
xThe angle in degrees.
Returns
x converted to radians.
Examples:
conflux.ggs, and ouroboros.ggs.
Number Floor ( Number  x)

Returns the smallest integral number lesser than x.

var a = Floor(5.2); // a will be 5
Parameters
xThe x.
Returns
x rounded down.
Number Log ( Number  x,
Number  base 
)

Returns the value of logarithm of x in base.

var a = Log(100, 10); // a will be 2
Parameters
xThe x. Must be greater than zero.
baseThe base. Must be greater than zero.
Returns
Logarithm of x in base.
Number Max ( Number  n1,
Number  n2,
  ... 
)

Returns the greatest of any number of numbers.

var a = Max(5, 6.16, -1.35, 69, 0.0036); // a will be 69
Parameters
n1The first number.
n2The second number.
Returns
The maximum number.
Examples:
conflux.ggs, and ouroboros.ggs.
Number Min ( Number  n1,
Number  n2,
  ... 
)

Returns the least of any number of numbers.

var a = Min(5, 6.16, -1.35, 69, 0.0036); // a will be -1.35
Parameters
n1The first number.
n2The second number.
Returns
The minimum number.
Examples:
conflux.ggs, and ouroboros.ggs.
Number Pow ( Number  x,
Number  power 
)

Returns the value of x raised to power.

var a = Pow(2, 3); // a will be 8
Parameters
xThe x.
powerThe power.
Returns
x raised to base.
Print ( String  message,
Object  arg1,
Object  arg2,
  ... 
)

Sends a text message to the API.

If any arguments are provided, any formatting marks in message will be replaced with appropriate string representation of corresponding argument.

Print("The temperature is {0} of {1}.", 35, "Celsius"); // Will print "The temperature is 35 of Celsius."
Parameters
messageThe message.
arg1(Optional) The first argument.
arg2(Optional) The second argument.
Number RadToDeg ( Number  x)

Converts angle of x radians to degrees.

var a = RadToDeg(Asin(1)); // a will be 90
Parameters
xThe angle in radians.
Returns
x converted to degrees.
Number Random ( Number  min,
Number  max 
)

Returns a random number from specified range.

var a = Random(0, 10); // a will be eg. ~5.6841
a = Random(0, 10); // a will be ~0.6978
a = Random(0, 10); // a will be ~8.1993
a = Random(0, 10); // a will be ~3.1698
Parameters
min(Optional) The lower bound of the range, inclusive. If not specified, 0 is used.
max(Optional) The higher bound of the range, inclusive. If not specified, 1 is used. If min is specified, this must be specified too. Must be greater than min.
Returns
Random number.
Examples:
conflux.ggs.
Number Round ( Number  x)

Returns the integer closest to x.

0.5 is rounded up.

var a = Ceil(5.2); // a will be 5
Parameters
xThe x.
Returns
x rounded to nearest integer.
Number Sin ( Number  x)

Returns value of sine of x radians.

var a = Sin(DegToRad(30)); // a will be 0.5
Parameters
xThe angle in radians.
Returns
Sine of x.
Examples:
conflux.ggs, and ouroboros.ggs.
Number Sqrt ( Number  x)

Returns the value of square root of x.

var a = Sqrt(100); // a will be 10
Parameters
xThe x. Must be greater than zero.
Returns
Square root of x.
Number Tan ( Number  x)

Returns value of tangent of x radians.

var a = Tan(DegToRad(45)); // a will be 1
Parameters
xThe angle in radians.
Returns
Tangent of x.
TriggerError ( String  message,
Object  arg1,
Object  arg2,
  ... 
)

Terminates execution of the script with a text message.

If any arguments are provided, any formatting marks in message will be replaced with appropriate string representation of corresponding argument.

TriggerError("The number of islands must be an even number, was {0}.", Parameters.NumberOfIslands); // Will trigger error GGE5000 "The number of islands must be an even number, was 5."
Parameters
messageThe message.
arg1(Optional) The first argument.
arg2(Optional) The second argument.