BrunoLevy / geogram

a programming library with geometric algorithms
Other
1.8k stars 122 forks source link

PSM Predicates: orient_2d() signature #142

Closed glennDittmann closed 5 months ago

glennDittmann commented 5 months ago

Hello, first of all thanks for the library, the concept of the PSM is really cool!

I have generated the predicates PSM and it is working fine so far.

However, the method

GEO::PCK::orient_2d(const double *p0, const double *p1, const double *p2)

only exists with parameters as three doubles (the 2 overloading functions did not get generated).

How is the signature meant? How can I interpret a triangle with 3 doubles? Am I missing something obvious?

BrunoLevy commented 5 months ago

It is three pointers to doubles. Your points are supposed to be stored as contiguous arrays of doubles. For instance, you can use `orient_2d() as follows:

   double p1[2];
   double p2[2];
   double p3[2];
   ...
   Sign s = GEO::PCK::orient_2d(p1,p2,p3);
   ...

Hope this helps, Best, -- B

glennDittmann commented 5 months ago

Fairly unexperienced with c++ and didn't know const double *p0 can also point to an array of doubles. Now that makes sense, thanks!