Functions | |
def | gl_get_biggest_pointset |
Returns the biggest pointset from a list of pointsets. More... | |
def | gl_get_connected_line |
Gets the line of connected cells through the given point in the given direction. More... | |
def | gl_get_connected_lines |
Returns a list of lines conected to a point, where each line is a list of points. More... | |
def | gl_grid_astar |
Returns the shortest path between the start and goal nodes in a grid. More... | |
def | gl_grid_connected |
Returns true if the points are "connected". More... | |
def | gl_grid_connected_set |
Find the set of points connected to the given point in the grid. More... | |
def | gl_find_node_with_lowest_score_index |
Private. More... | |
def | gl_reconstruct_path |
Private. More... | |
def | gl_reconstruct_path_impl |
Private. More... | |
def | gl_pointset_create |
Creates a new point set. More... | |
def | extra_documentation |
def | gl_instance_create |
Creates an instance of anobject at a given point. More... | |
def | gl_instance_get_position |
Returns the position of an instance as a vector. More... | |
def | gl_instance_set_position |
Sets the position of an instance to the ggiven vector coordinates. More... | |
def | gl_list_add_range |
Adds all the items of one list to another. More... | |
def | gl_list_delete_point |
Deletes the first occurance a point (vector) from a list of points. More... | |
def | gl_list_exists_point |
Returns true if the given point is an item in the list. More... | |
def | gl_list_random_item |
Returns a random item from a list. More... | |
def | gl_list_sample_random |
Returns a random sample from the given list. More... | |
def | gl_mouse_get_position |
Returns the current mouse position as a vector. More... | |
def | gl_random_int |
Returns a random integer between 0 (inclusive) and the given upper limit (exclusive). More... | |
def | gl_room_get_extent |
Gets the extent of the current room as a rectangle. More... | |
def | gl_sprite_get_size |
Returns the sprite of a sprite as a vector. More... | |
def | gl_diamond_distance |
Calculates the node-to-node (taxicab) distance between two diamond points (i.e. More... | |
def | gl_diamond_grid_create |
Creates a new diamond grid in a specified shape and size. More... | |
def | gl_diamond_grid2world |
Converts a grid point to world point using the given map. More... | |
def | gl_diamond_magnitude |
Gives the taxicab-magnitude of the given point, which is how many edges you would have to cross from the origin to the point (if you do not move diagonally). More... | |
def | gl_diamond_map_create |
Creates a new map that ccan be used with a diamond grid. More... | |
def | gl_diamond_world2grid |
Converts a world point to a diamond grid point. More... | |
def | gl_diamond_shape_create_parallelogram |
Creates a new parallelogram (shape) in diamond coordinates. More... | |
def | gl_diamond_shape_create_rectangle |
Creates a new rectangle (shape) in diamond coordinates. More... | |
def | gl_diamond_shape_create_circle |
Creates a new circle in diamond coordinates. More... | |
def | gl_flathex_distance |
Calculates the node-to-node distance between two flat hex points (i.e. More... | |
def | gl_flathex_grid_create |
Creates a new flat hex grid in a specified shape and size. More... | |
def | gl_flathex_grid2world |
Converts a grid point to world point using the given map. More... | |
def | gl_flathex_magnitude |
Gives the hex-magnitude of the given point, which is how many edges you would have to cross from the origin to the point. More... | |
def | gl_flathex_map_create |
Creates a new map that can be used for conversions between world points and flat hex grid points. More... | |
def | gl_flathex_world2grid |
Converts a world point to a flat hex grid point. More... | |
def | gl_flathex_shape_create_fatrectangle |
Creates a new fat rectangle (shape) in flat hex coordinates. More... | |
def | gl_flathex_shape_create_hexagon |
Creates a new hexagon(shape) in flat hex coordinates. More... | |
def | gl_flathex_shape_create_parallelogram |
Creates a new parallelogram (shape) in flat hex coordinates. More... | |
def | gl_flathex_shape_create_thinrectangle |
Creates a new thin rectangle (shape) in flat hex coordinates. More... | |
def | gl_get_color |
The parallelogram between (ux, 0) and (vx, vy) defines a grid coloring. More... | |
def | gl_grid_clone_structure |
This function returns a grid that is the same shape as the given grid, but without the same data. More... | |
def | gl_grid_connection_index |
Returns the connection_index of the cell in the grid at the given point. More... | |
def | gl_grid_contains |
Returns true if the grid contains the given point. More... | |
def | gl_grid_destroy |
Destroys the given grid. More... | |
def | gl_grid_fill |
Sets each cell in the grid to the given value. More... | |
def | gl_grid_get |
Returns the value in a grid at a given point. More... | |
def | gl_grid_get_iter |
Gets a new iterator for this grid. More... | |
def | gl_grid_get_neighbors |
Get the neighbors in the grid for the given point. More... | |
def | gl_grid_get_points |
Get all the points in this grid. More... | |
def | gl_grid_get_values |
Gets all the cells in this grid, that is, the contents of the grid at each point. More... | |
def | gl_grid_neighbors_connected |
Tests whether two points are connected, that is, have the same connection index. More... | |
def | gl_grid_random_point |
Returns a random point from a grid. More... | |
def | gl_grid_set |
Sets the grid contents at the given point. More... | |
def | gl_grid_where_color_equals |
Returns all points in a grid whose color (given the coloring parallelogram) matches the given color. More... | |
def | gl_init |
Initializes constants necessary to use Grids. More... | |
def | gl_iter_destroy |
Destroys the given iterator. More... | |
def | gl_iter_hasnext |
Returns true if the iterator has a valid next value. More... | |
def | gl_iter_next |
Returns the next item the iterator points to, and advances the iterator. More... | |
def | gl_map_align_grid_in_rect |
Transforma a map so that the grid is aligned in the rectangle given. More... | |
def | gl_map_calc_grid_extent |
Calculates the grids placement and size in world space. More... | |
def | gl_map_center_grid_in_rect |
This is a convenience method for adjusting a map so that it will center a grid in a rectangle. More... | |
def | gl_map_closest |
Returns the world point of the grid point closest to the given world point. More... | |
def | gl_map_destroy |
Destroys the given map. More... | |
def | gl_map_distance |
Gives the world distance between two grid points. More... | |
def | gl_map_flip_x |
Flips a map's world X-coordinate. More... | |
def | gl_map_flip_y |
Flips a map's world Y-coordinate. More... | |
def | gl_map_get_cell_dimensions |
Gets the cell dimensions of the given map. More... | |
def | gl_map_grid2rawworld |
Does the calculation for converting grid coordinates to world coordinates. More... | |
def | gl_map_grid2world |
Converts a grid point to a world point using the given map. More... | |
def | gl_map_magnitude |
Gives the world magnitude of a grid vector. More... | |
def | gl_map_rawdistance |
Calculates the "raw" world distance between two grid points. More... | |
def | gl_map_scale |
Scales the map. More... | |
def | gl_map_snap |
Returns the world point of the grid point of the given world_point. More... | |
def | gl_map_translate |
Translates a map. More... | |
def | gl_map_world2grid |
Converts a world point to a grid point using the given map. More... | |
def | gl_pointyhex_distance |
Calculates the node-to-node distance between two pointy hex points (i.e. More... | |
def | gl_pointyhex_grid_create |
Creates a new pointy hex grid in a specified shape and size. More... | |
def | gl_pointyhex_grid2world |
Converts a grid point to world point using the given map. More... | |
def | gl_pointyhex_magnitude |
Gives the hex-magnitude of the given point, which is how many edges you would have to cross from the origin to the point. More... | |
def | gl_pointyhex_map_create |
Creates a new map that can be used with a pointy hex grid. More... | |
def | gl_pointyhex_world2grid |
Converts a world point to a pointy hex grid point. More... | |
def | gl_pointyhex_shape_create_fatrectangle |
Creates a new fat rectangle (shape) in pointy hex coordinates. More... | |
def | gl_pointyhex_shape_create_hexagon |
Creates a new hexagon (shape) in pointy hex coordinates. More... | |
def | gl_pointyhex_shape_create_parallelogram |
Creates a new parallelogram (shape) in pointy hex coordinates. More... | |
def | gl_pointyhex_shape_create_thinrectangle |
Creates a new thin rectangle (shape) in pointy hex coordinates. More... | |
def | gl_iter_create |
Private. More... | |
def | gl_iter_move |
Private. More... | |
def | gl_rect_distance |
Calculates the node-to-node (taxicab) distance between two rect points (i.e. More... | |
def | gl_rect_grid_create |
Creates a new rect grid in a specified shape and size. More... | |
def | gl_rect_grid2world |
Converts a grid point to world point using the given map. More... | |
def | gl_rect_magnitude |
Gives the taxicab-magnitude of the given point, which is how many edges you would have to cross from the origin to the point (if you do not move diagonally). More... | |
def | gl_rect_map_create |
Creates a new map that can be used with a rect grid. More... | |
def | gl_rect_world2grid |
Converts a world point to a rect grid point. More... | |
def | gl_rect_shape_create_rectangle |
Creates a new rectangle in rect coordinates. More... | |
def | gl_rect_shape_create_parallelogram |
Creates a new parallelogram (shape) in rect coordinates. More... | |
def | gl_rect_shape_create_circle |
Creates a new circle in rect coordinates. More... | |
def | gl_halfplane_clone |
Clones the given halfplane. More... | |
def | gl_halfplane_contains |
Returns whether a point is contained in the given halfplane. More... | |
def | gl_halfplane_create |
Creates a new halfplane from the given point and pseudo-normal. More... | |
def | gl_halfplane_destroy |
Destroys the given halfplane. More... | |
def | gl_matrix3_create |
Creates a new matrix from the 9 given components. More... | |
def | gl_matrix3_create_flip_x |
Creates a new matrix that will flip the x coordinate of a vector if that vector is multiplied with the matrix. More... | |
def | gl_matrix3_create_flip_y |
Creates a new matrix that will flip the y coordinate of a vector if that vector is multiplied with the matrix. More... | |
def | gl_matrix3_create_scale |
Creates a new matrix that denotes a scale transform. More... | |
def | gl_matrix3_create_translation |
Creates a vector that represents a translation by the given amount. More... | |
def | gl_matrix3_identity |
Returns the identity matrix. More... | |
def | gl_matrix3_inverse |
Returns the inverse matrix of the given matrix (provided it has one). More... | |
def | gl_matrix3_mul |
Multiplies two matrices together and returns the result as a new matrix. More... | |
def | gl_polygon_clone |
Recursively clones this polygon. More... | |
def | gl_polygon_contains |
A "polygon" is a list of halfplanes. More... | |
def | gl_polygon_destroy |
Destroys the given polygon. More... | |
def | gl_rect_create |
Creates a new rectangle. More... | |
def | gl_rect_destroy |
Destroys the given rect. More... | |
def | gl_rect_get_dimensions |
Returns the dimensions of a rectangle as a vector. More... | |
def | gl_rect_get_endpoint |
This function returns the corner of the rectangle opposite to the corner used to construct the rectangle. More... | |
def | gl_rect_get_point |
Gets the corner of the rectangle used to construct the rectangle. More... | |
def | gl_shape_clone |
Recursively clones a shape. More... | |
def | gl_shape_contains |
Returns true if the given shape contains the given point. More... | |
def | gl_shape_destroy |
Destroys the given shape. More... | |
def | gl_shape_union |
Constructs a new shape that represents the union of the two shapes given. More... | |
def | gl_vector_add |
Adds two vectors together and returns the sum as a new vector. More... | |
def | gl_vector_create |
Creates a new vector from the given coordinates. More... | |
def | gl_vector_distance |
Calculates the Euclidean distance between two vectors, and returns the result. More... | |
def | gl_vector_dot |
Returns the dot product of two vectors. More... | |
def | gl_vector_equals |
Returns whether two vectors are equal, that is, if corresponding components are equal. More... | |
def | gl_vector_magnitude |
Returns the Euclidean magnitude of this vector. More... | |
def | gl_vector_mul |
Multiplies a vector with a real number and returns the result. More... | |
def | gl_vector_negate |
Negates each component of this vector, and returns it as a new vector. More... | |
def | gl_vector_sub |
Subtracts one vector from another, and returns the result as a new vector. More... | |
def | gl_vector_transform |
Multiplies a vector with a matrix, and returns the result as a new vector. More... | |
def | gl_vector2str |
Returns a string presentation of the given vector. More... | |
def | gl_shape_create_polygon |
Creates a new shape from a list of vertices of a convex polygon. More... | |
def | gl_vector_perp |
Returns the new vector (-y, x), which in rect coordinates is perpendicular to the give vector. More... | |
def grids.extra_documentation | ( | ) |
def grids.gl_diamond_distance | ( | p1, | |
p2 | |||
) |
Calculates the node-to-node (taxicab) distance between two diamond points (i.e.
how many edges you have to cross moving from one node to the other).
p1 | |
p2 |
def grids.gl_diamond_grid2world | ( | map, | |
point | |||
) |
Converts a grid point to world point using the given map.
map | The map to use for the conversion |
point | The point to convert |
def grids.gl_diamond_grid_create | ( | shape_label, | |
size1, | |||
size2 | |||
) |
Creates a new diamond grid in a specified shape and size.
shape_label | A string that represents the shape of the grid. The posibilities are "parallelogram", "rectangle". |
size1 | For most shapes, this denotes the width. |
size2 | For most figures, this denotes the height. |
def grids.gl_diamond_magnitude | ( | p | ) |
Gives the taxicab-magnitude of the given point, which is how many edges you would have to cross from the origin to the point (if you do not move diagonally).
point | The point whose magnitude to compute. |
def grids.gl_diamond_map_create | ( | cell_dimensions | ) |
Creates a new map that ccan be used with a diamond grid.
cell_dimensions | The dimensions (as a vector). |
def grids.gl_diamond_shape_create_circle | ( | radius | ) |
Creates a new circle in diamond coordinates.
(The circle has the shape of a diamond).
radius | The radius of the circle. |
def grids.gl_diamond_shape_create_parallelogram | ( | width, | |
height | |||
) |
Creates a new parallelogram (shape) in diamond coordinates.
width | The width of the parallelogram in grid coordinates |
height | The height of the parallelogram in grid coordinates. |
def grids.gl_diamond_shape_create_rectangle | ( | width, | |
height | |||
) |
Creates a new rectangle (shape) in diamond coordinates.
width | The width of the parallelogram in grid coordinates |
height | The height of the parallelogram in grid coordinates. |
def grids.gl_diamond_world2grid | ( | map, | |
v_raw | |||
) |
Converts a world point to a diamond grid point.
map | The map to use for the conversion. |
v_raw | The world point. |
def grids.gl_find_node_with_lowest_score_index | ( | list, | |
score_map | |||
) |
Private.
def grids.gl_flathex_distance | ( | p1, | |
p2 | |||
) |
Calculates the node-to-node distance between two flat hex points (i.e.
how many edges you have to cross moving from one node to the other).
p1 | |
p2 |
def grids.gl_flathex_grid2world | ( | map, | |
point | |||
) |
Converts a grid point to world point using the given map.
map | The map to use for the conversion |
point | The point to convert |
def grids.gl_flathex_grid_create | ( | shape_label, | |
size1, | |||
size2 | |||
) |
Creates a new flat hex grid in a specified shape and size.
shape_label | A string that represents the shape of the grid. The posibilities are "hexagon", "fatrectangle", "thinrectangle", and "parallelogram" |
size1 | For most shapes, this denotes the width. For the hexagon, it denotes the side length. |
size2 | For most figures, this denotes the height. For the hexagon, it is ignored. |
def grids.gl_flathex_magnitude | ( | p | ) |
Gives the hex-magnitude of the given point, which is how many edges you would have to cross from the origin to the point.
point | The point whose magnitude to compute. |
def grids.gl_flathex_map_create | ( | cell_dimensions | ) |
Creates a new map that can be used for conversions between world points and flat hex grid points.
cell_dimensions | The size of the cell as a vector. |
def grids.gl_flathex_shape_create_fatrectangle | ( | width, | |
height | |||
) |
Creates a new fat rectangle (shape) in flat hex coordinates.
width | The width of the rectangle in grid coordinates |
height | The height of the rectangle in grid coordinates. |
def grids.gl_flathex_shape_create_hexagon | ( | side | ) |
Creates a new hexagon(shape) in flat hex coordinates.
side | The length of the bexagon side grid coordinates |
def grids.gl_flathex_shape_create_parallelogram | ( | width, | |
height | |||
) |
Creates a new parallelogram (shape) in flat hex coordinates.
width | The width of the parallelogram in grid coordinates |
height | The height of the parallelogram in grid coordinates. |
def grids.gl_flathex_shape_create_thinrectangle | ( | width, | |
height | |||
) |
Creates a new thin rectangle (shape) in flat hex coordinates.
width | The width of the rectangle in grid coordinates |
height | The height of the rectangle in grid coordinates. |
def grids.gl_flathex_world2grid | ( | map, | |
v_raw | |||
) |
Converts a world point to a flat hex grid point.
map | The map to use for the conversion. |
v_raw | The world point. |
def grids.gl_get_biggest_pointset | ( | pointsets | ) |
Returns the biggest pointset from a list of pointsets.
list | A list of list of points. |
def grids.gl_get_color | ( | point, | |
ux, | |||
vx, | |||
vy | |||
) |
The parallelogram between (ux, 0) and (vx, vy) defines a grid coloring.
This function returns the color for the given point for the grid-coloring defined by the parallelogram between (ux, 0) and (vx, vy).
point | The point for which to calculate a color |
ux | The x-coordinate of one side of the parallelogram |
vx | The x-coordinate of other side of the parallelogram |
vy | The y-coordinate of other side of the parallelogram |
def grids.gl_get_connected_line | ( | grid, | |
point, | |||
dir | |||
) |
Gets the line of connected cells through the given point in the given direction.
def grids.gl_get_connected_lines | ( | grid, | |
grid_point | |||
) |
Returns a list of lines conected to a point, where each line is a list of points.
grid | The grid in which to check. |
grid_point | The point to check for. |
def grids.gl_grid_astar | ( | grid, | |
map, | |||
start, | |||
goal | |||
) |
Returns the shortest path between the start and goal nodes in a grid.
This function can only be called when the grid contains GM instances as cells. The cells in the grid must contain a boolean value accessible to indicate whether the cell is accesible or not.
grid | |
map | |
start | (vector) |
goal | (vector) |
def grids.gl_grid_clone_structure | ( | grid | ) |
This function returns a grid that is the same shape as the given grid, but without the same data.
grid | The grid to clone. |
def grids.gl_grid_connected | ( | grid, | |
point1, | |||
point2 | |||
) |
Returns true if the points are "connected".
A point p1 is connected to another point p2 if either p1 and p2 are neighbors, and the cells at those points have the same connection_index, or if p1 has a neighbor that is connected.
This function can only be called if the grid contains GM instances, and they have the variable connection_index defined.
grid | |
point1 | |
point2 |
def grids.gl_grid_connected_set | ( | grid, | |
point | |||
) |
Find the set of points connected to the given point in the grid.
def grids.gl_grid_connection_index | ( | ) |
Returns the connection_index of the cell in the grid at the given point.
You can only call this function on a grid if the contents are GM objects, with variable connection_index.
In connection algorithms, neighbors are connected if their connection indices are equal.
grid | |
point |
def grids.gl_grid_contains | ( | grid, | |
point | |||
) |
Returns true if the grid contains the given point.
grid | The grid to use for the check. |
point | The point to check. |
def grids.gl_grid_destroy | ( | grid | ) |
Destroys the given grid.
grid | The grid to destroy. |
def grids.gl_grid_fill | ( | grid, | |
value | |||
) |
Sets each cell in the grid to the given value.
This is a simple way to initialize grids, epsepcially if they don't contain GM objects.
grid | |
value |
def grids.gl_grid_get | ( | grid, | |
grid_point | |||
) |
Returns the value in a grid at a given point.
grid | |
grid_point |
def grids.gl_grid_get_iter | ( | ) |
def grids.gl_grid_get_neighbors | ( | ) |
Get the neighbors in the grid for the given point.
grid | |
point |
def grids.gl_grid_get_points | ( | grid | ) |
Get all the points in this grid.
grid |
def grids.gl_grid_get_values | ( | grid | ) |
Gets all the cells in this grid, that is, the contents of the grid at each point.
grid |
def grids.gl_grid_neighbors_connected | ( | grid, | |
point1, | |||
point2 | |||
) |
Tests whether two points are connected, that is, have the same connection index.
It is assumed the two points are neighbors.
grid | |
point1 | |
point2 |
def grids.gl_grid_random_point | ( | grid | ) |
Returns a random point from a grid.
grid | The grid from which to return a random point. |
def grids.gl_grid_set | ( | grid, | |
grid_point, | |||
value | |||
) |
Sets the grid contents at the given point.
grid | |
grid_point | |
value |
def grids.gl_grid_where_color_equals | ( | grid, | |
ux, | |||
vx, | |||
vy, | |||
color | |||
) |
Returns all points in a grid whose color (given the coloring parallelogram) matches the given color.
grid | The grid from which to select points |
ux | The x-coordinate of one side of the parallelogram |
vx | The x-coordinate of other side of the parallelogram |
vy | The y-coordinate of other side of the parallelogram |
color | The color index to match. |
def grids.gl_halfplane_clone | ( | halfplane | ) |
Clones the given halfplane.
halfplane |
def grids.gl_halfplane_contains | ( | halfplane, | |
point | |||
) |
Returns whether a point is contained in the given halfplane.
halfplane | |
point |
def grids.gl_halfplane_create | ( | point, | |
pseudo_normal | |||
) |
Creates a new halfplane from the given point and pseudo-normal.
point | A point on the border of the halfplane. |
pseudo_normal | If the half-plane border is (parallel to) the line a*x + b*y = 0, then the pseudo-normal is the vector (a, b) or (-a, -b). The two possibilites correspond to the two sides of the line. |
def grids.gl_halfplane_destroy | ( | halfplane | ) |
Destroys the given halfplane.
halfplane | The halfplaneto destroy. |
def grids.gl_init | ( | ) |
Initializes constants necessary to use Grids.
def grids.gl_instance_create | ( | position, | |
obj | |||
) |
Creates an instance of anobject at a given point.
position | (A vector in world-space). |
obj | the object to instantiate. |
def grids.gl_instance_get_position | ( | instance | ) |
Returns the position of an instance as a vector.
instance | The instance whose position to return. |
def grids.gl_instance_set_position | ( | instance, | |
world_point | |||
) |
Sets the position of an instance to the ggiven vector coordinates.
instance | The instance to move. |
world_point | The location to move the instance to (as a vector). |
def grids.gl_iter_create | ( | width, | |
height, | |||
bottom_left, | |||
shape | |||
) |
Private.
Creates a new iterator.
width | |
height | |
bottom_left | |
shape |
def grids.gl_iter_destroy | ( | iter | ) |
Destroys the given iterator.
iter | The iterator to destroy. |
def grids.gl_iter_hasnext | ( | iter | ) |
def grids.gl_iter_move | ( | iter | ) |
Private.
Advances the given iterator.
iter |
def grids.gl_iter_next | ( | iter | ) |
Returns the next item the iterator points to, and advances the iterator.
iter |
def grids.gl_list_add_range | ( | list1, | |
list2 | |||
) |
Adds all the items of one list to another.
list1 | The list to add the new items to. |
list2 | The list to get new items from. |
.1
def grids.gl_list_delete_point | ( | list, | |
point | |||
) |
Deletes the first occurance a point (vector) from a list of points.
gl_vectoor_equals is used for comparison. Generally, this should only be used for integer points.
list | A list of points. |
The | point (a vector) to remove from the list. |
def grids.gl_list_exists_point | ( | list, | |
point | |||
) |
Returns true if the given point is an item in the list.
Points are compared using gl_vector_equals.
list | |
point |
def grids.gl_list_random_item | ( | list | ) |
Returns a random item from a list.
list | The list from which to return a random instance. The list must be non-empty. |
def grids.gl_list_sample_random | ( | list, | |
count | |||
) |
Returns a random sample from the given list.
list | The list to sample. |
count | The number of samples to return. |
def grids.gl_map_align_grid_in_rect | ( | ) |
Transforma a map so that the grid is aligned in the rectangle given.
map | |
grid | |
window | |
alignment_type | One of the constants global_gl_alignment_*. |
def grids.gl_map_calc_grid_extent | ( | map, | |
grid | |||
) |
Calculates the grids placement and size in world space.
grid | |
map |
def grids.gl_map_center_grid_in_rect | ( | map, | |
grid, | |||
rect | |||
) |
This is a convenience method for adjusting a map so that it will center a grid in a rectangle.
map | The map to modify. |
grid | The grid that should be centered. |
rect | The rectangle in which the grid should be centered. |
def grids.gl_map_closest | ( | map, | |
world_point | |||
) |
Returns the world point of the grid point closest to the given world point.
Useful for snapping objects to the grid.
@param map The map to use. @param world_point The world point (as vector) to check. @returns The world point of the grid point that contains the given world point. @since 1.1
def grids.gl_map_destroy | ( | map | ) |
Destroys the given map.
map | The map to destroy. |
def grids.gl_map_distance | ( | map, | |
grid_point1, | |||
grid_point2 | |||
) |
Gives the world distance between two grid points.
map | The map to use for the calculation. The one grid point. The other grid point. |
def grids.gl_map_flip_x | ( | map | ) |
Flips a map's world X-coordinate.
map |
def grids.gl_map_flip_y | ( | map | ) |
Flips a map's world Y-coordinate.
map |
def grids.gl_map_get_cell_dimensions | ( | map | ) |
Gets the cell dimensions of the given map.
The dimensions are not transformed (scaled, for example) even if the map has been transformed (scaled).
map |
def grids.gl_map_grid2rawworld | ( | map, | |
point | |||
) |
Does the calculation for converting grid coordinates to world coordinates.
No map transforms are incorporated.
@note Generally, this method should not be used. Rather use one of the gl_*_map_grid2world functions. @param map The map to use for the conversion. @param point The point to convert. @returns The point converted to workd coordinates. @since 1.0
def grids.gl_map_grid2world | ( | map, | |
grid_point | |||
) |
Converts a grid point to a world point using the given map.
map | The map to use for the conversion. |
grid_point | The grid point (as vector) to convert. |
def grids.gl_map_magnitude | ( | map, | |
grid_point | |||
) |
Gives the world magnitude of a grid vector.
param map The map to use for the calculation. The grid point.
def grids.gl_map_rawdistance | ( | map, | |
v1, | |||
v2 | |||
) |
Calculates the "raw" world distance between two grid points.
Raw means if the map has been transformed (such as scaled) those transfomrations won't be taken into acocunt.
map | |
v1 | |
v2 |
def grids.gl_map_scale | ( | map, | |
scale | |||
) |
Scales the map.
Scaling the map (by value larger than 1) has the effect that cell centers are placed further apart.
map | |
scale | The amount to scale by (a non-zero number). |
def grids.gl_map_snap | ( | map, | |
world_point | |||
) |
Returns the world point of the grid point of the given world_point.
This can be used to snap positions to a grid:
map | The map to use for the point conversions |
world_point | The point to snap (as vector). |
def grids.gl_map_translate | ( | ) |
Translates a map.
This has the effect of moving all cells by the given amount.
map | |
offset | A vector |
def grids.gl_map_world2grid | ( | map, | |
world_point | |||
) |
Converts a world point to a grid point using the given map.
map | The map to use for the conversion. |
world_point | The world point (as vector) to convert. |
def grids.gl_matrix3_create | ( | matrix | ) |
Creates a new matrix from the 9 given components.
def grids.gl_matrix3_create_flip_x | ( | ) |
Creates a new matrix that will flip the x coordinate of a vector if that vector is multiplied with the matrix.
def grids.gl_matrix3_create_flip_y | ( | ) |
Creates a new matrix that will flip the y coordinate of a vector if that vector is multiplied with the matrix.
def grids.gl_matrix3_create_scale | ( | scale | ) |
Creates a new matrix that denotes a scale transform.
scale |
def grids.gl_matrix3_create_translation | ( | v | ) |
Creates a vector that represents a translation by the given amount.
v | The translation as a vector. |
def grids.gl_matrix3_identity | ( | ) |
Returns the identity matrix.
def grids.gl_matrix3_inverse | ( | ) |
Returns the inverse matrix of the given matrix (provided it has one).
m | The matrix for which to calculate the inverse for. |
def grids.gl_matrix3_mul | ( | m1, | |
m2 | |||
) |
Multiplies two matrices together and returns the result as a new matrix.
m1 | |
m2 |
def grids.gl_mouse_get_position | ( | ) |
Returns the current mouse position as a vector.
def grids.gl_pointset_create | ( | ) |
Creates a new point set.
def grids.gl_pointyhex_distance | ( | p1, | |
p2 | |||
) |
Calculates the node-to-node distance between two pointy hex points (i.e.
how many edges you have to cross moving from one node to the other).
p1 | |
p2 |
def grids.gl_pointyhex_grid2world | ( | map, | |
point | |||
) |
Converts a grid point to world point using the given map.
map | The map to use for the conversion |
point | The point to convert |
def grids.gl_pointyhex_grid_create | ( | shape_label, | |
size1, | |||
size2 | |||
) |
Creates a new pointy hex grid in a specified shape and size.
shape_label | A string that represents the shape of the grid. The posibilities are "hexagon", "fatrectangle", "thinrectangle", and "parallelogram" |
size1 | For most shapes, this denotes the width. For the hexagon, it denotes the side length. |
size2 | For most figures, this denotes the height. For the hexagon, it is ignored. |
def grids.gl_pointyhex_magnitude | ( | p | ) |
Gives the hex-magnitude of the given point, which is how many edges you would have to cross from the origin to the point.
point | The point whose magnitude to compute. |
def grids.gl_pointyhex_map_create | ( | cell_dimensions | ) |
Creates a new map that can be used with a pointy hex grid.
cell_dimensions | The dimensions (as a vector). |
def grids.gl_pointyhex_shape_create_fatrectangle | ( | width, | |
height | |||
) |
Creates a new fat rectangle (shape) in pointy hex coordinates.
width | The width of the rectangle in grid coordinates |
height | The height of the rectangle in grid coordinates. |
def grids.gl_pointyhex_shape_create_hexagon | ( | side | ) |
Creates a new hexagon (shape) in pointy hex coordinates.
side | The length of the bexagon side grid coordinates |
def grids.gl_pointyhex_shape_create_parallelogram | ( | width, | |
height | |||
) |
Creates a new parallelogram (shape) in pointy hex coordinates.
width | The width of the parallelogram in grid coordinates |
height | The height of the parallelogram in grid coordinates. |
def grids.gl_pointyhex_shape_create_thinrectangle | ( | width, | |
height | |||
) |
Creates a new thin rectangle (shape) in pointy hex coordinates.
width | The width of the rectangle in grid coordinates |
height | The height of the rectangle in grid coordinates. |
def grids.gl_pointyhex_world2grid | ( | map, | |
v_raw | |||
) |
Converts a world point to a pointy hex grid point.
map | The map to use for the conversion. |
v_raw | The world point. |
def grids.gl_polygon_clone | ( | polyogn | ) |
Recursively clones this polygon.
polygon |
def grids.gl_polygon_contains | ( | polygon, | |
point | |||
) |
A "polygon" is a list of halfplanes.
The polygon is interpreted as the intersection of the halfplanes, and is therefor always convex. A point is inside the polygon if it is inside all halfplanes in the list.
(Note that polygons by this definition need not be bounded).
polygon | A list of halfplanes |
point | The point to check |
def grids.gl_polygon_destroy | ( | polygon | ) |
Destroys the given polygon.
polygon | (A list of halfplanes). |
def grids.gl_random_int | ( | upper_limit | ) |
Returns a random integer between 0 (inclusive) and the given upper limit (exclusive).
upper_limit | The upper limit of the random integer to return. |
def grids.gl_reconstruct_path | ( | came_from_map, | |
current_node | |||
) |
Private.
def grids.gl_reconstruct_path_impl | ( | came_from_map, | |
current_node, | |||
path | |||
) |
Private.
def grids.gl_rect_create | ( | px, | |
py, | |||
width, | |||
height | |||
) |
Creates a new rectangle.
px | The x-coordinate of one corner of the rectangle. |
py | The y-coordinate of one corner of the rectangle. |
width | The width of the recctangle. |
height | The height of the rectangle. |
The rectangle (as a list of four numbers), an the order above.
def grids.gl_rect_destroy | ( | rect | ) |
Destroys the given rect.
def grids.gl_rect_distance | ( | p1, | |
p2 | |||
) |
Calculates the node-to-node (taxicab) distance between two rect points (i.e.
how many edges you have to cross moving from one node to the other).
p1 | |
p2 |
def grids.gl_rect_get_dimensions | ( | rect | ) |
Returns the dimensions of a rectangle as a vector.
rect |
def grids.gl_rect_get_endpoint | ( | rect | ) |
This function returns the corner of the rectangle opposite to the corner used to construct the rectangle.
rect |
def grids.gl_rect_get_point | ( | rect | ) |
Gets the corner of the rectangle used to construct the rectangle.
(The top left ocrner if the the dimensions are all positive and the coordinate axes are left-to-right and top-to-bottom.)
rect |
def grids.gl_rect_grid2world | ( | map, | |
point | |||
) |
Converts a grid point to world point using the given map.
map | The map to use for the conversion |
point | The point to convert |
def grids.gl_rect_grid_create | ( | shape_label, | |
size1, | |||
size2 | |||
) |
Creates a new rect grid in a specified shape and size.
shape_label | A string that represents the shape of the grid. The posibilities are "rectangle" |
size1 | For most shapes, this denotes the width. |
size2 | For most figures, this denotes the height. |
def grids.gl_rect_magnitude | ( | p | ) |
Gives the taxicab-magnitude of the given point, which is how many edges you would have to cross from the origin to the point (if you do not move diagonally).
point | The point whose magnitude to compute. |
def grids.gl_rect_map_create | ( | cell_dimensions | ) |
Creates a new map that can be used with a rect grid.
cell_dimensions | The dimensions (as a vector). |
def grids.gl_rect_shape_create_circle | ( | radius | ) |
Creates a new circle in rect coordinates.
(The circle has the shape of a square).
radius | The radius of the circle. |
def grids.gl_rect_shape_create_parallelogram | ( | width, | |
height | |||
) |
Creates a new parallelogram (shape) in rect coordinates.
width | The width of the parallelogram in grid coordinates |
height | The height of the parallelogram in grid coordinates. |
def grids.gl_rect_shape_create_rectangle | ( | width, | |
height | |||
) |
Creates a new rectangle in rect coordinates.
width | The width of the parallelogram in grid coordinates |
height | The height of the parallelogram in grid coordinates. |
def grids.gl_rect_world2grid | ( | map, | |
v_raw | |||
) |
Converts a world point to a rect grid point.
map | The map to use for the conversion. |
v_raw | The world point. |
def grids.gl_room_get_extent | ( | ) |
Gets the extent of the current room as a rectangle.
def grids.gl_shape_clone | ( | shape | ) |
Recursively clones a shape.
shape | The shape to clone. |
def grids.gl_shape_contains | ( | shape, | |
point | |||
) |
Returns true if the given shape contains the given point.
A shape is simply a list of polygons (
shape | A list of polygons. |
point |
def grids.gl_shape_create_polygon | ( | point_list | ) |
Creates a new shape from a list of vertices of a convex polygon.
point_list | A list of polygon vertices in anti-clockwise order. |
def grids.gl_shape_destroy | ( | shape | ) |
Destroys the given shape.
shape | The shape to destroy |
def grids.gl_shape_union | ( | shape1, | |
shape2 | |||
) |
Constructs a new shape that represents the union of the two shapes given.
shape1 | |
shape2 |
def grids.gl_sprite_get_size | ( | ) |
Returns the sprite of a sprite as a vector.
sprite | The sprite whose size to return. |
def grids.gl_vector2str | ( | v | ) |
Returns a string presentation of the given vector.
def grids.gl_vector_add | ( | v1, | |
v2 | |||
) |
Adds two vectors together and returns the sum as a new vector.
v1 | |
v2 |
def grids.gl_vector_create | ( | vx, | |
vy | |||
) |
Creates a new vector from the given coordinates.
vx | |
vy |
def grids.gl_vector_distance | ( | v1, | |
v2 | |||
) |
Calculates the Euclidean distance between two vectors, and returns the result.
v1 | |
v2 | |
returns | A real number representing the distance between the two vectors. |
def grids.gl_vector_dot | ( | v1, | |
v2 | |||
) |
Returns the dot product of two vectors.
v1 | |
v2 |
def grids.gl_vector_equals | ( | v1, | |
v2 | |||
) |
Returns whether two vectors are equal, that is, if corresponding components are equal.
This method is only reliable for integer vectors (grid points).
v1 | |
v2 |
def grids.gl_vector_magnitude | ( | v | ) |
Returns the Euclidean magnitude of this vector.
v |
def grids.gl_vector_mul | ( | v, | |
r | |||
) |
Multiplies a vector with a real number and returns the result.
v | |
r |
def grids.gl_vector_negate | ( | v | ) |
Negates each component of this vector, and returns it as a new vector.
If you add a vector and it's negated vector, the result is the zero vector.
v |
def grids.gl_vector_perp | ( | v | ) |
Returns the new vector (-y, x), which in rect coordinates is perpendicular to the give vector.
v | The vector whose perp vector to calculate. |
def grids.gl_vector_sub | ( | v1, | |
v2 | |||
) |
Subtracts one vector from another, and returns the result as a new vector.
v1 | |
v2 |
def grids.gl_vector_transform | ( | v, | |
m | |||
) |
Multiplies a vector with a matrix, and returns the result as a new vector.
v | |
m |