Polygons
[libstage API reference]


Data Structures

struct  stg_polygon_t

Functions

void stg_polygon_append_points (stg_polygon_t *poly, stg_point_t *pts, size_t count)
void stg_polygon_print (stg_polygon_t *poly)
void stg_polygon_set_points (stg_polygon_t *poly, stg_point_t *pts, size_t count)
stg_polygon_tstg_polygons_create (int count)
void stg_polygons_destroy (stg_polygon_t *p, size_t count)
stg_polygon_tstg_polygons_from_image_file (const char *filename, size_t *poly_count)
void stg_polygons_normalize (stg_polygon_t *polys, int num, double width, double height)
void stg_polygons_print (stg_polygon_t *polys, unsigned int count)
stg_polygon_tstg_unit_polygon_create (void)

Detailed Description

Creating and manipulating polygons

Function Documentation

void stg_polygon_append_points ( stg_polygon_t poly,
stg_point_t pts,
size_t  count 
)

Appends [count] points from [pts] into polygon [poly], allocating memory if mecessary.

Appends [count] points from [pts] to the point list of polygon [poly], allocating memory if mecessary.

References stg_polygon_t::points.

Referenced by stg_model_load().

void stg_polygon_print ( stg_polygon_t poly  ) 

print a human-readable description of a polygon on stdout

References stg_polygon_t::points, stg_point_t::x, and stg_point_t::y.

Referenced by stg_polygons_print().

void stg_polygon_set_points ( stg_polygon_t poly,
stg_point_t pts,
size_t  count 
)

Copies [count] points from [pts] into polygon [poly], allocating memory if mecessary. Any previous points in [poly] are overwritten.

References stg_polygon_t::points.

Referenced by gripper_generate_paddles(), stg_polygons_from_rotrects(), and stg_unit_polygon_create().

stg_polygon_t* stg_polygons_create ( int  count  ) 

return an array of [count] polygons. Caller must free() the space.

References FALSE, and TRUE.

Referenced by gripper_init(), indicator_copy_polygons(), stg_model_load(), stg_polygons_from_rotrects(), and stg_unit_polygon_create().

void stg_polygons_destroy ( stg_polygon_t p,
size_t  count 
)

destroy an array of [count] polygons

References TRUE.

Referenced by indicator_shutdown(), and stg_model_set_polygons().

stg_polygon_t* stg_polygons_from_image_file ( const char *  filename,
size_t *  poly_count 
)

Interpret a bitmap file as a set of polygons. Returns an array of polygons. On exit [poly_count] is the number of polygons found.

References PRINT_ERR1, stg_polygons_from_rotrects(), and stg_rotrects_from_image_file().

Referenced by stg_model_load().

void stg_polygons_normalize ( stg_polygon_t polys,
int  num,
double  width,
double  height 
)

scale the array of [num] polygons so that all its points fit exactly in a rectagle of pwidth] by [height] units

References BILLION, stg_polygon_t::points, stg_point_t::x, and stg_point_t::y.

Referenced by gripper_generate_paddles(), stg_model_set_geom(), and stg_model_set_polygons().

void stg_polygons_print ( stg_polygon_t polys,
unsigned int  count 
)

print a human-readable description of an array of polygons on stdout

References stg_polygon_print().

stg_polygon_t* stg_unit_polygon_create ( void   ) 


Generated on Wed Jun 3 23:12:29 2009 for Stage by  doxygen 1.5.9