GeoGen Script reference
Contructors
Coordinate Class Reference

Coordinate in one-dimensional space. More...

Contructors

static Number FromNumber (Number number)
 Creates an absolute coordinate from a number. More...
 

Detailed Description

Coordinate in one-dimensional space.

Standard digital graphics coordinate system is used - horizontal coordinates go from left to right, vertical coordinates got from top to bottom.

A coordinate can be either absolute or relative:

Coordinates can be created using the [] operator from a Number, but that is not necessary, because a Number will be automatically converted to a absolute coordinate where appropriate.

Example:

HeightProfile.Slice(heightMap, Direction.Vertical, 500); // 500 is automatically converted to a absolute coordinate
HeightProfile.Slice(heightMap, Direction.Vertical, [500]); // This is effectively the same
HeightProfile.Gradient(500, 800, 1, 0); // Creates a gradient from coordinate 500 to 800

A relative coordinate can be created from an absolute coordinate or a Number using the @ operator:

// Assumes the map size is 2000x1000
HeightProfile.Slice(heightMap, Direction.Vertical, @0.5); // The 0.5 is automatically converted to an absolute coordinate, which is then turned into a relative coordinate, which is then evaluated by HeightMap.Slice into 500 (because it knows direction of the coordinate from its second argument).
HeightProfile.Slice(heightMap, Direction.Vertical, @[500]); // This works too
HeightProfile.Gradient(@0.5, @0.8, 1, 0); // This will trigger error, because the Gradient function doesn't have a direction specified.

Relative coordinates can be evaluated explicitly using Number.FromCoordinate.

Two coordinates can be combined into a Point.

Member Function Documentation

static Number Coordinate.FromNumber ( Number  number)
static

Creates an absolute coordinate from a number.

Parameters
numberThe number.
Returns
The coordinate.