Skip to content

Commit

Permalink
Check equality instead of distances.
Browse files Browse the repository at this point in the history
Removed the threshold field. Related #31.
  • Loading branch information
vanruesc committed Feb 6, 2019
1 parent 64c9a6f commit 08bbd39
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/points/PointOctree.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function fetch(point, octree, octant) {

for(i = 0, l = points.length; result === null && i < l; ++i) {

if(point.distanceToSquared(points[i]) <= octree.threshold) {
if(point.equals(points[i])) {

result = octant.data[i];

Expand Down Expand Up @@ -286,7 +286,7 @@ function move(point, position, octree, octant, parent, depth) {

for(i = 0, l = points.length; i < l; ++i) {

if(point.distanceToSquared(points[i]) <= octree.threshold) {
if(point.equals(points[i])) {

// The point exists! Update its position.
points[i].copy(position);
Expand Down Expand Up @@ -480,10 +480,9 @@ export class PointOctree extends Octree {
* @param {Number} [bias=0.0] - An octant boundary bias.
* @param {Number} [maxPoints=8] - Number of distinct points per octant before it splits up.
* @param {Number} [maxDepth=8] - The maximum tree depth level, starting at 0.
* @param {Number} [threshold=1e-6] - Threshold for equality in move and fetch
*/

constructor(min, max, bias = 0.0, maxPoints = 8, maxDepth = 8, threshold = 1e-6) {
constructor(min, max, bias = 0.0, maxPoints = 8, maxDepth = 8) {

super();

Expand Down Expand Up @@ -532,14 +531,6 @@ export class PointOctree extends Octree {

this.maxDepth = Math.max(0, Math.round(maxDepth));

/**
* A threshold for distance comparisons.
*
* @type {Number}
*/

this.threshold = threshold;

/**
* The amount of points that are currently in this octree.
*
Expand Down

0 comments on commit 08bbd39

Please sign in to comment.