MESHGEOM is a 3D mesh geometry format used in PolarDB for Oracle. It organizes data in two layers:
Geometry topology — defined by
PATCH, which holds one or more geometry objects.Vertex attributes — defined by
NORMALandTEXCOORD, which attach normal vectors and texture coordinates to the vertices in a patch.
The following example shows all three keywords together:
-- A triangle strip with normal vectors and texture coordinates
MESHGEOM(
PATCH(
TRIANGLESTRIP(0 0 1, 0 10 2, 10 10 3, 10 0 4)
),
NORMAL(
(0 0 0, 1 1 1, 2 2 2, 3 3 3)
),
TEXCOORD(
(0 0, 1 1, 2 2, 3 3)
)
)Keywords
The following table summarizes the three keywords and their format requirements:
| Keyword | Data | Coordinate dimensions | Format | Constraint |
|---|---|---|---|---|
PATCH | One or more geometry objects | Determined by geometry type | Geometries separated by commas (,) inside PATCH(...) | All patches in the same MESHGEOM must use the same dimensions |
NORMAL | Normal vectors for 3D points | 3D (X Y Z) | Points separated by commas (,); each geometry object enclosed in () | Point count must equal the vertex count in the patch |
TEXCOORD | Texture coordinates for 2D points | 2D, with optional Z and M dimensions | Points separated by commas (,); each geometry object enclosed in () | Point count must equal the vertex count in the patch |
PATCH
PATCH holds one or more geometry objects. Separate multiple geometries with commas (,).
The following geometry types are supported:
| Type | Description |
|---|---|
Point | A single point in 2D or 3D space. |
LineString | A sequence of points connected by line segments. |
Polygon | A closed ring of line segments forming a planar surface. |
MultiPoint | A collection of points. |
MultiLineString | A collection of line strings. |
MultiPolygon | A collection of polygons. |
IndexSurface | A surface defined by a vertex list (VERTEX) and an index list (INDEX) that specifies how vertices are connected into faces. Useful when vertices are shared across multiple faces. |
TriangleStrip | A sequence of triangles where each new vertex, together with the two preceding vertices, forms the next triangle. Vertices are shared between adjacent triangles. |
TriangleFan | A sequence of triangles that all share a common center vertex. Each new vertex, together with the center vertex and the previous vertex, forms the next triangle. |
Example: two patches (Point and IndexSurface)
MESHGEOM(
PATCH(
POINT(0 0 1),
INDEXSURFACE(VERTEX(0 0 1, 0 10 2, 10 10 3, 10 0 4), INDEX((0,1,2),(1,2,3)))
)
)NORMAL
NORMAL contains a set of normal vectors for the 3D vertices in the patch. Points are separated by commas (,), and each geometry object is enclosed in parentheses ().
The number of points in NORMAL must equal the number of vertices in the patch.
TEXCOORD
TEXCOORD contains a set of texture coordinates for the 2D vertices in the patch. Points are separated by commas (,), and each geometry object is enclosed in parentheses ().
The number of points in TEXCOORD must equal the number of vertices in the patch.
TEXCOORD also supports the Z and M dimensions. All patches in a MESHGEOM must use the same dimensions.
Example: M dimension
MESHGEOM(
PATCH(
POINT M(0 0 1),
INDEXSURFACE M(VERTEX(0 0 1, 0 10 2, 10 10 3, 10 0 4), INDEX((0,1,2),(1,2,3)))
)
)Reference another MESHGEOM object
MESHGEOM can reference another MESHGEOM object stored in a table. Use the following keywords to identify the target object:
| Keyword | Required | Description |
|---|---|---|
schema | No | Schema name. |
table | Yes | Table name. |
column | Yes | Column name. |
key | Yes | WHERE clause that identifies the row. |
Enclose each value in at signs (@).
Format
MESHGEOM(
schema(@schema_name@),
table(@table_name@),
column(@column_name@),
key(@where_clause@)
)Example
MESHGEOM(
schema(@public@),
table(@mytable@),
column(@mycolumn@),
key(@id=1@)
)