CRdraw_polygon: Draws polygon.

View source: R/CRdraw_polygon.R

CRdraw_polygonR Documentation

Draws polygon.

Description

Draws polygon defined in polygon_list to rendering target. Polygon is defined in a polygon_list containing ordered vectors of vertices x and y.

Usage

CRdraw_polygon(graphics_list, polygon_list, status = NULL)

Arguments

graphics_list

List containing pointers to window, renderer etc. created with CRopen.

polygon_list

List defining a polygon, containing vector-elements x and y.

status

Optional list status with elements value and message to retrieve warnings and error messages.

Details

CRdraw_polygon internally uses same drawing method as CRdraw_lines. Polygon is automatically "closed" at the end: a line is implicitly added from last to first vertex.

Examples

    CRset_render_color(gs, list(r = 0, g = 0, b = 0))
    
    CRrender_clear(gs)
    
    CRset_render_color(gs, list(r = 100, g = 0, b = 0))
    
    poly <- list(x = c(100, 50, 70, 130, 150),
                 y = c(50, 80, 130, 130, 80))
    
    CRdraw_polygon(gs, poly)
    
    CRrender_present(gs)

lorweiuk/CREx documentation built on March 16, 2024, 3:04 a.m.