Maxima Function
make_polygon (nlist)
Returns a polygon
object from boundary indices. Argument
nlist is a list of components of boundaries_array
.
Example:
Bhutan is defined by boundary numbers 171, 173
and 1143, so that make_polygon([171,173,1143])
appends arrays of coordinates boundaries_array[171]
,
boundaries_array[173]
and boundaries_array[1143]
and
returns a polygon
object suited to be plotted by
draw
. To avoid an error message, arrays must be
compatible in the sense that any two consecutive
arrays have two coordinates in the extremes in common. In this
example, the two first components of boundaries_array[171]
are
equal to the last two coordinates of boundaries_array[173]
, and
the two first of boundaries_array[173]
are equal to the two first
of boundaries_array[1143]
; in conclussion, boundary numbers
171, 173 and 1143 (in this order) are compatible and the colored
polygon can be drawn.
(%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) Bhutan; (%o3) [[171, 173, 1143]] (%i4) boundaries_array[171]; (%o4) {Array: #(88.750549 27.14727 88.806351 27.25305 88.901367 27.282221 88.917877 27.321039)} (%i5) boundaries_array[173]; (%o5) {Array: #(91.659554 27.76511 91.6008 27.66666 91.598022 27.62499 91.631348 27.536381 91.765533 27.45694 91.775253 27.4161 92.007751 27.471939 92.11441 27.28583 92.015259 27.168051 92.015533 27.08083 92.083313 27.02277 92.112183 26.920271 92.069977 26.86194 91.997192 26.85194 91.915253 26.893881 91.916924 26.85416 91.8358 26.863331 91.712479 26.799999 91.542191 26.80444 91.492188 26.87472 91.418854 26.873329 91.371353 26.800831 91.307457 26.778049 90.682457 26.77417 90.392197 26.903601 90.344131 26.894159 90.143044 26.75333 89.98996 26.73583 89.841919 26.70138 89.618301 26.72694 89.636093 26.771111 89.360786 26.859989 89.22081 26.81472 89.110237 26.829161 88.921631 26.98777 88.873016 26.95499 88.867737 27.080549 88.843307 27.108601 88.750549 27.14727)} (%i6) boundaries_array[1143]; (%o6) {Array: #(91.659554 27.76511 91.666924 27.88888 91.65831 27.94805 91.338028 28.05249 91.314972 28.096661 91.108856 27.971109 91.015808 27.97777 90.896927 28.05055 90.382462 28.07972 90.396088 28.23555 90.366074 28.257771 89.996353 28.32333 89.83165 28.24888 89.58609 28.139999 89.35997 27.87166 89.225517 27.795 89.125793 27.56749 88.971077 27.47361 88.917877 27.321039)} (%i7) Bhutan_polygon: make_polygon([171,173,1143])$ (%i8) draw2d(Bhutan_polygon)$