Constructor
new World(options)
Create a new World object given an Object with optional minX, maxX, minY, maxY, minZ, maxZ overriding class properties.
Name | Type | Description |
---|---|---|
options | World | | Object with overrides for class properties |
Methods
(static) defaultOptions(maxXopt, maxYopt, maxZopt)
Return a default options object, origin at center.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
maxX | number | <optional> | 16 | Integer max X value |
maxY | number | <optional> | maxX | Integer max Y value |
maxZ | number | <optional> | Math.max(maxX, maxY) | Integer max Z value |
WorldOptions
(static) defaultWorld(maxXopt, maxYopt, maxZopt) → {World}
Factory to create a default World instance.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
maxX | number | <optional> | 16 | Integer max X value |
maxY | number | <optional> | maxX | Integer max Y value |
maxZ | number | <optional> | Math.max(maxX, maxY) | Integer max Z value |
- Type:
- World
getOptions() → {Object}
Return the options (minX, maxX, ..) used to create this world.
A WorldOptions object
- Type:
- Object
randomPoint() → {Array}
Return a random 2D float point within the World
A random x,y float array
- Type:
- Array
random3DPoint() → {Array}
Return a random 3D point within the World
A random x,y,z float array
- Type:
- Array
randomPatchPoint() → {Array}
Return a random Patch 2D integer point
A random x,y integer array
- Type:
- Array
isOnWorld(x, y, zopt) → {boolean}
Given x,y,z values return true if within the world
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x | number | x value | ||
y | number | y value | ||
z | number | <optional> | this.centerZ | z value |
Whether or not on-world
- Type:
- boolean
bboxTransform(minX, minY, maxX, maxY) → {BBoxTransform}
Return an instance of a bounding box 2D transform. It linearly interpolates between the given minX, minY, maxX, maxY, and the world's values of the same properties.
The parameters are in the popular geojson order: west, south, east, north
Useful for Canvas (pixel) top-left transforms and geojson transforms.
Note minX etc NOT the world's but of the coord sys we want to use.
Name | Type | Description |
---|---|---|
minX | number | min bounding box x value |
minY | number | min bounding box y value |
maxX | number | max bounding box x value |
maxY | number | max bounding box y value |
Instance of the BBoxTransform
- Type:
- BBoxTransform