This file is indexed.

/usr/include/spatialite/gg_core.h is in libspatialite-dev 4.1.1-10.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
/*
 gg_core.h -- Gaia common support for geometries: core functions
  
 version 4.1, 2013 May 8

 Author: Sandro Furieri a.furieri@lqt.it

 ------------------------------------------------------------------------------
 
 Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
 The contents of this file are subject to the Mozilla Public License Version
 1.1 (the "License"); you may not use this file except in compliance with
 the License. You may obtain a copy of the License at
 http://www.mozilla.org/MPL/
 
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.

The Original Code is the SpatiaLite library

The Initial Developer of the Original Code is Alessandro Furieri
 
Portions created by the Initial Developer are Copyright (C) 2008-2013
the Initial Developer. All Rights Reserved.

Contributor(s):


Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
 
*/


/**
 \file gg_core.h

 Geometry handling functions: core
 */

#ifndef _GG_CORE_H
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#define _GG_CORE_H
#endif

#ifdef __cplusplus
extern "C"
{
#endif

/* function prototypes */

/**
 Safely frees any dynamic memory block allocated by the library itself

 \param ptr pointer to dynamically allocated memory

 \note on some platforms (most notably, Microsoft Windows) many different
 runtime libraries may actually support the same process.
 \n attempting to free() a memory block allocated by a different runtime 
 module may easily cause fatal memory corruption.
 */
    GAIAGEO_DECLARE void gaiaFree (void *ptr);

/**
 Allocates a 2D POINT [XY]

 \param x the X coordinate.
 \param y the Y coordinate.
 
 \return the pointer to the newly created POINT object: NULL on failure

 \sa gaiaFreePoint

 \note you are responsible to destroy (before or after) any allocated
 POINT, unless you've passed ownership of the POINT object to some 
 further object: in this case destroying the higher order object will
 implicitly destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaPointPtr gaiaAllocPoint (double x, double y);

/**
 Allocates a 3D POINT [XYZ]

 \param x the X coordinate.
 \param y the Y coordinate.
 \param z the Z coordinate.
 
 \return the pointer to the newly created POINT object: NULL on failure

 \sa gaiaFreePoint

 \note you are responsible to destroy (before or after) any allocated
 POINT, unless you've passed ownership of the POINT object to some 
 further object: in this case destroying the higher order object will
 implicitly destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaPointPtr gaiaAllocPointXYZ (double x, double y,
						    double z);

/**
 Allocates a 2D POINT [XYM]

 \param x the X coordinate.
 \param y the Y coordinate.
 \param m the M measure.
 
 \return the pointer to the newly created POINT object: NULL on failure

 \sa gaiaFreePoint

 \note you are responsible to destroy (before or after) any allocated
 POINT, unless you've passed ownership of the POINT object to some 
 further object: in this case destroying the higher order object will
 implicitly destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaPointPtr gaiaAllocPointXYM (double x, double y,
						    double m);

/**
 Allocates a 3D POINT [XYZM]

 \param x the X coordinate.
 \param y the Y coordinate.
 \param z the Z coordinate.
 \param m the M measure.
 
 \return the pointer to the newly created POINT object: NULL on failure

 \sa gaiaFreePoint

 \note you are responsible to destroy (before or after) any allocated
 POINT, unless you've passed ownership of the POINT object to some 
 further object: in this case destroying the higher order object will
 implicitly destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaPointPtr gaiaAllocPointXYZM (double x, double y,
						     double z, double m);

/**
 Destroys a POINT object

 \param ptr pointer to the POINT object to be destroyed

 \sa gaiaAllocPoint, gaiaAllocPointXYZ, gaiaAllocPointXYM, gaiaAllocPointXYZM

 \note attempting to destroy any POINT object whose ownership has already
 been transferred to some other (higher order) object is a serious
 error, and will easily cause severe memory corruption.
 */
    GAIAGEO_DECLARE void gaiaFreePoint (gaiaPointPtr ptr);

/**
 Allocates a 2D LINESTRING [XY]

 \param vert number of points [aka vertices] into the Linestring

 \return the pointer to newly created LINESTRING object: NULL on failure

 \sa gaiaFreeLinestring, gaiaLineSetPoint, gaiaLineGetPoint, gaiaSetPoint,
 gaiaGetPoint

 \note you are responsible to destroy (before or after) any allocated LINESTRING,
 unless you've passed ownership of the LINESTRING object to some further 
 object: in this case destroying the higher order object will implicitly 
 destroy any contained child object. 
 */
    GAIAGEO_DECLARE gaiaLinestringPtr gaiaAllocLinestring (int vert);

/**
 Allocates a 3D LINESTRING [XYZ]

 \param vert number of points [aka vertices] into the Linestring

 \return the pointer to newly created LINESTRING object: NULL on failure

 \sa gaiaFreeLinestring, gaiaLineSetPoint, gaiaLineGetPoint, gaiaSetPointXYZ,
 gaiaGetPointXYZ

 \note you are responsible to destroy (before or after) any allocated LINESTRING, 
 unless you've passed ownership of the LINESTRING object to some further  
 object: in this case destroying the higher order object will implicitly 
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaLinestringPtr gaiaAllocLinestringXYZ (int vert);

/**
 Allocates a 2D LINESTRING [XYM]

 \param vert number of points [aka vertices] into the Linestring

 \return the pointer to newly created LINESTRING object: NULL on failure

 \sa gaiaFreeLinestring, gaiaLineSetPoint, gaiaLineGetPoint, gaiaSetPointXYM,
 gaiaGetPointXYM

 \note you are responsible to destroy (before or after) any allocated LINESTRING, 
 unless you've passed ownership of the LINESTRING object to some further  
 object: in this case destroying the higher order object will implicitly 
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaLinestringPtr gaiaAllocLinestringXYM (int vert);

/**
 Allocates a 3D LINESTRING [XYZM]

 \param vert number of points [aka vertices] into the Linestring

 \return the pointer to newly created LINESTRING object: NULL on failure

 \sa gaiaFreeLinestring, gaiaLineSetPoint, gaiaLineGetPoint, gaiaSetPointXYZM,
 gaiaGetPointXYZM

 \note you are responsible to destroy (before or after) any allocated LINESTRING, 
 unless you've passed ownership of the LINESTRING object to some further  
 object: in this case destroying the higher order object will implicitly 
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaLinestringPtr gaiaAllocLinestringXYZM (int vert);

/**
 Destroys a LINESTRING object

 \param ptr pointer to the LINESTRING object to be destroyed

 \sa gaiaAllocLinestring, gaiaAllocLinestringXYZ, gaiaAllocLinestringXYM,
  gaiaAllocLinestringXYZM

 \note attempting to destroy any LINESTRING object whose ownnership has already
 been transferred to some other (higher order) object is a serious
 error, and will easily cause severe memory corruption.
 */
    GAIAGEO_DECLARE void gaiaFreeLinestring (gaiaLinestringPtr ptr);

/**
 Copies coordinates between two LINESTRING objects

 \param dst destination LINESTRING [output]
 \param src origin LINESTRING [input]

 \sa gaiaCopyLinestringCoordsReverse

 \note both LINESTRING objects must have exactly the same number of points:
 if dimensions aren't the same for both objects, then the appropriate 
 conversion will be silently applied.
 */
    GAIAGEO_DECLARE void gaiaCopyLinestringCoords (gaiaLinestringPtr dst,
						   gaiaLinestringPtr src);

/**
 Copies coordinates between two LINESTRING objects in reverse order

 \param dst destination LINESTRING [output]
 \param src origin LINESTRING [input]

 \sa gaiaCopyLinestringCoords

 \note both LINESTRING objects must have exactly the same number of points:
 if dimensions aren't the same for both objects, then the appropriate 
 conversion will be silently applied.
 */
    GAIAGEO_DECLARE void gaiaCopyLinestringCoordsReverse (gaiaLinestringPtr dst,
							  gaiaLinestringPtr
							  src);

/**
 Allocates a 2D RING [XY]

 \param vert number of points [aka vertices] into the Ring

 \return the pointer to newly created RING object: NULL on failure

 \sa gaiaFreeRing, gaiaRingSetPoint, gaiaRingGetPoint, gaiaSetPoint,
 gaiaGetPoint

 \note you are responsible to destroy (before or after) any allocated RING,
 unless you've passed ownership of the RING object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRing (int vert);

/**
 Allocates a 3D RING [XYZ]

 \param vert number of points [aka vertices] into the Ring

 \return the pointer to newly created RING object: NULL on failure

 \sa gaiaFreeRing, gaiaRingSetPoint, gaiaRingGetPoint, gaiaSetPointXYZ,
 gaiaGetPointXYZ

 \note you are responsible to destroy (before or after) any allocated RING,
 unless you've passed ownership of the RING object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRingXYZ (int vert);

/**
 Allocates 2D RING [XYM]

 \param vert number of points [aka vertices] into the Ring

 \return the pointer to newly created RING object: NULL on failure

 \sa gaiaFreeRing, gaiaRingSetPoint, gaiaRingGetPoint, gaiaSetPointXYM,
 gaiaGetPointXYM

 \note you are responsible to destroy (before or after) any allocated RING,
 unless you've passed ownership of the RING object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRingXYM (int vert);

/**
 Allocates a 3D RING [XYZM]

 \param vert number of points [aka vertices] into the Ring

 \return the pointer to newly created RING object: NULL on failure

 \sa gaiaFreeRing, gaiaRingSetPoint, gaiaRingGetPoint, gaiaSetPointXYZM,
 gaiaSetPointXYZM

 \note you are responsible to destroy (before or after) any allocated RING,
 unless you've passed ownership of the RING object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRingXYZM (int vert);

/**
 Destroys a RING object

 \param ptr pointer to the RING object to be destroyed

 \sa gaiaAllocRing, gaiaAllocRingXYZ, gaiaAllocRingXYM,
  gaiaAllocRingXYZM

 \note attempting to destroy any RING object whose ownership has already
 been transferred to some other (higher order) object is a serious
 error, and will easily cause severe memory corruption.
 */
    GAIAGEO_DECLARE void gaiaFreeRing (gaiaRingPtr ptr);

/**
 Copies coordinates between two RING objects

 \param dst destination RING [output]
 \param src origin RING [input]

 \sa gaiaCopyRingCoordsReverse

 \note both RING objects must have exactly the same number of points:
 if dimensions aren't the same for both objects, then the appropriate
 conversion will be silently applied.
 */
    GAIAGEO_DECLARE void gaiaCopyRingCoords (gaiaRingPtr dst, gaiaRingPtr src);

/**
 Copies coordinates between two RING objects in reverse order

 \param dst destination RING [output]
 \param src origin RING [input]

 \sa gaiaCopyRingCoords

 \note both RING objects must have exactly the same number of points:
 if dimensions aren't the same for both objects, then the appropriate
 conversion will be silently applied.
 */
    GAIAGEO_DECLARE void gaiaCopyRingCoordsReverse (gaiaRingPtr dst,
						    gaiaRingPtr src);

/**
 Allocates a 2D POLYGON [XY]

 \param vert number of points [aka vertices] into the Exterior Ring.
 \param holes number of Interior Rings [0, if no Interior Ring is required].

 \return the pointer to newly created POLYGON object: NULL on failure

 \sa gaiaFreePolygon

 \note you are responsible to destroy (before or after) any allocated POLYGON,
 unless you've passed ownership of the POLYGON object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygon (int vert, int holes);

/**
 Allocates a 3D POLYGON [XYZ]
    
 \param vert number of points [aka vertices] into the Exterior Ring.
 \param holes number of Interior Rings [0, if no Interior Ring is required].
    
 \return the pointer to newly created POLYGON object: NULL on failure
    
 \sa gaiaFreePolygon
    
 \note you are responsible to destroy (before or after) any allocated POLYGON,
 unless you've passed ownership of the POLYGON object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygonXYZ (int vert, int holes);

/**
 Allocates a 2D POLYGON [XYM]
    
 \param vert number of points [aka vertices] into the Exterior Ring.
 \param holes number of Interior Rings [0, if no Interior Ring is required].
    
 \return the pointer to newly created POLYGON object: NULL on failure
    
 \sa gaiaFreePolygon
    
 \note you are responsible to destroy (before or after) any allocated POLYGON,
 unless you've passed ownership of the POLYGON object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygonXYM (int vert, int holes);

/**
 Allocates a 3D POLYGON [XYZM]
    
 \param vert number of points [aka vertices] into the Exterior Ring.
 \param holes number of Interior Rings [may by 0, if no Interior Ring is required].
    
 \return the pointer to newly created POLYGON object: NULL on failure
    
 \sa gaiaFreePolygon
    
 \note you are responsible to destroy (before or after) any allocated POLYGON,
 unless you've passed ownership of the POLYGON object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygonXYZM (int vert, int holes);

/**
 Allocates a POLYGON

 \param ring pointer to a valid RING object: assumed to be the Polygon's
  Exterior Ring.

 \return the pointer to newly created POLYGON object: NULL on failure

 \sa gaiaAllocRing, gaiaAllocRingXYZ, gaiaAllocRingXYM, gaiaAllocRingXYZM,
 gaiaFreePolygon

 \note you are responsible to destroy (before or after) any allocated POLYGON,
 unless you've passed ownership of the POLYGON object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object. 
 \n Ownership of passed Ring object will be transferred to the 
 Polygon object being created. 
 */
    GAIAGEO_DECLARE gaiaPolygonPtr gaiaCreatePolygon (gaiaRingPtr ring);

/**
 Destroys a POLYGON object

 \param polyg pointer to the POLYGON object to be destroyed

 \sa gaiaAllocPolygon, gaiaAllocPolygonXYZ, gaiaAllocPolygonXYM,
  gaiaAllocPolygonXYZM, gaiaCreatePolygon

 \note attempting to destroy any POLYGON object whose ownership has already
 been transferred to some other (higher order) object is a serious
 error, and will easily cause severe memory corruption.
 \n Ownership of each RING object referenced by a POLYGON object always belongs
 to the POLYGON itself, so destroying the POLYGON will surely destroy
 any related RING as well.
 */
    GAIAGEO_DECLARE void gaiaFreePolygon (gaiaPolygonPtr polyg);

/**
 Allocates a 2D Geometry [XY]

 \return the pointer to newly created Geometry object: NULL on failure

 \sa gaiaFreeGeomColl

 \note you are responsible to destroy (before or after) any allocated Geometry,
 unless you've passed ownership of the Geometry object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomColl (void);

/**
 Allocates a 3D Geometry [XYZ]

 \return the pointer to newly created Geometry object: NULL on failure

 \sa gaiaFreeGeomColl

 \note you are responsible to destroy (before or after) any allocated Geometry,
 unless you've passed ownership of the Geometry object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomCollXYZ (void);

/**
 Allocates a 2D Geometry [XYM]

 \return the pointer to newly created Geometry object: NULL on failure

 \sa gaiaFreeGeomColl

 \note you are responsible to destroy (before or after) any allocated Geometry,
 unless you've passed ownership of the Geometry object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomCollXYM (void);

/**
 Allocates a 3D Geometry [XYZM]

 \return the pointer to newly created Geometry object: NULL on failure

 \sa gaiaFreeGeomColl

 \note you are responsible to destroy (before or after) any allocated Geometry,
 unless you've passed ownership of the Geometry object to some further
 object: in this case destroying the higher order object will implicitly
 destroy any contained child object.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomCollXYZM (void);

/**
 Destroys a Geometry object

 \param geom pointer to the Geometry object to be destroyed

 \sa gaiaAllocGeomColl, gaiaAllocGeomCollXYZ, gaiaAllocGeomCollXYM,
  gaiaAllocGeomCollXYZM

 \note attempting to destroy any Geometry object whose ownership has already
 been transferred to some other (higher order) object is a serious
 error, and will easily cause severe memory corruption.
 \n Ownership of each POINT, LINESTRING or POLYGON object referenced by a
 Geometry object always belongs to the Geometry itself, so destroying the 
 Geometry will surely destroy any related elementary geometry item as well.
 */
    GAIAGEO_DECLARE void gaiaFreeGeomColl (gaiaGeomCollPtr geom);

/**
 Creates a new 2D Point [XY] object into a Geometry object

 \param p pointer to the Geometry object
 \param x X coordinate of the Point to be created
 \param y X coordinate of the Point to be created

 \note ownership of the newly created POINT object belongs to the Geometry
 object.
 */
    GAIAGEO_DECLARE void gaiaAddPointToGeomColl (gaiaGeomCollPtr p, double x,
						 double y);

/**
 Creates a new 3D Point [XYZ] object into a Geometry object

 \param p pointer to the Geometry object
 \param x X coordinate of the Point to be created
 \param y X coordinate of the Point to be created
 \param z Z coordinate of the Point to be created

 \note ownership of the newly created POINT object belongs to the Geometry
 object.
 */
    GAIAGEO_DECLARE void gaiaAddPointToGeomCollXYZ (gaiaGeomCollPtr p, double x,
						    double y, double z);

/**
 Creates a new 2D Point [XYM] object into a Geometry object

 \param p pointer to the Geometry object
 \param x X coordinate of the Point to be created
 \param y X coordinate of the Point to be created
 \param m M measure of the Point to be created

 \note ownership of the newly created POINT object belongs to the Geometry
 object.
 */
    GAIAGEO_DECLARE void gaiaAddPointToGeomCollXYM (gaiaGeomCollPtr p, double x,
						    double y, double m);

/**
 Creates a new 3D Point [XYZM] object into a Geometry object

 \param p pointer to the Geometry object
 \param x X coordinate of the Point to be created
 \param y X coordinate of the Point to be created
 \param z Z coordinate of the Point to be created
 \param m M measure of the Point to be created

 \note ownership of the newly created POINT object belongs to the Geometry
 object.
 */
    GAIAGEO_DECLARE void gaiaAddPointToGeomCollXYZM (gaiaGeomCollPtr p,
						     double x, double y,
						     double z, double m);

/**
 Creates a new Linestring object into a Geometry object

 \param p pointer to the Geometry object.
 \param vert number of points [aka vertices] into the Linestring.

 \return the pointer to newly created Linestring: NULL on failure.

 \note ownership of the newly created Linestring object belongs to the Geometry object. 
 \n the newly created Linestring will have the same dimensions as the Geometry has.
 */
    GAIAGEO_DECLARE gaiaLinestringPtr
	gaiaAddLinestringToGeomColl (gaiaGeomCollPtr p, int vert);

/**
 Inserts an already existing Linestring object into a Geometry object

 \param p pointer to the Geometry object.
 \param line pointer to the Linestring object.

 \note ownership of the Linestring object will be transferred to the
 Geometry object.
 */
    GAIAGEO_DECLARE void gaiaInsertLinestringInGeomColl (gaiaGeomCollPtr p,
							 gaiaLinestringPtr
							 line);

/**
 Creates a new Polygon object into a Geometry object

 \param p pointer to the Geometry object.
 \param vert number of points [aka vertices] into the Polygon's Exterior Ring.
 \param interiors number of Interiors Rings [0, if no Interior Ring is required]

 \return the pointer to newly created Polygon: NULL on failure.

 \note ownership of the newly created Polygon object belongs to the Geometry object.
 \n the newly created Polygon will have the same dimensions as the Geometry has.
 */
    GAIAGEO_DECLARE gaiaPolygonPtr gaiaAddPolygonToGeomColl (gaiaGeomCollPtr p,
							     int vert,
							     int interiors);

/**
 Creates a new Polygon object into a Geometry object starting from an
 already existing Ring object

 \param p pointer to the Geometry object.
 \param ring pointer to the Ring object [assumed to represent to Polygon's
 Exterior Ring].

 \return the pointer to the newly created Polygon object: NULL on failure.

 \note ownership of the Ring object will be transferred to the
 Polygon object, and the Polygon object ownerships belongs to the Geometry object.
 \n the Polygon object will have the same dimensions as the Ring object has.
 */
    GAIAGEO_DECLARE gaiaPolygonPtr gaiaInsertPolygonInGeomColl (gaiaGeomCollPtr
								p,
								gaiaRingPtr
								ring);

/**
 Creates a new Interior Ring object into a Polygon object

 \param p pointer to the Polygon object.
 \param pos relative position index [first Interior Ring has index 0].
 \param vert number of points (aka vertices) into the Ring.

 \return the pointer to the newly created Ring object: NULL on failure.

 \sa gaiaAllocPolygon, gaiaAllocPolygonXYZ, gaiaAllocPolygonXYM,
 gaiaAllocPolygonXYZM

 \note ownership of the Ring object belongs to the Polygon object.
 \n the newly created Ring will have the same dimensions the Polygon has.
 */
    GAIAGEO_DECLARE gaiaRingPtr gaiaAddInteriorRing (gaiaPolygonPtr p, int pos,
						     int vert);

/**
 Inserts an already existing Ring object into a Polygon object

 \param p pointer to the Polygon object
 \param ring pointer to the Ring object

 \sa gaiaAddRingToPolygon

 \note ownership of the Ring object still remains to the calling procedure
 (a duplicated copy of the original Ring will be inserted into the Polygon).
 \n the newly created Polygon will have the same dimensions as the Ring has.
 \n if required the Polygon's Interior Rings count could be increased.
 */
    GAIAGEO_DECLARE void gaiaInsertInteriorRing (gaiaPolygonPtr p,
						 gaiaRingPtr ring);

/**
 Inserts an already existing Ring object into a Polygon object

 \param polyg pointer to the Polygon object
 \param ring pointer to the Ring object

 \sa gaiaInsertInteriorRing

 \note ownership of the Ring object will be transferred to the Polygon object.
 \n the newly created Polygon will have the same dimensions as the Ring has.
 \n if required the Polygon's Interior Rings count could be increased.
 */
    GAIAGEO_DECLARE void gaiaAddRingToPolyg (gaiaPolygonPtr polyg,
					     gaiaRingPtr ring);

/**
 Duplicates a Linestring object

 \param line pointer to Linestring object [origin].

 \return the pointer to newly created Linestring object: NULL on failure.

 \sa gaiaCloneRing, gaiaClonePolygon, gaiaCloneGeomColl,
 gaiaCloneGeomCollPoints, gaiaCloneGeomCollLinestrings, 
 gaiaCloneGeomCollPolygons, gaiaCloneLinestringSpecial

 \note the newly created object is an exact copy of the original one. 
 */
    GAIAGEO_DECLARE gaiaLinestringPtr gaiaCloneLinestring (gaiaLinestringPtr
							   line);
/**
 Duplicates a Linestring object (special)

 \param line pointer to Linestring object [origin].
 \param mode one of GAIA_SAME_ORDER or GAIA_REVERSE_ORDER.

 \return the pointer to newly created Linestring object: NULL on failure.

 \sa gaiaCloneLinestring, gaiaCloneGeomCollSpecial

 \note if GAIA_REVERSE_ORDER is specified, then any vertex into the newly created
  object will be in reverse order [first vertex will be last one, and last vertex
  will be the first one]. In any other case this function will simply default to 
  gaiaCloneLinestring. 
 */
    GAIAGEO_DECLARE gaiaLinestringPtr
	gaiaCloneLinestringSpecial (gaiaLinestringPtr line, int mode);

/**
 Duplicates a Ring object

 \param ring pointer to Ring object [origin].

 \return the pointer to newly created Ring object: NULL on failure.

 \sa gaiaCloneLinestring, gaiaClonePolygon, gaiaCloneGeomColl,
 gaiaCloneGeomCollPoints, gaiaCloneGeomCollLinestrings, 
 gaiaCloneGeomCollPolygons, gaiaCloneRingSpecial

 \note the newly created object is an exact copy of the original one. 
 */
    GAIAGEO_DECLARE gaiaRingPtr gaiaCloneRing (gaiaRingPtr ring);

/**
 Duplicates a Ring object (special)

 \param ring pointer to Ring object [origin].
 \param mode one of GAIA_SAME_ORDER or GAIA_REVERSE_ORDER.

 \return the pointer to newly created Ring object: NULL on failure.

 \sa gaiaCloneRing, gaiaClonePolygonSpecial

 \note if GAIA_REVERSE_ORDER is specified, then any vertex into the newly created
  object will be in reverse order [first vertex will be last one, and last vertex
  will be the first one]. In any other case this function will simply default to 
  gaiaCloneRing. 
 */
    GAIAGEO_DECLARE gaiaRingPtr gaiaCloneRingSpecial (gaiaRingPtr ring,
						      int mode);

/**
 Duplicates a Polygon object

 \param polyg pointer to Polygon object [origin].

 \return the pointer to newly created Polygon object: NULL on failure.

 \sa gaiaCloneLinestring, gaiaCloneRing, gaiaCloneGeomColl,
 gaiaCloneGeomCollPoints, gaiaCloneGeomCollLinestrings, 
 gaiaCloneGeomCollPolygons, gaiaClonePolygonSpecial

 \note the newly created object is an exact copy of the original one. 
 */
    GAIAGEO_DECLARE gaiaPolygonPtr gaiaClonePolygon (gaiaPolygonPtr polyg);

/**
 Duplicates a Polygon object (special)

 \param polyg pointer to Polygon object [origin].
 \param mode one of GAIA_SAME_ORDER, GAIA_REVERSE_ORDER or GAIA_LHR_ORDER.

 \return the pointer to newly created Polygon object: NULL on failure.

 \sa gaiaClonePolygon, gaiaCloneGeomCollSpecial

 \note if GAIA_REVERSE_ORDER is specified, then any Ring into the newly created
  object will be in reverse order. If GAIA_LHR_ORDER is specified instead, any
  Exterior Ring will have clockwise orientation, and any Interior Ring will have
  counter-clockwise orientation. In any other case this function will simply 
  default to gaiaClonePolygon. 
 */
    GAIAGEO_DECLARE gaiaPolygonPtr gaiaClonePolygonSpecial (gaiaPolygonPtr
							    polyg, int mode);

/**
 Duplicates a Geometry object

 \param geom pointer to Geometry object [origin].

 \return the pointer to newly created Geometry object: NULL on failure.

 \sa gaiaCloneLinestring, gaiaCloneRing, gaiaClonePolygon, 
 gaiaCloneGeomCollPoints, gaiaCloneGeomCollLinestrings,
 gaiaCloneGeomCollPolygons, gaiaCastGeomCollToXY, gaiaCastGeomCollToXYZ,
 gaiaCastGeomCollToXYM, gaiaCastGeomCollToXYZM, gaiaExtractPointsFromGeomColl,
 gaiaExtractLinestringsFromGeomColl, gaiaExtractPolygonsFromGeomColl,
 gaiaMergeGeometries, gaiaCloneGeomCollSpecial

 \note the newly created object is an exact copy of the original one. 
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomColl (gaiaGeomCollPtr geom);

/**
 Duplicates a Geometry object (special)

 \param geom pointer to Geometry object [origin].
 \param mode one of GAIA_SAME_ORDER, GAIA_REVERSE_ORDER or GAIA_LHR_ORDER.

 \return the pointer to newly created Geometry object: NULL on failure.

 \sa gaiaCloneLinestringSpecial, gaiaCloneRingSpecial, gaiaClonePolygonSpecial, 
 gaiaCloneGeomColl

 \note if GAIA_REVERSE_ORDER is specified, then any Linestring and/or Ring into
 the newly created object will be in reverse order. If GAIA_LHR_ORDER is specified 
  instead, any Polygong will have the Exterior Ring in clockwise orientation, and any 
  Interior Ring int counter-clockwise orientation. In any other case this function will 
  simply default to gaiaCloneGeomColl. 
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomCollSpecial (gaiaGeomCollPtr
							      geom, int mode);

/**
 Duplicates a Geometry object [Points only]

 \param geom pointer to Geometry object [origin].

 \return the pointer to newly created Geometry object: NULL on failure.

 \sa gaiaCloneLinestring, gaiaCloneRing, gaiaClonePolygon, gaiaCloneGeomColl,
 gaiaCloneGeomCollLinestrings, 
 gaiaCloneGeomCollPolygons

 \note the newly created object is an exact copy of the original one; except
 in that only Point objects will be copied.
 \n Caveat: an empty Geometry could be returned.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomCollPoints (gaiaGeomCollPtr
							     geom);

/**
 Duplicates a Geometry object [Linestrings only]
                                                             
 \param geom pointer to Geometry object [origin].
        
 \return the pointer to newly created Geometry object: NULL on failure.

 \sa gaiaCloneLinestring, gaiaCloneRing, gaiaClonePolygon, gaiaCloneGeomColl,
 gaiaCloneGeomCollPoints, gaiaCloneGeomCollPolygons

 \note the newly created object is an exact copy of the original one; except
 in that only Linestrings objects will be copied.
 \n Caveat: an empty Geometry could be returned.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr
	gaiaCloneGeomCollLinestrings (gaiaGeomCollPtr geom);

/**
 Duplicates a Geometry object [Polygons only]
 
 \param geom pointer to Geometry object [origin].
 
 \return the pointer to newly created Geometry object: NULL on failure.

 \sa gaiaCloneLinestring, gaiaCloneRing, gaiaClonePolygon, gaiaCloneGeomColl,
 gaiaCloneGeomCollPoints, gaiaCloneGeomCollLinestrings

 \note the newly created object is an exact copy of the original one; except
 in that only Polygons objects will be copied.
 \n Caveat: an empty Geometry could be returned.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomCollPolygons (gaiaGeomCollPtr
							       geom);

/**
 Duplicates a Geometry object [casting dimensions to 2D XY]

 \param geom pointer to Geometry object [origin].

 \return the pointer to newly created Geometry object: NULL on failure.

 \sa gaiaCloneGeomColl, gaiaCastGeomCollToXYZ,
 gaiaCastGeomCollToXYM, gaiaCastGeomCollToXYZM

 \note the newly created object is an exact copy of the original one; except
 in that any elementary item  will be casted to 2D [XY] dimensions.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXY (gaiaGeomCollPtr geom);

/**
 Duplicates a Geometry object [casting dimensions to 3D XYZ]

 \param geom pointer to Geometry object [origin].

 \return the pointer to newly created Geometry object: NULL on failure.

 \sa gaiaCloneGeomColl, gaiaCastGeomCollToXY, 
 gaiaCastGeomCollToXYM, gaiaCastGeomCollToXYZM

 \note the newly created object is an exact copy of the original one; except
 in that any elementary item  will be cast to 3D [XYZ] dimensions.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXYZ (gaiaGeomCollPtr
							   geom);

/**
 Duplicates a Geometry object [casting dimensions to 2D XYM]

 \param geom pointer to Geometry object [origin].

 \return the pointer to newly created Geometry object: NULL on failure.

 \sa gaiaCloneGeomColl, gaiaCastGeomCollToXY, gaiaCastGeomCollToXYZ,
 gaiaCastGeomCollToXYZM

 \note the newly created object is an exact copy of the original one; except
 in that any elementary item  will be cast to 2D [XYM] dimensions.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXYM (gaiaGeomCollPtr
							   geom);

/**
 Duplicates a Geometry object [casting dimensions to 3D XYZM]

 \param geom pointer to Geometry object [origin].

 \return the pointer to newly created Geometry object: NULL on failure.

 \sa gaiaCloneGeomColl, gaiaCastGeomCollToXY, gaiaCastGeomCollToXYZ,
 gaiaCastGeomCollToXYM

 \note the newly created object is an exact copy of the original one; except
 in that any elementary item  will be cast to 3D [XYZM] dimensions.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXYZM (gaiaGeomCollPtr
							    geom);

/**
 Gets coodinates from a Linestring's Point

 \param ln pointer to Linestring object.
 \param v relative position of Point: first Point has index 0
 \param x on completion this variable will contain the Point X coordinate.
 \param y on completion this variable will contain the Point Y coordinate.
 \param z on completion this variable will contain the Point Z coordinate.
 \param m on completion this variable will contain the Point M measure.

 \return 0 on failure: any other different value on success.

 \sa gaiaLineSetPoint, gaiaGetPoint, gaiaGetPointXYZ, gaiaGetPointXYM,
 gaiaGetPointXYZM

 \note this function perform the same identical task performed by
 gaiaGetPoint(), gaiaGetPointXYZ(), gaiaGetPointXYM() and gaiaGetPointXYZM()
 macros.
 \n using the gaiaLineGetPoint() function is a little bit slower but is
 intrinsically safest, because misused macros can easily cause severe
 memory corruption.
 \n gaiaLineGetPoint() instead will always ensure that the appropriate
 dimensions (as declared by the Linestring object) will be correctly used.
 */
    GAIAGEO_DECLARE int gaiaLineGetPoint (gaiaLinestringPtr ln, int v,
					  double *x, double *y, double *z,
					  double *m);

/**
 Sets coordinates for a Linestring's Point

 \param ln pointer to Linestring object.
 \param v relative position of Point: first Point has index 0
 \param x the Point's X coordinate.
 \param y the Point's Y coordinate.
 \param z the Point's Z coordinate.
 \param m the Point's M measure.

 \return 0 on failure: any other different value on success.

 \sa gaiaLineGetPoint, gaiaSetPoint, gaiaSetPointXYZ, gaiaSetPointXYM,
 gaiaSetPointXYZM

 \note this function perform the same identical task performed by 
 gaiaSetPoint(), gaiaSetPointXYZ(), gaiaSetPointXYM() and gaiaSetPointXYZM()
 macros.
 \n using the gaiaLineSetPoint() function is a little bit slower but is
 intrinsically safest, because misused macros can easily cause severe
 memory corruption.
 \n gaiaLineSetPoint() instead will always ensure that the appropriate 
 dimensions (as declared by the Linestring object) will be correctly used.
 */
    GAIAGEO_DECLARE int gaiaLineSetPoint (gaiaLinestringPtr ln, int v, double x,
					  double y, double z, double m);

/**
 Gets coordinates from a Ring's Point

 \param rng pointer to Ring object.
 \param v relative position of Point: first Point has index 0
 \param x on completion this variable will contain the Point X coordinate.
 \param y on completion this variable will contain the Point Y coordinate.
 \param z on completion this variable will contain the Point Z coordinate.
 \param m on completion this variable will contain the Point M measure.

 \return 0 on failure: any other different value on success.

 \sa gaiaRingSetPoint, gaiaGetPoint, gaiaGetPointXYZ, gaiaGetPointXYM,
 gaiaGetPointXYZM

 \note this function perform the same identical task performed by
 gaiaGetPoint(), gaiaGetPointXYZ(), gaiaGetPointXYM() and gaiaGetPointXYZM()
 macros.
 \n using the gaiaRingGetPoint() function is a little bit slower but is
 intrinsically safest, because misused macros can easily cause severe
 memory corruption.
 \n gaiaRingGetPoint() instead will always ensure that the appropriate
 dimensions (as declared by the Ring object) will be correctly used.
 */
    GAIAGEO_DECLARE int gaiaRingGetPoint (gaiaRingPtr rng, int v, double *x,
					  double *y, double *z, double *m);

/**
 Sets coodinates for a Ring's Point

 \param rng pointer to Ring object.
 \param v relative position of Point: first Point has index 0
 \param x the Point's X coordinate.
 \param y the Point's Y coordinate.
 \param z the Point's Z coordinate.
 \param m the Point's M measure.

 \return 0 on failure: any other different value on success.

 \sa gaiaRingGetPoint, gaiaGetPoint, gaiaGetPointXYZ, gaiaSetPointXYM,
 gaiaSetPointXYZM

 \note this function perform the same identical task performed by
 gaiaSetPoint(), gaiaSetPointXYZ(), gaiaSetPointXYM() and gaiaSetPointXYZM()
 macros.
 \n using the gaiaRingSetPoint() function is a little bit slower but is
 intrinsically safest, because misused macros can easily cause severe
 memory corruption.
 \n gaiaRingSetPoint() instead will always ensure that the appropriate
 dimensions (as declared by the Ring object) will be correctly used.
 */
    GAIAGEO_DECLARE int gaiaRingSetPoint (gaiaRingPtr rng, int v, double x,
					  double y, double z, double m);

/**
 Determines OGC dimensions for a Geometry object

 \param geom pointer to Geometry object
 
 \return OGC dimensions

 \note OGC dimensions are defined as follows:
 \li if the Geometry doesn't contain any elementary item: \b -1
 \li if the Geometry only contains Point items: \b 0
 \li if the Geometry only contains Point / Linestring items: \b 1
 \li if the Geometry contains some Polygon item: \b 2
 */
    GAIAGEO_DECLARE int gaiaDimension (gaiaGeomCollPtr geom);

/**
 Determines the corresponding Type for a Geometry object
 
 \param geom pointer to Geometry object

 \return the corresponding Geometry Type

 \note Type is one of: GAIA_POINT, GAIA_LINESTRING, GAIA_POLYGON,
 GAIA_MULTIPOINT, GAIA_MULTILINESTRING, GAIA_MULTIPOLYGON,
 GAIA_GEOMETRYCOLLECTION, GAIA_POINTZ, GAIA_LINESTRINGZ, GAIA_POLYGONZ,
 GAIA_MULTIPOINTZ, GAIA_MULTILINESTRINGZ, GAIA_MULTIPOLYGONZ,
 GAIA_GEOMETRYCOLLECTIONZ, GAIA_POINTM, GAIA_LINESTRINGM, GAIA_POLYGONM,
 GAIA_MULTIPOINTM, GAIA_MULTILINESTRINGM, GAIA_MULTIPOLYGONM,
 GAIA_GEOMETRYCOLLECTIONM, GAIA_POINTZM, GAIA_LINESTRINGZM, GAIA_POLYGONZM,
 GAIA_MULTIPOINTZM, GAIA_MULTILINESTRINGZM, GAIA_MULTIPOLYGONZM,
 GAIA_GEOMETRYCOLLECTIONZM
 \n on failure GAIA_NONE will be returned.
 */
    GAIAGEO_DECLARE int gaiaGeometryType (gaiaGeomCollPtr geom);

/**
 Determines the corresponding Type for a Geometry object

 \param geom pointer to Geometry object

 \return the corresponding Geometry Type

 \sa gaiaGeometryType

 \note Type is one of: GAIA_POINT, GAIA_LINESTRING, GAIA_POLYGON,
 GAIA_MULTIPOINT, GAIA_MULTILINESTRING, GAIA_MULTIPOLYGON,
 GAIA_GEOMETRYCOLLECTION
 \n on failure GAIA_NONE will be returned.

 \remark deprecated function (used in earlier SpatiaLite versions).
 */
    GAIAGEO_DECLARE int gaiaGeometryAliasType (gaiaGeomCollPtr geom);

/**
 Checks for empty Geometry object

 \param geom pointer to Geometry object

 \return 0 if the Geometry is empty: otherwise any other different value.

 \note an empty Geometry is a Geometry not containing any elementary
 item: i.e. no Points, no Linestrings and no Polygons at all.
 */
    GAIAGEO_DECLARE int gaiaIsEmpty (gaiaGeomCollPtr geom);

/**
 Checks for toxic Geometry object

 \param geom pointer to Geometry object

 \return 0 if the Geometry is not toxic: otherwise any other different value.

 \sa gaiaSanitize

 \note a \b toxic Geometry is a Geometry containing severely malformed
 Polygons: i.e. containing less than 4 Points.
 \n Or containing severely malformed Linestrings: i.e. containing less 
 than 2 Points.
 \n Attempting to pass any toxic Geometry to GEOS supported functions
 will easily cause a crash.
 */
    GAIAGEO_DECLARE int gaiaIsToxic (gaiaGeomCollPtr geom);

/**
 Checks for not-closed Rings 

 \param ring pointer to Ring object

 \return 0 if the Ring in unclosed: otherwise any other different value.

 \sa gaiaIsToxic, gaiaIsNotClosedGeomColl

 \note unclosed Rings cause GEOS supported functions to crash.
 \n SpatiaLite will always carefully check any Ring before passing it
 to GEOS, eventually silently inserting a further point required so 
 to properly close the figure.
 \n This function allows to explicitly identify any unclosed Ring.
 */
    GAIAGEO_DECLARE int gaiaIsNotClosedRing (gaiaRingPtr ring);

/**
 Checks for not-closed Rings in a Geometry object

 \param geom pointer to Geometry object

 \return 0 if the Geometry has no unclosed Rings: otherwise any other different value.

 \sa gaiaIsToxic, gaiaIsNotClosedRing

 \note This function allows to explicitly identify any Geometry containing
 at least one unclosed Ring.
 */
    GAIAGEO_DECLARE int gaiaIsNotClosedGeomColl (gaiaGeomCollPtr geom);

/**
 Attempts to sanitize a possibly malformed Geometry object

 \param org pointer to Geometry object.

 \return the pointer to newly created Geometry: NULL on failure.

 \sa gaiaIsToxic

 \note you are responsible to destroy (before or after) any allocated Geometry,
 this including any Geometry created by gaiaSanitize()
 \n the output Geometry will surely have:
 \li no repeated Points on Linestrings or Rings (i.e. consecutive Points 
 sharing exactly the same coordinates): any repeated Point will be suppressed,
 simply leaving only the first occurrence.
 \li proper Ring closure: for sure any Ring will have exactly coinciding
 first and last Points.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSanitize (gaiaGeomCollPtr org);


/**
 Attempts to resolve a (Multi)Linestring from a Geometry object

 \param geom pointer to Geometry object.
 \param force_multi: 0 if the returned Geometry could represent a Linestring:
 any other value if casting to MultiLinestring is required unconditionally.

 \return the pointer to newly created Geometry: NULL on failure.

 \sa gaiaDissolveSegments, gaiaDissolvePoints

 \note you are responsible to destroy (before or after) any allocated Geometry,
 this including any Geometry created by gaiaLinearize()
 \n the input Geometry is expected to contain Polygons only: then any Ring 
 will be transformed into the corresponding Linestring.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaLinearize (gaiaGeomCollPtr geom,
						   int force_multi);

/**
 Attempts to resolve a collection of Segments from a Geometry object

 \param geom pointer to Geometry object.

 \return the pointer to newly created Geometry: NULL on failure.

 \sa gaiaLinearize, gaiaDissolvePoints

 \note you are responsible to destroy (before or after) any allocated Geometry,
 this including any Geometry created by gaiaDissolveSegments()
 \n the input Geometry can be of any arbitrary type:
 \li any Point will be copied untouched.
 \li any Linestring will be dissolved into Segments.
 \li any Ring will be dissolved into Segments.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaDissolveSegments (gaiaGeomCollPtr geom);

/** 
 Attempts to resolve a collection of Points from a Geometry object

 \param geom pointer to Geometry object.
 
 \return the pointer to newly created Geometry: NULL on failure.

 \sa gaiaLinearize, gaiaDissolveSegments

 \note you are responsible to destroy (before or after) any allocated Geometry,
 this including any Geometry created by gaiaDissolvePoints()
 \n the input Geometry can be of any arbitrary type:
 \li any Point will be copied untouched.
 \li any Linestring will be dissolved into sparse Points.
 \li any Ring will be dissolved into sparse Points.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaDissolvePoints (gaiaGeomCollPtr geom);

/**
 Extracts any Point from a Geometry object

 \param geom pointer to Geometry object

 \return the pointer to newly created Geometry: NULL on failure.

 \sa gaiaExtractLinestringsFromGeomColl,
 gaiaExtractPolygonsFromGeomColl, gaiaCloneGeomColl

 \note you are responsible to destroy (before or after) any allocated Geometry,
 this including any Geometry created by gaiaExtractPointsFromGeomColl()
 \n the newly created Geometry will contain any Point contained into the
 input Geometry.
 \n if the input Geometry doesn't contains any Point, then NULL will be returned.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr
	gaiaExtractPointsFromGeomColl (gaiaGeomCollPtr geom);

/**
 Extracts any Linestring from a Geometry object

 \param geom pointer to Geometry object

 \return the pointer to newly created Geometry: NULL on failure.

 \sa gaiaExtractPointsFromGeomColl, gaiaExtractPolygonsFromGeomColl, 
 gaiaCloneGeomColl

 \note you are responsible to destroy (before or after) any allocated Geometry,
 this including any Geometry created by gaiaExtractLinestringsFromGeomColl()
 \n the newly created Geometry will contain any Linestring contained into the
 input Geometry.
 \n if the input Geometry doesn't contains any Linestring, then NULL will be returned.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr
	gaiaExtractLinestringsFromGeomColl (gaiaGeomCollPtr geom);

/**
 Extracts any Polygon from a Geometry object
        
 \param geom pointer to Geometry object

 \return the pointer to newly created Geometry: NULL on failure.

 \sa gaiaExtractPointsFromGeomColl, gaiaExtractLinestringsFromGeomColl,
 gaiaCloneGeomColl

 \note you are responsible to destroy (before or after) any allocated Geometry,
 this including any Geometry created by gaiaExtractPolygonsFromGeomColl()
 \n the newly created Geometry will contain any Polygon contained into the
 input Geometry.
 \n if the input Geometry doesn't contains any Polygon, then NULL will be returned.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr
	gaiaExtractPolygonsFromGeomColl (gaiaGeomCollPtr geom);

/**
 Merges two Geometry objects into a single one

 \param geom1 pointer to first Geometry object.
 \param geom2 pointer to second Geometry object.

 \return the pointer to newly created Geometry: NULL on failure.

 \sa gaiaCloneGeomColl

 \note you are responsible to destroy (before or after) any allocated Geometry,
 this including any Geometry created by gaiaMergeGeometries()
 \n the newly created Geometry will contain any Point, Linestring and/or
 Polygon contained in both input Geometries.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMergeGeometries (gaiaGeomCollPtr geom1,
							 gaiaGeomCollPtr geom2);

/**
 Return a GeometryCollection containing elements matching the specified range of measures

 \param geom pointer to Geometry object
 \param m_start range of measures: start value
 \param m_end range of measures: end value

 \return the pointer to newly created Geometry: NULL on failure.

 \note you are responsible to destroy (before or after) any allocated Geometry,
 this including any Geometry created by gaiaLocateBetweenMeasures()
 \n the newly created Geometry will contain Points and/or Linestrings.
 \n if the input Geometry has no M dimension then NULL will be returned.
 \n if the input Geometry doesn't contains any point/vertex corresponding to the
 required range of measures then NULL will be returned.
 \n if the input Geometry contains any Polygon (or is a GeometryCollection) then
 NULL will be returned.
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr
	gaiaLocateBetweenMeasures (gaiaGeomCollPtr geom, double m_start,
				   double m_end);

/**
 Measures the geometric length for a Linestring or Ring

 \param dims dimensions: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M or GAIA_XY_ZM
 \param coords pointed to COORD mem-array
 \param vert number of Points (aka Vertices) within the COORD mem-array

 \return the calculated geometric length

 \sa gaiaGeomCollLength

 \note \b dims, \b coords and \b vert are usually expected to correspond to
 \b DimensionModel, \b Coords and \b Points members from a gaiaLinestringStruct
 or gaiaRingStruct

 \remark internal method: doesn't require any GEOS support.
 */
    GAIAGEO_DECLARE double gaiaMeasureLength (int dims, double *coords,
					      int vert);

/**
 Measures the geometric area for a Ring object

 \param ring pointer to Ring object

 \return the calculated geometric area

 \sa gaiaGeomCollArea

 \remark internal method: doesn't require any GEOS support.
 */
    GAIAGEO_DECLARE double gaiaMeasureArea (gaiaRingPtr ring);

/**
 Determines the Centroid for a Ring object

 \param ring pointer to Ring object.
 \param rx on completion this variable will contain the centroid X coordinate.
 \param ry on completion this variable will contain the centroid Y coordinate.

 \sa gaiaGeomCollCentroid

 \remark internal method: doesn't require any GEOS support.
 */
    GAIAGEO_DECLARE void gaiaRingCentroid (gaiaRingPtr ring, double *rx,
					   double *ry);

/**
 Determines the direction for a Ring object

 \param p pointer to Ring object

 \return 0 if the ring has counter-clockwise direction; any other different
 value for clockwise direction.
 */
    GAIAGEO_DECLARE void gaiaClockwise (gaiaRingPtr p);

/**
 Check if a Point lays on a Ring surface

 \param ring pointer to Ring object
 \param pt_x Point X coordinate
 \param pt_y Point Y coordinate

 \return 0 if false: any other value if true
 */
    GAIAGEO_DECLARE int gaiaIsPointOnRingSurface (gaiaRingPtr ring, double pt_x,
						  double pt_y);

/**
 Checks if a Point lays on a Polygon surface

 \param polyg pointer to Polygon object
 \param x Point X coordinate
 \param y Point Y coordinate

 \return 0 if false: any other value if true
 */
    GAIAGEO_DECLARE int gaiaIsPointOnPolygonSurface (gaiaPolygonPtr polyg,
						     double x, double y);

/**
 Computes the minimum distance between a Point and a Linestring or Ring

 \param x0 Point X coordinate
 \param y0 Point Y coordinate
 \param dims dimensions: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M or GAIA_XY_ZM
 \param coords pointed to COORD mem-array
 \param vert number of Points (aka Vertices) within the COORD mem-array

 \return the calculated minumum distance.

 \note \b dims, \b coords and \b vert are usually expected to correspond to
 \b DimensionModel, \b Coords and \b Points members from a gaiaLinestringStruct
 or gaiaRingStruct
 */
    GAIAGEO_DECLARE double gaiaMinDistance (double x0, double y0,
					    int dims, double *coords, int vert);

/**
 Determines the intesection Point between two Segments

 \param x0 on completion this variable will contain the Intersection X coord
 \param y0 on completion this variable will contain the Intersection Y coord
 \param x1 start Point X of first Segment
 \param y1 start Point Y of first Segment
 \param x2 end Point X of first Segment
 \param y2 end Point Y of first Segment
 \param x3 start Point X of second Segment
 \param y3 start Point Y of second Segment
 \param x4 end Point X of second Segment
 \param y4 end Point Y of second Segment

 \return 0 if the Segments doesn't intersect at all: any other value on
 success.
 */
    GAIAGEO_DECLARE int gaiaIntersect (double *x0, double *y0, double x1,
				       double y1, double x2, double y2,
				       double x3, double y3, double x4,
				       double y4);

/**
 Shifts any coordinate within a Geometry object

 \param geom pointer to Geometry object.
 \param shift_x X axis shift factor.
 \param shift_y Y axis shift factor.

 \sa gaiaScaleCoords, gaiaRotateCoords, gaiaReflectCoords, gaiaSwapCoords,
     gaiaShiftCoords3D, gaiaShiftLongitude
 */
    GAIAGEO_DECLARE void gaiaShiftCoords (gaiaGeomCollPtr geom, double shift_x,
					  double shift_y);

/**
 Shifts any coordinate within a 3D Geometry object

 \param geom pointer to Geometry object.
 \param shift_x X axis shift factor.
 \param shift_y Y axis shift factor.
 \param shift_z Z axis shift factor.

 \sa gaiaScaleCoords, gaiaRotateCoords, gaiaReflectCoords, gaiaSwapCoords,
     gaiaShiftCoords, gaiaShiftLongitude, gaiaNormalizeLonLat
 */
    GAIAGEO_DECLARE void gaiaShiftCoords3D (gaiaGeomCollPtr geom,
					    double shift_x, double shift_y,
					    double shift_z);

/**
 Shifts negative longitudes

 \param geom pointer to Geometry object.

 \sa gaiaShiftCoords, gaiaShiftCoords3D, gaiaNormalizeLonLat

 \note only intended for geographic (longitude/latitude) coordinates.
 Negative longitudes (-180/0) will be shifted by 360, thus allowing
 to represent longitudes in the 0/360 range and effectively crossing 
 the International Date Line.
 
 */
    GAIAGEO_DECLARE void gaiaShiftLongitude (gaiaGeomCollPtr geom);

/**
 Shifts any coordinate to within the "normal range" of longitude and
 latitude values (-180.0 to 180.0 longitude and -90.0 to 90.0 latitude).

 \param geom pointer to Geometry object.

 \sa gaiaScaleCoords, gaiaRotateCoords, gaiaReflectCoords, gaiaSwapCoords,
     gaiaShiftCoords3D, gaiaShiftLongitude
 */
    GAIAGEO_DECLARE void gaiaNormalizeLonLat (gaiaGeomCollPtr geom);


/**
 Scales any coordinate within a Geometry object

 \param geom pointer to Geometry object.
 \param scale_x X axis scale factor.
 \param scale_y Y axis scale factor.

 \sa gaiaShiftCoords, gaiaRotateCoords, gaiaReflectCoords, gaiaSwapCoords
 */
    GAIAGEO_DECLARE void gaiaScaleCoords (gaiaGeomCollPtr geom, double scale_x,
					  double scale_y);

/**
 Rotates any coordinate within a Geometry object

 \param geom pointer to Geometry object.
 \param angle rotation angle [expressed in Degrees].

 \sa gaiaShiftCoords, gaiaScaleCoords, gaiaReflectCoords, gaiaSwapCoords
 */
    GAIAGEO_DECLARE void gaiaRotateCoords (gaiaGeomCollPtr geom, double angle);

/**
 Reflects any coordinate within a Geometry object

 \param geom pointer to Geometry object.
 \param x_axis if set to 0, no X axis reflection will be applied:
 otherwise the X axis will be reflected.
 \param y_axis if set to 0, no Y axis reflection will be applied:
 otherwise the Y axis will be reflected.

 \sa gaiaShiftCoords, gaiaScaleCoords, gaiaRotateCoords, gaiaSwapCoords
 */
    GAIAGEO_DECLARE void gaiaReflectCoords (gaiaGeomCollPtr geom, int x_axis,
					    int y_axis);

/**
 Swaps any coordinate within a Geometry object

 \param geom pointer to Geometry object.

 \sa gaiaShiftCoords, gaiaScaleCoords, gaiaRotateCoords, gaiaReflectCoords

 \note the X and Y axes will be swapped.
 */
    GAIAGEO_DECLARE void gaiaSwapCoords (gaiaGeomCollPtr geom);

/**
 Checks if two Linestring objects are equivalent

 \param line1 pointer to first Linestring object.
 \param line2 pointer to second Linestring object.

 \return 0 if false: any other different value if true

 \sa gaiaPolygonEquals

 \note two Linestrings objects are assumed to be equivalent if exactly
 \remark deprecated function (used in earlier SpatiaLite versions).
 the same Points are found in both them.
 */
    GAIAGEO_DECLARE int gaiaLinestringEquals (gaiaLinestringPtr line1,
					      gaiaLinestringPtr line2);

/**
 Checks if two Polygons objects are equivalent

 \param polyg1 pointer to first Polygon object.
 \param polyg2 pointer to second Polygon object.

 \return 0 if false: any other different value if true

 \sa gaiaLinestringEquals

 \note two Polygon objects are assumed to be equivalent if exactly 
 the same Points are found in both them.

 \remark deprecated function (used in earlier SpatiaLite versions).
 */
    GAIAGEO_DECLARE int gaiaPolygonEquals (gaiaPolygonPtr polyg1,
					   gaiaPolygonPtr polyg2);

/**
 Retrieves Geodesic params for an Ellipsoid definition

 \param name text string identifying an Ellipsoid definition.
 \param a on completion this variable will contain the first geodesic param.
 \param b on completion this variable will contain the second geodesic param.
 \param rf on completion this variable will contain the third geodesic param.

 \return 0 on failure: any other value on success.

 \sa gaiaGreatCircleDistance, gaiaGeodesicDistance,
 gaiaGreatCircleTotalLength, gaiaGeodesicTotalLength

 \note supported Ellipsoid definitions are: \b MERIT, \b SGS85, \b GRS80,
 \b IAU76, \b airy, \b APL4.9, \b NWL9D, \b mod_airy, \b andrae, \b aust_SA,
 \b GRS67, \b bessel, \b bess_nam, \b clrk66, \b clrk80, \b CPM, \b delmbr, 
 \b engelis, \b evrst30, \b evrst48, \b evrst56, \b evrst69, \b evrstSS, 
 \b fschr60
 */
    GAIAGEO_DECLARE int gaiaEllipseParams (const char *name, double *a,
					   double *b, double *rf);

/**
 Calculates the Great Circle Distance between between two Points

 \param a first geodesic parameter.
 \param b second geodesic parameter.
 \param lat1 Latitude of first Point.
 \param lon1 Longitude of first Point.
 \param lat2 Latitude of second Point.
 \param lon2 Longitude of second Point.

 \return the calculated Great Circle Distance.
 
 \sa gaiaEllipseParams, gaiaGeodesicDistance,
 gaiaGreatCircleTotalLength, gaiaGeodesicTotalLength

 \note the returned distance is expressed in Kilometers.
 \n the Great Circle method is less accurate but fastest to be calculated.
 */
    GAIAGEO_DECLARE double gaiaGreatCircleDistance (double a, double b,
						    double lat1, double lon1,
						    double lat2, double lon2);

/**
 Calculates the Geodesic Distance between between two Points

 \param a first geodesic parameter.
 \param b second geodesic parameter.
 \param rf third geodesic parameter.
 \param lat1 Latitude of first Point.
 \param lon1 Longitude of first Point.
 \param lat2 Latitude of second Point.
 \param lon2 Longitude of second Point.

 \return the calculated Geodesic Distance.

 \sa gaiaEllipseParams, gaiaGreatCircleDistance, gaiaGreatCircleTotalLength,
 gaiaGeodesicTotalLength

 \note the returned distance is expressed in Kilometers.
 \n the Geodesic method is much more accurate but slowest to be calculated.
 */
    GAIAGEO_DECLARE double gaiaGeodesicDistance (double a, double b, double rf,
						 double lat1, double lon1,
						 double lat2, double lon2);

/**
 Calculates the Great Circle Total Length for a Linestring / Ring

 \param a first geodesic parameter.
 \param b second geodesic parameter.
 \param dims dimensions: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M or GAIA_XY_ZM
 \param coords pointed to COORD mem-array
 \param vert number of Points (aka Vertices) within the COORD mem-array

 \return the calculated Great Circle Total Length.

 \sa gaiaEllipseParams, gaiaGreatCircleDistance, gaiaGeodesicDistance,
 gaiaGeodesicTotalLength

 \note the returned length is expressed in Kilometers.
 \n the Great Circle method is less accurate but fastest to be calculated.
 \n \b dims, \b coords and \b vert are usually expected to correspond to
 \b DimensionModel, \b Coords and \b Points members from a gaiaLinestringStruct
 or gaiaRingStruct
 */
    GAIAGEO_DECLARE double gaiaGreatCircleTotalLength (double a, double b,
						       int dims, double *coords,
						       int vert);

/**
 Calculates the Geodesic Total Length for a Linestring / Ring

 \param a first geodesic parameter.
 \param b second geodesic parameter.
 \param rf third geodesic parameter.
 \param dims dimensions: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M or GAIA_XY_ZM
 \param coords pointed to COORD mem-array
 \param vert number of Points (aka Vertices) within the COORD mem-array

 \return the calculated Geodesic Total Length.

 \sa gaiaEllipseParams, gaiaGreatCircleDistance, gaiaGeodesicDistance,
 gaiaGreatCircleTotalLength

 \note the returned length is expressed in Kilometers.
 \n the Geodesic method is much more accurate but slowest to be calculated.
 \n \b dims, \b coords and \b vert are usually expected to correspond to
 \b DimensionModel, \b Coords and \b Points members from a gaiaLinestringStruct
 or gaiaRingStruct
 */
    GAIAGEO_DECLARE double gaiaGeodesicTotalLength (double a, double b,
						    double rf, int dims,
						    double *coords, int vert);

/**
 Convert a Length from a Measure Unit to another

 \param value the length measure to be converted.
 \param unit_from original Measure Unit.
 \param unit_to converted Measure Unit.
 \param cvt on completion this variable will contain the converted length 
 measure. 

 \note supported Measu Units are: GAIA_KM, GAIA_M, GAIA_DM, GAIA_CM, GAIA_MM,
 GAIA_KMI, GAIA_IN, GAIA_FT, GAIA_YD, GAIA_MI, GAIA_FATH, GAIC_CH, GAIA_LINK,
 GAIA_US_IN, GAIA_US_FT, GAIA_US_YD, GAIA_US_CH, GAIA_US_MI, GAIA_IND_YD,
 GAIA_IND_FT, GAIA_IND_CH
 */
    GAIAGEO_DECLARE int gaiaConvertLength (double value, int unit_from,
					   int unit_to, double *cvt);

/**
 Creates a Circle (Linestring) Geometry

 \param center_x center point X coordinate.
 \param center_y center point Y coordinate.
 \param radius the circle's radius.
 \param step angular distance (in degrees) between points on the circumference.

 \sa gaiaMakeArc, gaiaMakeEllipse, gaiaMakeEllipticArc

 \note simply a convenience method defaulting to gaiaMakeEllipse
 with both axes set to radius value
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMakeCircle (double center_x,
						    double center_y,
						    double radius, double step);

/**
 Creates an Ellipse (Linestring) Geometry

 \param center_x center point X coordinate.
 \param center_y center point Y coordinate.
 \param x_axis the ellipses's X axis.
 \param y_axis the ellipses's Y axis.
 \param step angular distance (in degrees) between points on the ellipse.

 \sa gaiaMakeEllipticArc, gaiaMakeCircle, gaiaMakeArc
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMakeEllipse (double center_x,
						     double center_y,
						     double x_axis,
						     double y_axis,
						     double step);

/**
 Creates a Circular Arc (Linestring) Geometry

 \param center_x center point X coordinate.
 \param center_y center point Y coordinate.
 \param radius the circle's radius.
 \param start the start angle (in degrees).
 \param start the stop angle (in degrees).
 \param step angular distance (in degrees) between points on the circumference.

 \sa gaiaMakeCircle, gaiaMakeEllipse, gaiaMakeEllipticArc

 \note simply a convenience method defaulting to gaiaMakeEllipticArc
 with both axes set to radius value
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMakeArc (double center_x,
						 double center_y, double radius,
						 double start, double stop,
						 double step);

/**
 Creates an Elliptic Arc (Linestring) Geometry

 \param center_x center point X coordinate.
 \param center_y center point Y coordinate.
 \param x_axis the ellipses's X axis.
 \param y_axis the ellipses's Y axis.
 \param start the start angle (in degrees).
 \param start the stop angle (in degrees).
 \param step angular distance (in degrees) between points on the ellipse.

 \sa gaiaMakeCircle, gaiaMakeEllipse, gaiaMakeEllipticArc
 */
    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMakeEllipticArc (double center_x,
							 double center_y,
							 double x_axis,
							 double y_axis,
							 double start,
							 double stop,
							 double step);

#ifdef __cplusplus
}
#endif

#endif				/* _GG_CORE_H */