aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/GLAnchorPoint.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/GLAnchorPoint.js')
-rw-r--r--js/helper-classes/RDGE/GLAnchorPoint.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/js/helper-classes/RDGE/GLAnchorPoint.js b/js/helper-classes/RDGE/GLAnchorPoint.js
index 6b4af072..716f59d4 100644
--- a/js/helper-classes/RDGE/GLAnchorPoint.js
+++ b/js/helper-classes/RDGE/GLAnchorPoint.js
@@ -55,6 +55,11 @@ GLAnchorPoint.prototype.setNextFromPrev = function () {
55 55
56//translate the next point from the translation that was applied to the prev. point 56//translate the next point from the translation that was applied to the prev. point
57GLAnchorPoint.prototype.translateNextFromPrev = function (tx, ty, tz) { 57GLAnchorPoint.prototype.translateNextFromPrev = function (tx, ty, tz) {
58 //do nothing if the total translation is zero
59 var totalTransSq = (tx*tx) + (ty*ty) + (tz*tz);
60 if (totalTransSq < 0.0000001)
61 return;
62
58 // *** compute the rotation of the prev vector *** 63 // *** compute the rotation of the prev vector ***
59 var oldP = Vector.create([this._prevX + tx - this._x, this._prevY + ty - this._y, this._prevZ + tz - this._z]); 64 var oldP = Vector.create([this._prevX + tx - this._x, this._prevY + ty - this._y, this._prevZ + tz - this._z]);
60 var newP = Vector.create([this._prevX - this._x, this._prevY - this._y, this._prevZ - this._z]); 65 var newP = Vector.create([this._prevX - this._x, this._prevY - this._y, this._prevZ - this._z]);
@@ -71,6 +76,7 @@ GLAnchorPoint.prototype.translateNextFromPrev = function (tx, ty, tz) {
71 76
72 //TEMP for some situations the axis angle computation returns NaNs 77 //TEMP for some situations the axis angle computation returns NaNs
73 if (isNaN(newN[0]) || isNaN(newN[1]) || isNaN(newN[2])) { 78 if (isNaN(newN[0]) || isNaN(newN[1]) || isNaN(newN[2])) {
79 console.log("NaN in translateNextFromPrev");
74 return; 80 return;
75 } 81 }
76 //end TEMP 82 //end TEMP
@@ -80,6 +86,11 @@ GLAnchorPoint.prototype.translateNextFromPrev = function (tx, ty, tz) {
80} 86}
81//translate the next point from the translation that was applied to the prev. point 87//translate the next point from the translation that was applied to the prev. point
82GLAnchorPoint.prototype.translatePrevFromNext = function (tx, ty, tz) { 88GLAnchorPoint.prototype.translatePrevFromNext = function (tx, ty, tz) {
89 //do nothing if the total translation is zero
90 var totalTransSq = (tx*tx) + (ty*ty) + (tz*tz);
91 if (totalTransSq < 0.0000001)
92 return;
93
83 // *** compute the rotation of the next vector *** 94 // *** compute the rotation of the next vector ***
84 var oldN = Vector.create([this._nextX + tx - this._x, this._nextY + ty - this._y, this._nextZ + tz - this._z]); 95 var oldN = Vector.create([this._nextX + tx - this._x, this._nextY + ty - this._y, this._nextZ + tz - this._z]);
85 var newN = Vector.create([this._nextX - this._x, this._nextY - this._y, this._nextZ - this._z]); 96 var newN = Vector.create([this._nextX - this._x, this._nextY - this._y, this._nextZ - this._z]);