163{
164 const GSERIALIZED *g1 = shared_gserialized_get(shared_g1);
165 const GSERIALIZED *g2 = shared_gserialized_get(shared_g2);
167
170
172
173
176
177
179
180
181
182 if ( tree_cache && tree_cache->
gcache.argnum && tree_cache->
index )
183 {
189 int geomtype_cached;
190 int geomtype;
192
193
194 if ( tree_cache->
gcache.argnum == 1 )
195 {
196 g_cached = g1;
197 g = g2;
198 geomtype_cached = type1;
199 geomtype = type2;
200 }
201 else if ( tree_cache->
gcache.argnum == 2 )
202 {
203 g_cached = g2;
204 g = g1;
205 geomtype_cached = type2;
206 geomtype = type1;
207 }
208 else
209 {
210 lwpgerror("geography_distance_cache this cannot happen!");
212 }
213
216 {
218 if (
CircTreePIP(circtree_cached, g_cached, &p4d) )
219 {
223 }
224 }
225
228 {
234 {
239 }
240 }
241
246 }
247 else
248 {
250 }
251}
static CircTreeGeomCache * GetCircTreeGeomCache(FunctionCallInfo fcinfo, SHARED_GSERIALIZED *g1, SHARED_GSERIALIZED *g2)
static int CircTreePIP(const CIRC_NODE *tree1, const GSERIALIZED *g1, const POINT4D *in_point)
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
int lwgeom_startpoint(const LWGEOM *lwgeom, POINT4D *pt)
void lwgeom_free(LWGEOM *geom)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
double circ_tree_distance_tree(const CIRC_NODE *n1, const CIRC_NODE *n2, const SPHEROID *spheroid, double threshold)
CIRC_NODE * lwgeom_calculate_circ_tree(const LWGEOM *lwgeom)
int circ_tree_get_point(const CIRC_NODE *node, POINT2D *pt)
Returns a POINT2D that is a vertex of the input shape.
void circ_tree_free(CIRC_NODE *node)
Recurse from top of node tree and free all children.
static double distance(double x1, double y1, double x2, double y2)
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.