29.15 SDO_PC_PKG.SDO_PC_NN_FOR_EACH

Format

SDO_PC_PKG.SDO_PC_NN_FOR_EACH(
     blocks     IN SIMPLE_BLK_REF, 
     pc          IN SDO_PC, 
     n           IN NUMBER, 
     max_dist    IN NUMBER, 
     qry_min_res IN NUMBER, 
     qry_max_res IN NUMBER 
     ) RETURN POINT_NEIGHBOR_PAIR_TAB;

Description

Returns the nearest n points, for each point within a query range.

Parameters

blocks

A table of PC blocks, individual query windows, and non-spatial query constraints.

pc

Point cloud object of type SDO_PC.

n

Number of nearest points to find for each point in the query range.

max_dist

Maximum distance to check for neighbors.

qry_min_res

Minimum pyramid level for point clouds with pyramids. (As shown in the Example, different query windows (closer to or farther from the beholder) can be used for different pyramid levels.

qry_max_res

Maximum pyramid level for point clouds with pyramids. (As shown in the Example, different query windows (closer to or farther from the beholder) can be used for different pyramid levels.

Usage Notes

The types related to this function are defined as follows.

TYPE SIMPLE_BLK_REF is RECORD (
  blk_id        number,
  ind_dim_qry   MDSYS.sdo_geometry,
  other_dim_qry MDSYS.sdo_mbr);

TYPE POINT_NEIGHBOR_PAIR_ROW is RECORD (
  obj_id          number,
  blk_id          number,
  pt_id           number,
  pt_x            number,
  pt_y            number,
  pt_z            number,
  neighbor_rank   number,
  neighbor_dist   number,
  neighbor_blk_id number,
  neighbor_pt_id  number,
  neighbor_x      number,
  neighbor_y      number,
  neighbor_z      number);

TYPE POINT_NEIGHBOR_PAIR_TAB is TABLE of POINT_NEIGHBOR_PAIR_ROW;

Modeling Solids describes how to use point clouds to model solids.

Examples

The following example returns the nearest 10 points, for each point within the specified query range.

define query_window = SDO_GEOMETRY(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,3),SDO_ORDINATE_ARRAY(100,100,102,102));

with
  candidates AS (
    select
      blocks.blk_id,
      SDO_GEOM.SDO_INTERSECTION(subqueries.ind_dim_qry, blocks.blk_extent, 0.05),
      subqueries.other_dim_qry
    from
      blocks blocks,
      (
        select 1 min_res, 1 max_res, &query_window ind_dim_qry, cast(null as sdo_mbr) other_dim_qry from dual union all
        select 2 min_res, 5 max_res, &query_window ind_dim_qry, cast(null as sdo_mbr) other_dim_qry from dual
      ) subqueries
    where
      blocks.obj_id = 1 and
      blocks.pcblk_min_res <= max_res and
      blocks.pcblk_max_res >= min_res and
      SDO_ANYINTERACT(blocks.blk_extent, subqueries.ind_dim_qry) = 'TRUE')
select /*+ parallel (2) */
  *
from
  table(
    sdo_pc_pkg.sdo_pc_nn_for_each(
      blocks      => cursor(select * from candidates),
      pc          => (select pc from pcs where id = 1),
      n           => 10,
      max_dist    => 10,
      qry_min_res => 1,
      qry_max_res => 1))
order by
  obj_id,
  blk_id,
  pt_id,
  neighbor_rank;

old  10:         select 1 min_res, 1 max_res, &query_window ind_dim_qry, cast(null as sdo_mbr) other_dim_qry from dual union all
new  10:         select 1 min_res, 1 max_res, SDO_GEOMETRY(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,3),SDO_ORDINATE_ARRAY(100,100,102,102)) ind_dim_qry, cast(null as sdo_mbr) other_dim_qry from dual union all
old  11:         select 2 min_res, 5 max_res, &query_window ind_dim_qry, cast(null as sdo_mbr) other_dim_qry from dual
new  11:         select 2 min_res, 5 max_res, SDO_GEOMETRY(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,3),SDO_ORDINATE_ARRAY(100,100,102,102)) ind_dim_qry, cast(null as sdo_mbr) other_dim_qry from dual

    OBJ_ID     BLK_ID      PT_ID       PT_X       PT_Y       PT_Z NEIGHBOR_RANK NEIGHBOR_DIST NEIGHBOR_BLK_ID NEIGHBOR_PT_ID NEIGHBOR_X NEIGHBOR_Y NEIGHBOR_Z
