57 if (support->
p1 != NULL)
59 if (support->
p2 != NULL)
61 if (support->
p3 != NULL)
72 case 0: support->
p1 = p;
74 case 1: support->
p2 = p;
76 case 2: support->
p3 = p;
97 det(
double m00,
double m01,
double m10,
double m11)
99 return m00 * m11 - m01 * m10;
107 double ax = a->
x - cx;
108 double ay = a->
y - cy;
109 double bx = b->
x - cx;
110 double by = b->
y - cy;
112 double denom = 2 *
det(ax, ay, bx, by);
113 double numx =
det(ay, ax * ax + ay * ay, by, bx * bx + by * by);
114 double numy =
det(ax, ax * ax + ay * ay, bx, bx * bx + by * by);
116 result->
x = cx - numx / denom;
117 result->
y = cy + numy / denom;
193 for (i = 0; i < max_n; i++)
254 for (i = 0; i < num_points; i++)
259 for (j = 0; j < i; j++)
282 for (i = 0; i < num_points; i++)
int lwpointiterator_next(LWPOINTITERATOR *s, POINT4D *p)
Attempts to assign the next point in the iterator to p, and advances the iterator to the next point...
static LWBOUNDINGCIRCLE * lwboundingcircle_create()
static int calculate_mbc(const POINT2D **points, uint32_t max_n, SUPPORTING_POINTS *support, LWBOUNDINGCIRCLE *mbc)
static void supporting_points_destroy(SUPPORTING_POINTS *s)
static int calculate_mbc_from_support(SUPPORTING_POINTS *support, LWBOUNDINGCIRCLE *mbc)
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
The old function nessecary for ptarray_segmentize2d in ptarray.c.
void lwboundingcircle_destroy(LWBOUNDINGCIRCLE *c)
LWPOINTITERATOR * lwpointiterator_create(const LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM*.
static int point_inside_circle(const POINT2D *p, const LWBOUNDINGCIRCLE *c)
void lwpointiterator_destroy(LWPOINTITERATOR *s)
Free all memory associated with the iterator.
static uint32_t num_supporting_points(SUPPORTING_POINTS *support)
#define LW_TRUE
Return types for functions with status returns.
LWBOUNDINGCIRCLE * lwgeom_calculate_mbc(const LWGEOM *g)
static double det(double m00, double m01, double m10, double m11)
static void calculate_mbc_3(const SUPPORTING_POINTS *support, LWBOUNDINGCIRCLE *mbc)
static void calculate_mbc_1(const SUPPORTING_POINTS *support, LWBOUNDINGCIRCLE *mbc)
static SUPPORTING_POINTS * supporting_points_create()
static void calculate_mbc_2(const SUPPORTING_POINTS *support, LWBOUNDINGCIRCLE *mbc)
static void circumcenter(const POINT2D *a, const POINT2D *b, const POINT2D *c, POINT2D *result)
static int add_supporting_point(SUPPORTING_POINTS *support, const POINT2D *p)
void * lwalloc(size_t size)
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
int lwgeom_count_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.