ST_Within

更新时间:
复制 MD 格式

Tests whether a scene object lies entirely within a meshgeom object.

Syntax

bool ST_Within(scene sc, meshgeom geom);

Parameters

ParameterTypeDescription
scsceneThe scene object to test.
geommeshgeomThe meshgeom object that must contain sc.

Return value

Returns bool.

  • Returns true if sc lies entirely inside geom.

  • Returns false if sc is only partially inside geom.

  • Returns false if geom is empty.

Description

ST_Within tests whether every point of a scene object lies inside a meshgeom object. It is the inverse of ST_Contains.

Examples

The following example tests whether a 3D sphere is fully contained within an extruded and translated polygon box.

SELECT ST_Within(
  ST_3DSphere(0.5, 1),
  ST_Translate(ST_Extrude('Polygon((-1 -1, 1 -1, 1 1, -1 1, -1 -1))', 2), 0, 0, -1));

Result:

--------
 t

See also

  • ST_Contains — tests whether a meshgeom object contains a scene object; the inverse of ST_Within