---------- ---------- ---------- ---------- ---------- ---------- ------------- ------------- --------------- -------------- ---------- ---------- ----------
         1          2        272        100        100        200             1             0               2            272        100        100        200
         1          2        272        100        100        200             2    1.41421356               2            268         99        101        200
         1          2        272        100        100        200             3    1.41421356               2            271         99        100        199
         1          2        272        100        100        200             4    1.41421356               2            293        100         99        199
         1          2        272        100        100        200             5    1.41421356               2            275        100        101        201
         1          2        272        100        100        200             6    1.41421356               2            273        101        100        201
         1          2        272        100        100        200             7    1.41421356               2            292        101         99        200
         1          2        272        100        100        200             8    2.44948974               2            269         98        101        199
         1          2        272        100        100        200             9    2.44948974               2            250         99         99        198
         1          2        272        100        100        200            10    2.44948974               2            267         99        102        201
         1          2        273        101        100        201             1             0               2            273        101        100        201
         1          2        273        101        100        201             2    1.41421356               2            272        100        100        200
         1          2        273        101        100        201             3    1.41421356               2            275        100        101        201
         1          2        273        101        100        201             4    1.41421356               2            292        101         99        200
         1          2        273        101        100        201             5    1.41421356               2            274        101        101        202
         1          2        273        101        100        201             6    1.41421356               2            291        102         99        201
         1          2        273        101        100        201             7    1.41421356               2            286        102        100        202
         1          2        273        101        100        201             8    2.44948974               2            268         99        101        200
         1          2        273        101        100        201             9    2.44948974               2            293        100         99        199
         1          2        273        101        100        201            10    2.44948974               2            276        100        102        202
         1          2        274        101        101        202             1             0               2            274        101        101        202
         1          2        274        101        101        202             2    1.41421356               2            276        100        102        202
         1          2        274        101        101        202             3    1.41421356               2            275        100        101        201
         1          2        274        101        101        202             4    1.41421356               2            273        101        100        201
         1          2        274        101        101        202             5    1.41421356               2            279        101        102        203
         1          2        274        101        101        202             6    1.41421356               2            286        102        100        202
         1          2        274        101        101        202             7    1.41421356               2            285        102        101        203
         1          2        274        101        101        202             8    2.44948974               2            267         99        102        201
         1          2        274        101        101        202             9    2.44948974               2            272        100        100        200
         1          2        274        101        101        202            10    2.44948974               2            277        100        103        203
         1          2        275        100        101        201             1             0               2            275        100        101        201
         1          2        275        100        101        201             2    1.41421356               2            267         99        102        201
         1          2        275        100        101        201             3    1.41421356               2            268         99        101        200
         1          2        275        100        101        201             4    1.41421356               2            272        100        100        200
         1          2        275        100        101        201             5    1.41421356               2            276        100        102        202
         1          2        275        100        101        201             6    1.41421356               2            273        101        100        201
         1          2        275        100        101        201             7    1.41421356               2            274        101        101        202
         1          2        275        100        101        201             8    2.44948974               2            264         98        102        200
         1          2        275        100        101        201             9    2.44948974               2            266         99        103        202
         1          2        275        100        101        201            10    2.44948974               2            271         99        100        199
         1          2        276        100        102        202             1             0               2            276        100        102        202
         1          2        276        100        102        202             2    1.41421356               2            266         99        103        202
         1          2        276        100        102        202             3    1.41421356               2            267         99        102        201
         1          2        276        100        102        202             4    1.41421356               2            277        100        103        203
         1          2        276        100        102        202             5    1.41421356               2            275        100        101        201
         1          2        276        100        102        202             6    1.41421356               2            274        101        101        202
         1          2        276        100        102        202             7    1.41421356               2            279        101        102        203
         1          2        276        100        102        202             8    2.44948974               2            265         98        103        201
         1          2        276        100        102        202             9    2.44948974               2            469         99        104        203
         1          2        276        100        102        202            10    2.44948974               2            268         99        101        200
         1          2        279        101        102        203             1             0               2            279        101        102        203
         1          2        279        101        102        203             2    1.41421356               2            277        100        103        203
         1          2        279        101        102        203             3    1.41421356               2            276        100        102        202
         1          2        279        101        102        203             4    1.41421356               2            274        101        101        202
         1          2        279        101        102        203             5    1.41421356               2            278        101        103        204
         1          2        279        101        102        203             6    1.41421356               2            280        102        102        204
         1          2        279        101        102        203             7    1.41421356               2            285        102        101        203
         1          2        279        101        102        203             8    2.44948974               2            266         99        103        202
         1          2        279        101        102        203             9    2.44948974               2            458        100        104        204
         1          2        279        101        102        203            10    2.44948974               2            275        100        101        201
         1          2        280        102        102        204             1             0               2            280        102        102        204
         1          2        280        102        102        204             2    1.41421356               2            278        101        103        204
         1          2        280        102        102        204             3    1.41421356               2            279        101        102        203
         1          2        280        102        102        204             4    1.41421356               2            285        102        101        203
         1          2        280        102        102        204             5    1.41421356               2            281        102        103        205
         1          2        280        102        102        204             6    1.41421356               2            283        103        102        205
         1          2        280        102        102        204             7    1.41421356               2            284        103        101        204
         1          2        280        102        102        204             8    2.44948974               2            277        100        103        203
         1          2        280        102        102        204             9    2.44948974               2            457        101        104        205
         1          2        280        102        102        204            10    2.44948974               2            274        101        101        202
         1          2        285        102        101        203             1             0               2            285        102        101        203
         1          2        285        102        101        203             2    1.41421356               2            274        101        101        202
         1          2        285        102        101        203             3    1.41421356               2            279        101        102        203
         1          2        285        102        101        203             4    1.41421356               2            280        102        102        204
         1          2        285        102        101        203             5    1.41421356               2            286        102        100        202
         1          2        285        102        101        203             6    1.41421356               2            284        103        101        204
         1          2        285        102        101        203             7    1.41421356               2            287        103        100        203
         1          2        285        102        101        203             8    2.44948974               2            276        100        102        202
         1          2        285        102        101        203             9    2.44948974               2            273        101        100        201
         1          2        285        102        101        203            10    2.44948974               2            278        101        103        204
         1          2        286        102        100        202             1             0               2            286        102        100        202
         1          2        286        102        100        202             2    1.41421356               2            273        101        100        201
         1          2        286        102        100        202             3    1.41421356               2            274        101        101        202
         1          2        286        102        100        202             4    1.41421356               2            291        102         99        201
         1          2        286        102        100        202             5    1.41421356               2            285        102        101        203
         1          2        286        102        100        202             6    1.41421356               2            287        103        100        203
         1          2        286        102        100        202             7    1.41421356               2            288        103         99        202
         1          2        286        102        100        202             8    2.44948974               2            275        100        101        201
         1          2        286        102        100        202             9    2.44948974               2            292        101         99        200
         1          2        286        102        100        202            10    2.44948974               2            279        101        102        203

90 rows selected.

Elapsed: 00:00:03.02