diff --git a/src/polypartition.cpp b/src/polypartition.cpp index cf7f87f..d4d5fa0 100644 --- a/src/polypartition.cpp +++ b/src/polypartition.cpp @@ -118,7 +118,7 @@ TPPLPartition::PartitionVertex::PartitionVertex() : TPPLPoint TPPLPartition::Normalize(const TPPLPoint &p) { TPPLPoint r; - tppl_float n = sqrt(p.x * p.x + p.y * p.y); + tppl_float n = tppl_sqrt(p.x * p.x + p.y * p.y); if (n != 0) { r = p / n; } else { @@ -132,7 +132,7 @@ tppl_float TPPLPartition::Distance(const TPPLPoint &p1, const TPPLPoint &p2) { tppl_float dx, dy; dx = p2.x - p1.x; dy = p2.y - p1.y; - return (sqrt(dx * dx + dy * dy)); + return (tppl_sqrt(dx * dx + dy * dy)); } // Checks if two lines intersect. diff --git a/src/polypartition.h b/src/polypartition.h index f163f5d..110b560 100644 --- a/src/polypartition.h +++ b/src/polypartition.h @@ -27,7 +27,12 @@ #include #include -typedef double tppl_float; +#ifndef tppl_float +#define tppl_float double +#endif +#ifndef tppl_sqrt +#define tppl_sqrt sqrt +#endif enum TPPLOrientation { TPPL_ORIENTATION_CW = -1,