ST_Within

Updated at:

Returns true if a scene object is completely inside a meshgeom object.

Syntax

bool ST_Within(scene sc, meshgeom geom)

Parameters

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

Return value

Returns bool.

  • Returns true if sc is completely inside geom.

  • Returns false if sc is only partially inside geom.

  • Returns false if geom is empty.

Usage notes

ST_Within(A, B) is equivalent to ST_Contains(B, A). The two functions are the inverse of each other.

Example

The following example tests whether a sphere is completely inside an extruded 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:

 st_within
-----------
 t