diff options
Diffstat (limited to 'js/helper-classes')
-rw-r--r-- | js/helper-classes/RDGE/GLSubpath.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/js/helper-classes/RDGE/GLSubpath.js b/js/helper-classes/RDGE/GLSubpath.js index 78315e40..2e4c1631 100644 --- a/js/helper-classes/RDGE/GLSubpath.js +++ b/js/helper-classes/RDGE/GLSubpath.js | |||
@@ -363,6 +363,23 @@ function GLSubpath() { | |||
363 | return true; | 363 | return true; |
364 | } | 364 | } |
365 | 365 | ||
366 | this.pickAnchor = function (pickX, pickY, pickZ, radius) { | ||
367 | var numAnchors = this._Anchors.length; | ||
368 | var selAnchorIndex = -1; | ||
369 | var retCode = this.SEL_NONE; | ||
370 | var radSq = radius * radius; | ||
371 | var minDistance = Infinity; | ||
372 | for (var i = 0; i < numAnchors; i++) { | ||
373 | var distSq = this._Anchors[i].getDistanceSq(pickX, pickY, pickZ); | ||
374 | //check the anchor point | ||
375 | if (distSq < minDistance && distSq < radSq) { | ||
376 | selAnchorIndex = i; | ||
377 | minDistance = distSq; | ||
378 | } | ||
379 | }//for every anchor i | ||
380 | return selAnchorIndex; | ||
381 | } | ||
382 | |||
366 | //pick the path point closest to the specified location, return null if some anchor point (or its handles) is within radius, else return the parameter distance | 383 | //pick the path point closest to the specified location, return null if some anchor point (or its handles) is within radius, else return the parameter distance |
367 | this.pickPath = function (pickX, pickY, pickZ, radius) { | 384 | this.pickPath = function (pickX, pickY, pickZ, radius) { |
368 | var numAnchors = this._Anchors.length; | 385 | var numAnchors = this._Anchors.length; |