BrunoLevy / geogram

a programming library with geometric algorithms
Other
1.87k stars 126 forks source link

PSM Predicates: orient_2d() signature #142

Closed glennDittmann closed 7 months ago

glennDittmann commented 7 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 7 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 7 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!