/* <copyright>
This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
</copyright> */
// Todo: This shoudl be converted to a module
var VecUtils = require("js/helper-classes/3D/vec-utils").VecUtils;
function SubpathOffsetPoint(pos, mapPos) {
this.Pos = Vector.create([pos[0],pos[1],pos[2]]);
this.CurveMapPos = Vector.create([mapPos[0], mapPos[1], mapPos[2]]);
}
function SubpathOffsetTriangle(v0, v1, v2) {
this.v0 = v0;
this.v1 = v1;
this.v2 = v2;
this.n = Vector.create([0,0,1]); //replace with the actual cross product later
}
function sortNumberAscending(a,b){
return a-b;
}
function sortNumberDescending(a,b){
return b-a;
}
function SegmentIntersections(){
this.paramArray = [];
}
///////////////////////////////////////////////////////////////////////
// Class GLSubpath
// representation a sequence of cubic bezier curves.
// Derived from class GLGeomObj
///////////////////////////////////////////////////////////////////////
function GLSubpath() {
///////////////////////////////////////////////////
// Instance variables
///////////////////////////////////////////////////
this._Anchors = [];
this._BBoxMin = [0, 0, 0];
this._BBoxMax = [0, 0, 0];
this._isClosed = false;
this._samples = []; //polyline representation of this curve
this._sampleParam = []; //parametric distance of samples, within [0, N], where N is # of Bezier curves (=# of anchor points if closed, =#anchor pts -1 if open)
this._anchorSampleIndex = []; //index within _samples corresponding to anchor points
this._UnprojectedAnchors = [];
//offset path samples and the points on the input path they map to
this._offsetPointsLeft = [];
this._offsetPointsRight = [];
//triangles determined by the offset points
this._offsetTrianglesLeft = [];
this._offsetTrianglesRight = [];
//initially set the _dirty bit so we will construct samples
this._dirty = true;
//whether or not to use the canvas drawing to stroke/fill
this._useCanvasDrawing = true;
//the X and Y location of this subpath's canvas in stage world space of Ninja
this._canvasX = 0;
this._canvasY = 0;
//stroke information
this._strokeWidth = 0.0;
this._strokeColor = [0.4, 0.4, 0.4, 1.0];
this._strokeMaterial;
this._strokeStyle = "Solid";
this._materialAmbient = [0.2, 0.2, 0.2, 1.0];
this._materialDiffuse = [0.4, 0.4, 0.4, 1.0];
this._materialSpecular = [0.4, 0.4, 0.4, 1.0];
this._fillColor = [0.4, 0.4, 0.4, 1.0];
this._fillMaterial;
this._DISPLAY_ANCHOR_RADIUS = 5;
//drawing context
this._world = null;
//tool that owns this subpath
this._drawingTool = null;
this._planeMat = null;
this._planeMatInv = null;
this._planeCenter = null;
// initialize the inherited members
this.inheritedFrom = GLGeomObj;
this.inheritedFrom();
//used to query what the user selected, OR-able for future extensions
this.SEL_NONE = 0; //nothing was selected
this.SEL_ANCHOR = 1; //anchor point was selected
this.SEL_PREV = 2; //previous handle of anchor point was selected
th
|