From 76abbaafb0d90bb1dc9c63a5a5a78ab95bb00420 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Mon, 30 Jan 2012 13:56:33 -0800 Subject: Merge pushkar branch on gerritt with github version --- js/helper-classes/RDGE/GLBrushStroke.js | 1 - js/helper-classes/RDGE/GLSubpath.js | 39 ++++++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) (limited to 'js/helper-classes') diff --git a/js/helper-classes/RDGE/GLBrushStroke.js b/js/helper-classes/RDGE/GLBrushStroke.js index 89292ad8..f9ed6619 100644 --- a/js/helper-classes/RDGE/GLBrushStroke.js +++ b/js/helper-classes/RDGE/GLBrushStroke.js @@ -6,7 +6,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var VecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; - /////////////////////////////////////////////////////////////////////// // Class GLBrushStroke // representation a sequence points (polyline) created by brush tool. diff --git a/js/helper-classes/RDGE/GLSubpath.js b/js/helper-classes/RDGE/GLSubpath.js index 25b12093..79940e06 100644 --- a/js/helper-classes/RDGE/GLSubpath.js +++ b/js/helper-classes/RDGE/GLSubpath.js @@ -155,6 +155,32 @@ function GLSubpath() { return retAnchor; } + this.deselectAnchorPoint = function(){ + this._selectedAnchorIndex = -1; + } + + this.reversePath = function() { + var revAnchors = []; + var numAnchors = this._Anchors.length; + var lastIndex = numAnchors-1; + if (lastIndex<0){ + return; //cannot reverse empty path + } + for (var i=lastIndex;i>=0;i--) { + var newAnchor = new GLAnchorPoint(); + var oldAnchor = this._Anchors[i]; + newAnchor.setPos(oldAnchor.getPosX(),oldAnchor.getPosY(),oldAnchor.getPosZ()); + newAnchor.setPrevPos(oldAnchor.getNextX(),oldAnchor.getNextY(),oldAnchor.getNextZ()); + newAnchor.setNextPos(oldAnchor.getPrevX(),oldAnchor.getPrevY(),oldAnchor.getPrevZ()); + revAnchors.push(newAnchor); + } + if (this._selectedAnchorIndex >= 0){ + this._selectedAnchorIndex = (numAnchors-1) - this._selectedAnchorIndex; + } + this._Anchors = revAnchors; + this._dirty=true; + } + //remove all the anchor points this.clearAllAnchors = function () { this._Anchors = []; @@ -220,7 +246,10 @@ function GLSubpath() { //check whether the point is within the radius distance from the curve represented as a polyline in _samples //return the parametric distance along the curve if there is an intersection, else return null //will assume that the BBox test is performed outside this function - + if (endIndex