public class Octree extends Object
| 限定符和类型 | 类和说明 |
|---|---|
class |
Octree.OctreeNode
The octree node in the 3d space.
|
| 限定符和类型 | 字段和说明 |
|---|---|
protected static int |
MAX_DEPTH
the max depth of this tree,
theoretically it shall be less than 21, because every three bits in a Long-type
octree-node index is used to locate its position of siblings.
|
protected Map<Long,Octree.OctreeNode> |
octreeIndices
used to find an octree node by its index
the index of an octree node is generated according to its spatial position
|
protected List<javax.vecmath.Point3d> |
points |
protected Octree.OctreeNode |
root
the root node of the octree,
the size of root node is the bounding box of point cloud
|
| 构造器和说明 |
|---|
Octree() |
| 限定符和类型 | 方法和说明 |
|---|---|
List<Octree.OctreeNode> |
adjacentNodes(Long nodeIndex,
Adjacency adjacency)
search adjacent nodes of an octree node
|
void |
buildIndex(List<javax.vecmath.Point3d> points)
build spatial index for point cloud
note that the length double array in List points must be 3
|
protected void |
createOctree(int currentDepth,
Octree.OctreeNode currentNode)
partition the space recursively
|
int |
getMaxPointsPerNode() |
protected Long |
locateOctreeNode(Octree.OctreeNode node,
javax.vecmath.Point3d point)
find the index of octree node in which the target point is located
|
List<Integer> |
searchAllNeighborsWithinDistance(int index,
double radius)
search all neighboring points of the point with specified index within distance
|
List<Integer> |
searchAllNeighborsWithinDistance(javax.vecmath.Point3d point,
double radius)
search all neighboring points of specified point within distance
|
int[] |
searchNearestNeighbors(int k,
int index)
If you want to acquire the k-nearest neighbors of a certain point p, call this function,
octree will decrease the time cost
|
int[] |
searchNearestNeighbors(int k,
javax.vecmath.Point3d point)
search k nearest neighbors for the point
|
void |
setMaxPointsPerNode(int m) |
protected Octree.OctreeNode root
protected List<javax.vecmath.Point3d> points
protected Map<Long,Octree.OctreeNode> octreeIndices
protected static final int MAX_DEPTH
public void buildIndex(List<javax.vecmath.Point3d> points)
points - the point cloudpublic int[] searchNearestNeighbors(int k,
int index)
k - the number of nearest neighborsindex - the index of point ppublic int[] searchNearestNeighbors(int k,
javax.vecmath.Point3d point)
k - the number of nearest neighbors, 0 <= k < points.size()point - the point, non-nullIllegalStateException - if previously forget to call buildIndex()IllegalArgumentException - if size of points is less than k + 1protected void createOctree(int currentDepth,
Octree.OctreeNode currentNode)
currentDepth - the depth of current octree nodecurrentNode - current octree nodeprotected Long locateOctreeNode(Octree.OctreeNode node, javax.vecmath.Point3d point)
node - the root octree nodepoint - the target pointpublic List<Integer> searchAllNeighborsWithinDistance(javax.vecmath.Point3d point, double radius)
point - the pointradius - the distancepublic List<Integer> searchAllNeighborsWithinDistance(int index, double radius)
index - the index of a pointradius - radius of neighborhoodpublic List<Octree.OctreeNode> adjacentNodes(Long nodeIndex, Adjacency adjacency)
nodeIndex - the index of octree nodeadjacency - see Adjacencypublic int getMaxPointsPerNode()
public void setMaxPointsPerNode(int m)
Copyright © 2019. All rights reserved.