shape

class guerilla.shape

Bases: object

The Lua to the internal Guerilla shape storage

getpolygoncount()

Return the number of polygons in the shape

Returns:the number of polygons in the shape
Return type:number
getpolygonvertex(polygon, vertex)

Return the index of the nth vertex in a polygon of the shape

Parameters:
  • polygon (number) – the 1-based index of the polygon
  • vertex (number) – the 1-based index of the vertex in the polygon
Returns:

the index of the vertex in the polygon, or None if the polygon or vertex is invalid

Return type:

number or None

getpolygonvertexcount(polygon)

Return the number of vertices in a polygon of the shape

Parameters:polygon (number) – the 1-based index of the polygon
Returns:the number of vertices in a polygon of the shape
Return type:number
getpolygonvertices(polygon)

Return the indices of the vertices in a polygon of the shape as a n-uple of integer numbers, as in LUAINLINE{local indices = { shape:getpolygonvertices (poly) }}

Parameters:polygon (number) – the 1-based index of the polygon
Returns:the indices of the vertices in the polygon, or None if the polygon is invalid
Return type:number,..
getvar(variable, polygon, vertex)

Return the data associated to a polygon vertex for a given variable, as a n-uple of floating point numbers.

This method reads the value of a shape variable, indexed by its polygon and vertex indices. polygon parameter is the index of the polygon (from 1 to shape:getpolygoncount()), and vertex is the index of the vertex in the polygon (from 1 to shape:getpolygonvertexcount (polygon)). Returned data are a n-uple of numbers, as in LUAINLINE{local x,y,z = shape:getvar (“P”,poly,vertex)}

Parameters:
  • variable (str) – the variable name, such as “P”, “N”, “st”…
  • polygon (number) – the 0-based index of the polygon to get data from
  • vertex (number) – the 0-based index of the vertex in the polygon to get data from
Returns:

the data associated to the vertex polygon in the requested variable, or None if no data are associated.

Return type:

number,..

getvariables()

Return the list of avaiable variables in the shape

Returns:the list of available variables
Return type:{string}