29.14 SDO_PC_PKG.SDO_PC_NN

Format

SDO_PC_PKG.SDO_PC_NN(
     pc     IN SDO_PC, 
     center IN SDO_GEOMETRY, 
     n      IN NUMBER 
     ) RETURN BLOB;

Description

Returns the nearest n points in the input point cloud object to the specified 3D point.

Parameters

pc

Point cloud object of type SDO_PC.

center

A 3D point representing the center around which we are looking for the nearest N points.

n

The number of nearest points to be found.

Usage Notes

The SDO_PC data type is described in Point Cloud-Related Object Types.

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

Examples

The following example returns the 3200 closest points from a specified “center” point within a specified point cloud object.

select
  rownum pt_pos,
  sdo_geometry(
    3001,
    null,
    sdo_point_type(x, y, z),
    null,
    null) pts
from
  table(
    sdo_util.getvertices(
      geometry => sdo_pc_pkg.to_geometry(
                    pts => sdo_pc_pkg.sdo_pc_nn(
                             pc     => (select pc from pcs where id = 1),
                             center => sdo_geometry(
                                         3001,
                                         null,
                                         sdo_point_type(15, 15, 30),
                                         null,
                                         null),
                             n      => 3200),
                    num_pts    => 3200,
                    pc_tot_dim => 3,
                    srid       => null,
                    blk_domain => null,
                    get_ids    => 1)))
order by
  sqrt(
    (x - 15) * (x - 15) +
    (y - 15) * (y - 15) +
    (z - 30) * (z - 30)),
  x,
  y,
  z;

    PT_POS
----------
PTS(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
         1
SDO_GEOMETRY(3001, NULL, SDO_POINT_TYPE(15, 15, 30), NULL, NULL)

         2
SDO_GEOMETRY(3001, NULL, SDO_POINT_TYPE(15, 15, 30), NULL, NULL)

         4
SDO_GEOMETRY(3001, NULL, SDO_POINT_TYPE(14, 15, 29), NULL, NULL)

        10
SDO_GEOMETRY(3001, NULL, SDO_POINT_TYPE(14, 15, 29), NULL, NULL)

         5
SDO_GEOMETRY(3001, NULL, SDO_POINT_TYPE(14, 16, 30), NULL, NULL)

        11
SDO_GEOMETRY(3001, NULL, SDO_POINT_TYPE(14, 16, 30), NULL, NULL)

         3
SDO_GEOMETRY(3001, NULL, SDO_POINT_TYPE(15, 14, 29), NULL, NULL)

...

      3200
SDO_GEOMETRY(3001, NULL, SDO_POINT_TYPE(33, 28, 61), NULL, NULL)

      3199
SDO_GEOMETRY(3001, NULL, SDO_POINT_TYPE(46, 2, 48), NULL, NULL)


3200 rows selected.

Elapsed: 00:00:15.57