10 lines
266 KiB
JavaScript
10 lines
266 KiB
JavaScript
|
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.openscadOpenJscadParser=f()}}(function(){var define;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){},{}],2:[function(require,module,exports){(function(global){(function(){function addMapEntry(map,pair){return map.set(pair[0],pair[1]),map}function addSetEntry(set,value){return set.add(value),set}function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}function arrayAggregator(array,setter,iteratee,accumulator){for(var index=-1,length=null==array?0:array.length;++index<length;){var value=array[index];setter(accumulator,value,iteratee(value),array)}return accumulator}function arrayEach(array,iteratee){for(var index=-1,length=null==array?0:array.length;++index<length&&iteratee(array[index],index,array)!==!1;);return array}function arrayEachRight(array,iteratee){for(var length=null==array?0:array.length;length--&&iteratee(array[length],length,array)!==!1;);return array}function arrayEvery(array,predicate){for(var index=-1,length=null==array?0:array.length;++index<length;)if(!predicate(array[index],index,array))return!1;return!0}function arrayFilter(array,predicate){for(var index=-1,length=null==array?0:array.length,resIndex=0,result=[];++index<length;){var value=array[index];predicate(value,index,array)&&(result[resIndex++]=value)}return result}function arrayIncludes(array,value){var length=null==array?0:array.length;return!!length&&baseIndexOf(array,value,0)>-1}function arrayIncludesWith(array,value,comparator){for(var index=-1,length=null==array?0:array.length;++index<length;)if(comparator(value,array[index]))return!0;return!1}function arrayMap(array,iteratee){for(var index=-1,length=null==array?0:array.length,result=Array(length);++index<length;)result[index]=iteratee(array[index],index,array);return result}function arrayPush(array,values){for(var index=-1,length=values.length,offset=array.length;++index<length;)array[offset+index]=values[index];return array}function arrayReduce(array,iteratee,accumulator,initAccum){var index=-1,length=null==array?0:array.length;for(initAccum&&length&&(accumulator=array[++index]);++index<length;)accumulator=iteratee(accumulator,array[index],index,array);return accumulator}function arrayReduceRight(array,iteratee,accumulator,initAccum){var length=null==array?0:array.length;for(initAccum&&length&&(accumulator=array[--length]);length--;)accumulator=iteratee(accumulator,array[length],length,array);return accumulator}function arraySome(array,predicate){for(var index=-1,length=null==array?0:array.length;++index<length;)if(predicate(array[index],index,array))return!0;return!1}function asciiToArray(string){return string.split("")}function asciiWords(string){return string.match(reAsciiWord)||[]}function baseFindKey(collection,predicate,eachFunc){var result;return eachFunc(collection,function(value,key,collection){if(predicate(value,key,collection))return result=key,!1}),result}function baseFindIndex(array,predicate,fromIndex,fromRight){for(var length=array.length,index=fromIndex+(fromRight?1:-1);fromRight?index--:++index<length;)if(predicate(array[index],index,array))return index;return-1}function baseIndexOf(array,value,fromIndex){return value===value?strictIndexOf(array,value,fromIndex):baseFindIndex(arra
|
||
|
object=parent(object,path);var func=null==object?object:object[toKey(last(path))];return null==func?undefined:apply(func,object,args)}function baseIsArguments(value){return isObjectLike(value)&&baseGetTag(value)==argsTag}function baseIsArrayBuffer(value){return isObjectLike(value)&&baseGetTag(value)==arrayBufferTag}function baseIsDate(value){return isObjectLike(value)&&baseGetTag(value)==dateTag}function baseIsEqual(value,other,bitmask,customizer,stack){return value===other||(null==value||null==other||!isObjectLike(value)&&!isObjectLike(other)?value!==value&&other!==other:baseIsEqualDeep(value,other,bitmask,customizer,baseIsEqual,stack))}function baseIsEqualDeep(object,other,bitmask,customizer,equalFunc,stack){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=objIsArr?arrayTag:getTag(object),othTag=othIsArr?arrayTag:getTag(other);objTag=objTag==argsTag?objectTag:objTag,othTag=othTag==argsTag?objectTag:othTag;var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&isBuffer(object)){if(!isBuffer(other))return!1;objIsArr=!0,objIsObj=!1}if(isSameTag&&!objIsObj)return stack||(stack=new Stack),objIsArr||isTypedArray(object)?equalArrays(object,other,bitmask,customizer,equalFunc,stack):equalByTag(object,other,objTag,bitmask,customizer,equalFunc,stack);if(!(bitmask&COMPARE_PARTIAL_FLAG)){var objIsWrapped=objIsObj&&hasOwnProperty.call(object,"__wrapped__"),othIsWrapped=othIsObj&&hasOwnProperty.call(other,"__wrapped__");if(objIsWrapped||othIsWrapped){var objUnwrapped=objIsWrapped?object.value():object,othUnwrapped=othIsWrapped?other.value():other;return stack||(stack=new Stack),equalFunc(objUnwrapped,othUnwrapped,bitmask,customizer,stack)}}return!!isSameTag&&(stack||(stack=new Stack),equalObjects(object,other,bitmask,customizer,equalFunc,stack))}function baseIsMap(value){return isObjectLike(value)&&getTag(value)==mapTag}function baseIsMatch(object,source,matchData,customizer){var index=matchData.length,length=index,noCustomizer=!customizer;if(null==object)return!length;for(object=Object(object);index--;){var data=matchData[index];if(noCustomizer&&data[2]?data[1]!==object[data[0]]:!(data[0]in object))return!1}for(;++index<length;){data=matchData[index];var key=data[0],objValue=object[key],srcValue=data[1];if(noCustomizer&&data[2]){if(objValue===undefined&&!(key in object))return!1}else{var stack=new Stack;if(customizer)var result=customizer(objValue,srcValue,key,object,source,stack);if(!(result===undefined?baseIsEqual(srcValue,objValue,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG,customizer,stack):result))return!1}}return!0}function baseIsNative(value){if(!isObject(value)||isMasked(value))return!1;var pattern=isFunction(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}function baseIsRegExp(value){return isObjectLike(value)&&baseGetTag(value)==regexpTag}function baseIsSet(value){return isObjectLike(value)&&getTag(value)==setTag}function baseIsTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[baseGetTag(value)]}function baseIteratee(value){return"function"==typeof value?value:null==value?identity:"object"==typeof value?isArray(value)?baseMatchesProperty(value[0],value[1]):baseMatches(value):property(value)}function baseKeys(object){if(!isPrototype(object))return nativeKeys(object);var result=[];for(var key in Object(object))hasOwnProperty.call(object,key)&&"constructor"!=key&&result.push(key);return result}function baseKeysIn(object){if(!isObject(object))return nativeKeysIn(object);var isProto=isPrototype(object),result=[];for(var key in object)("constructor"!=key||!isProto&&hasOwnProperty.call(object,key))&&result.push(key);return result}function baseLt(value,other){return value<other}function baseMap(collection,iteratee){var index=-1,result=isArrayLike(collection)?Array(collection.length):[];return baseEach(collection,function(value,key,collection){result[++index]=iteratee(value,key,collection)}),result}function baseMatches(source){var matchData=getMatchData(source);return 1==matchData.length&&matchData[0][2]?matchesStrictCompa
|
||
|
}return!1}function equalObjects(object,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,objProps=getAllKeys(object),objLength=objProps.length,othProps=getAllKeys(other),othLength=othProps.length;if(objLength!=othLength&&!isPartial)return!1;for(var index=objLength;index--;){var key=objProps[index];if(!(isPartial?key in other:hasOwnProperty.call(other,key)))return!1}var stacked=stack.get(object);if(stacked&&stack.get(other))return stacked==other;var result=!0;stack.set(object,other),stack.set(other,object);for(var skipCtor=isPartial;++index<objLength;){key=objProps[index];var objValue=object[key],othValue=other[key];if(customizer)var compared=isPartial?customizer(othValue,objValue,key,other,object,stack):customizer(objValue,othValue,key,object,other,stack);if(!(compared===undefined?objValue===othValue||equalFunc(objValue,othValue,bitmask,customizer,stack):compared)){result=!1;break}skipCtor||(skipCtor="constructor"==key)}if(result&&!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;objCtor!=othCtor&&"constructor"in object&&"constructor"in other&&!("function"==typeof objCtor&&objCtor instanceof objCtor&&"function"==typeof othCtor&&othCtor instanceof othCtor)&&(result=!1)}return stack.delete(object),stack.delete(other),result}function flatRest(func){return setToString(overRest(func,undefined,flatten),func+"")}function getAllKeys(object){return baseGetAllKeys(object,keys,getSymbols)}function getAllKeysIn(object){return baseGetAllKeys(object,keysIn,getSymbolsIn)}function getFuncName(func){for(var result=func.name+"",array=realNames[result],length=hasOwnProperty.call(realNames,result)?array.length:0;length--;){var data=array[length],otherFunc=data.func;if(null==otherFunc||otherFunc==func)return data.name}return result}function getHolder(func){var object=hasOwnProperty.call(lodash,"placeholder")?lodash:func;return object.placeholder}function getIteratee(){var result=lodash.iteratee||iteratee;return result=result===iteratee?baseIteratee:result,arguments.length?result(arguments[0],arguments[1]):result}function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data["string"==typeof key?"string":"hash"]:data.map}function getMatchData(object){for(var result=keys(object),length=result.length;length--;){var key=result[length],value=object[key];result[length]=[key,value,isStrictComparable(value)]}return result}function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined}function getRawTag(value){var isOwn=hasOwnProperty.call(value,symToStringTag),tag=value[symToStringTag];try{value[symToStringTag]=undefined;var unmasked=!0}catch(e){}var result=nativeObjectToString.call(value);return unmasked&&(isOwn?value[symToStringTag]=tag:delete value[symToStringTag]),result}function getView(start,end,transforms){for(var index=-1,length=transforms.length;++index<length;){var data=transforms[index],size=data.size;switch(data.type){case"drop":start+=size;break;case"dropRight":end-=size;break;case"take":end=nativeMin(end,start+size);break;case"takeRight":start=nativeMax(start,end-size)}}return{start:start,end:end}}function getWrapDetails(source){var match=source.match(reWrapDetails);return match?match[1].split(reSplitDetails):[]}function hasPath(object,path,hasFunc){path=castPath(path,object);for(var index=-1,length=path.length,result=!1;++index<length;){var key=toKey(path[index]);if(!(result=null!=object&&hasFunc(object,key)))break;object=object[key]}return result||++index!=length?result:(length=null==object?0:object.length,!!length&&isLength(length)&&isIndex(key,length)&&(isArray(object)||isArguments(object)))}function initCloneArray(array){var length=array.length,result=array.constructor(length);return length&&"string"==typeof array[0]&&hasOwnProperty.call(array,"index")&&(result.index=array.index,result.input=array.input),result}function initCloneObject(object){return"function"!=typeof object.constructor||isPrototype(object)?{}:baseCreate(getPrototype(object))}function initCloneByTag(object,tag,cloneFunc,isDeep){var Ctor=object.constructor
|
||
|
return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}function toPlainObject(value){return copyObject(value,keysIn(value))}function toSafeInteger(value){return value?baseClamp(toInteger(value),-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER):0===value?value:0}function toString(value){return null==value?"":baseToString(value)}function create(prototype,properties){var result=baseCreate(prototype);return null==properties?result:baseAssign(result,properties)}function findKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwn)}function findLastKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwnRight)}function forIn(object,iteratee){return null==object?object:baseFor(object,getIteratee(iteratee,3),keysIn)}function forInRight(object,iteratee){return null==object?object:baseForRight(object,getIteratee(iteratee,3),keysIn)}function forOwn(object,iteratee){return object&&baseForOwn(object,getIteratee(iteratee,3))}function forOwnRight(object,iteratee){return object&&baseForOwnRight(object,getIteratee(iteratee,3))}function functions(object){return null==object?[]:baseFunctions(object,keys(object))}function functionsIn(object){return null==object?[]:baseFunctions(object,keysIn(object))}function get(object,path,defaultValue){var result=null==object?undefined:baseGet(object,path);return result===undefined?defaultValue:result}function has(object,path){return null!=object&&hasPath(object,path,baseHas)}function hasIn(object,path){return null!=object&&hasPath(object,path,baseHasIn)}function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object)}function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,!0):baseKeysIn(object)}function mapKeys(object,iteratee){var result={};return iteratee=getIteratee(iteratee,3),baseForOwn(object,function(value,key,object){baseAssignValue(result,iteratee(value,key,object),value)}),result}function mapValues(object,iteratee){var result={};return iteratee=getIteratee(iteratee,3),baseForOwn(object,function(value,key,object){baseAssignValue(result,key,iteratee(value,key,object))}),result}function omitBy(object,predicate){return pickBy(object,negate(getIteratee(predicate)))}function pickBy(object,predicate){if(null==object)return{};var props=arrayMap(getAllKeysIn(object),function(prop){return[prop]});return predicate=getIteratee(predicate),basePickBy(object,props,function(value,path){return predicate(value,path[0])})}function result(object,path,defaultValue){path=castPath(path,object);var index=-1,length=path.length;for(length||(length=1,object=undefined);++index<length;){var value=null==object?undefined:object[toKey(path[index])];value===undefined&&(index=length,value=defaultValue),object=isFunction(value)?value.call(object):value}return object}function set(object,path,value){return null==object?object:baseSet(object,path,value)}function setWith(object,path,value,customizer){return customizer="function"==typeof customizer?customizer:undefined,null==object?object:baseSet(object,path,value,customizer)}function transform(object,iteratee,accumulator){var isArr=isArray(object),isArrLike=isArr||isBuffer(object)||isTypedArray(object);if(iteratee=getIteratee(iteratee,4),null==accumulator){var Ctor=object&&object.constructor;accumulator=isArrLike?isArr?new Ctor:[]:isObject(object)&&isFunction(Ctor)?baseCreate(getPrototype(object)):{}}return(isArrLike?arrayEach:baseForOwn)(object,function(value,index,object){return iteratee(accumulator,value,index,object)}),accumulator}function unset(object,path){return null==object||baseUnset(object,path)}function update(object,path,updater){return null==object?object:baseUpdate(object,path,castFunction(updater))}function updateWith(object,path,updater,customizer){return customizer="function"==typeof customizer?customizer:undefined,null==object?object:baseUpdate(object,path,castFunction(updater),customizer)}function values(object){return null==object?[]:baseValues(object,keys(object))}function valuesIn(object){return null==object?[]:baseValues(
|
||
|
key=toKey(key),baseAssignValue(object,key,bind(object[key],object))}),object}),flow=createFlow(),flowRight=createFlow(!0),method=baseRest(function(path,args){return function(object){return baseInvoke(object,path,args)}}),methodOf=baseRest(function(object,args){return function(path){return baseInvoke(object,path,args)}}),over=createOver(arrayMap),overEvery=createOver(arrayEvery),overSome=createOver(arraySome),range=createRange(),rangeRight=createRange(!0),add=createMathOperation(function(augend,addend){return augend+addend},0),ceil=createRound("ceil"),divide=createMathOperation(function(dividend,divisor){return dividend/divisor},1),floor=createRound("floor"),multiply=createMathOperation(function(multiplier,multiplicand){return multiplier*multiplicand},1),round=createRound("round"),subtract=createMathOperation(function(minuend,subtrahend){return minuend-subtrahend},0);return lodash.after=after,lodash.ary=ary,lodash.assign=assign,lodash.assignIn=assignIn,lodash.assignInWith=assignInWith,lodash.assignWith=assignWith,lodash.at=at,lodash.before=before,lodash.bind=bind,lodash.bindAll=bindAll,lodash.bindKey=bindKey,lodash.castArray=castArray,lodash.chain=chain,lodash.chunk=chunk,lodash.compact=compact,lodash.concat=concat,lodash.cond=cond,lodash.conforms=conforms,lodash.constant=constant,lodash.countBy=countBy,lodash.create=create,lodash.curry=curry,lodash.curryRight=curryRight,lodash.debounce=debounce,lodash.defaults=defaults,lodash.defaultsDeep=defaultsDeep,lodash.defer=defer,lodash.delay=delay,lodash.difference=difference,lodash.differenceBy=differenceBy,lodash.differenceWith=differenceWith,lodash.drop=drop,lodash.dropRight=dropRight,lodash.dropRightWhile=dropRightWhile,lodash.dropWhile=dropWhile,lodash.fill=fill,lodash.filter=filter,lodash.flatMap=flatMap,lodash.flatMapDeep=flatMapDeep,lodash.flatMapDepth=flatMapDepth,lodash.flatten=flatten,lodash.flattenDeep=flattenDeep,lodash.flattenDepth=flattenDepth,lodash.flip=flip,lodash.flow=flow,lodash.flowRight=flowRight,lodash.fromPairs=fromPairs,lodash.functions=functions,lodash.functionsIn=functionsIn,lodash.groupBy=groupBy,lodash.initial=initial,lodash.intersection=intersection,lodash.intersectionBy=intersectionBy,lodash.intersectionWith=intersectionWith,lodash.invert=invert,lodash.invertBy=invertBy,lodash.invokeMap=invokeMap,lodash.iteratee=iteratee,lodash.keyBy=keyBy,lodash.keys=keys,lodash.keysIn=keysIn,lodash.map=map,lodash.mapKeys=mapKeys,lodash.mapValues=mapValues,lodash.matches=matches,lodash.matchesProperty=matchesProperty,lodash.memoize=memoize,lodash.merge=merge,lodash.mergeWith=mergeWith,lodash.method=method,lodash.methodOf=methodOf,lodash.mixin=mixin,lodash.negate=negate,lodash.nthArg=nthArg,lodash.omit=omit,lodash.omitBy=omitBy,lodash.once=once,lodash.orderBy=orderBy,lodash.over=over,lodash.overArgs=overArgs,lodash.overEvery=overEvery,lodash.overSome=overSome,lodash.partial=partial,lodash.partialRight=partialRight,lodash.partition=partition,lodash.pick=pick,lodash.pickBy=pickBy,lodash.property=property,lodash.propertyOf=propertyOf,lodash.pull=pull,lodash.pullAll=pullAll,lodash.pullAllBy=pullAllBy,lodash.pullAllWith=pullAllWith,lodash.pullAt=pullAt,lodash.range=range,lodash.rangeRight=rangeRight,lodash.rearg=rearg,lodash.reject=reject,lodash.remove=remove,lodash.rest=rest,lodash.reverse=reverse,lodash.sampleSize=sampleSize,lodash.set=set,lodash.setWith=setWith,lodash.shuffle=shuffle,lodash.slice=slice,lodash.sortBy=sortBy,lodash.sortedUniq=sortedUniq,lodash.sortedUniqBy=sortedUniqBy,lodash.split=split,lodash.spread=spread,lodash.tail=tail,lodash.take=take,lodash.takeRight=takeRight,lodash.takeRightWhile=takeRightWhile,lodash.takeWhile=takeWhile,lodash.tap=tap,lodash.throttle=throttle,lodash.thru=thru,lodash.toArray=toArray,lodash.toPairs=toPairs,lodash.toPairsIn=toPairsIn,lodash.toPath=toPath,lodash.toPlainObject=toPlainObject,lodash.transform=transform,lodash.unary=unary,lodash.union=union,lodash.unionBy=unionBy,lodash.unionWith=unionWith,lodash.uniq=uniq,lodash.uniqBy=uniqBy,lodash.uniqWith=uniqWith,lodash.unset=unset,lodash.unzip=unzip,lodash.unzipWith=unzipWith,
|
||
|
x.push(row)}return Matrix.create(x)}},{key:"e",value:function(i,j){return i<1||i>this.elements.length||j<1||j>this.elements[0].length?null:this.elements[i-1][j-1]}},{key:"row",value:function(i){return i>this.elements.length?null:_vector.Vector.create(this.elements[i-1])}},{key:"col",value:function col(j){if(j>this.elements[0].length)return null;for(var col=[],n=this.elements.length,i=0;i<n;i++)col.push(this.elements[i][j-1]);return _vector.Vector.create(col)}},{key:"dimensions",value:function(){return{rows:this.elements.length,cols:this.elements[0].length}}},{key:"rows",value:function(){return this.elements.length}},{key:"cols",value:function(){return this.elements[0].length}},{key:"approxEql",value:function(matrix){return this.eql(matrix,_sylvester.Sylvester.approxPrecision)}},{key:"eql",value:function(matrix,precision){var M=matrix.elements||matrix;if("undefined"==typeof M[0][0]&&(M=Matrix.create(M).elements),this.elements.length!==M.length||this.elements[0].length!==M[0].length)return!1;for(var i=this.elements.length,nj=this.elements[0].length,j=void 0;i--;)for(j=nj;j--;)if(Math.abs(this.elements[i][j]-M[i][j])>(precision||_sylvester.Sylvester.precision))return!1;return!0}},{key:"dup",value:function(){return Matrix.create(this.elements)}},{key:"map",value:function(fn){for(var els=[],i=this.elements.length,nj=this.elements[0].length,j=void 0;i--;)for(j=nj,els[i]=[];j--;)els[i][j]=fn(this.elements[i][j],i+1,j+1);return Matrix.create(els)}},{key:"isSameSizeAs",value:function(matrix){var M=matrix.elements||matrix;return"undefined"==typeof M[0][0]&&(M=Matrix.create(M).elements),this.elements.length===M.length&&this.elements[0].length===M[0].length}},{key:"add",value:function(matrix){if("number"==typeof matrix)return this.map(function(x){return x+matrix});var M=matrix.elements||matrix;return"undefined"==typeof M[0][0]&&(M=Matrix.create(M).elements),this.isSameSizeAs(M)?this.map(function(x,i,j){return x+M[i-1][j-1]}):null}},{key:"subtract",value:function(matrix){if("number"==typeof matrix)return this.map(function(x){return x-matrix});var M=matrix.elements||matrix;return"undefined"==typeof M[0][0]&&(M=Matrix.create(M).elements),this.isSameSizeAs(M)?this.map(function(x,i,j){return x-M[i-1][j-1]}):null}},{key:"canMultiplyFromLeft",value:function(matrix){var M=matrix.elements||matrix;return"undefined"==typeof M[0][0]&&(M=Matrix.create(M).elements),this.elements[0].length===M.length}},{key:"mulOp",value:function(matrix,op){if(!matrix.elements)return this.map(function(x){return op(x,matrix)});var returnVector=Boolean(matrix.modulus),M=matrix.elements||matrix;if("undefined"==typeof M[0][0]&&(M=Matrix.create(M).elements),!this.canMultiplyFromLeft(M))return null;for(var e=this.elements,rowThis=void 0,rowElem=void 0,elements=[],sum=void 0,m=e.length,n=M[0].length,o=e[0].length,i=m,j=void 0,k=void 0;i--;){for(rowElem=[],rowThis=e[i],j=n;j--;){for(sum=0,k=o;k--;)sum+=op(rowThis[k],M[k][j]);rowElem[j]=sum}elements[i]=rowElem}var output=Matrix.create(elements);return returnVector?output.col(1):output}},{key:"div",value:function(matrix){return this.mulOp(matrix,function(x,y){return x/y})}},{key:"multiply",value:function(matrix){return this.mulOp(matrix,function(x,y){return x*y})}},{key:"x",value:function(matrix){return this.multiply(matrix)}},{key:"elementMultiply",value:function(v){return this.map(function(k,i,j){return v.e(i,j)*k})}},{key:"sum",value:function sum(){var sum=0;return this.map(function(x){sum+=x}),sum}},{key:"mean",value:function(){for(var dim=this.dimensions(),r=[],i=1;i<=dim.cols;i++)r.push(this.col(i).sum()/dim.rows);return _vector.Vector.create(r)}},{key:"std",value:function(){for(var dim=this.dimensions(),mMean=this.mean(),r=[],i=1;i<=dim.cols;i++){var meanDiff=this.col(i).subtract(mMean.e(i));meanDiff=meanDiff.multiply(meanDiff),r.push(Math.sqrt(meanDiff.sum()/dim.rows))}return _vector.Vector.create(r)}},{key:"column",value:function(n){return this.col(n)}},{key:"log",value:function(){return this.map(function(x){return Math.log(x)})}},{key:"minor",value:function(a,b,c,d){for(var elements=[],ni=c,i=void 0,nj=void 0,j=v
|
||
|
module.exports=function(){this.argnames=[],this.argexpr=[]}},{}],13:[function(require,module,exports){function CSGModule(factory,csgOperation){this.csgOperation=csgOperation,this.factory=factory}var Context=require("./Context"),_=(require("./Globals"),require("lodash"));CSGModule.prototype.evaluate=function(parentContext,inst){for(var context=new Context(parentContext),childModules=[],i=0;i<inst.children.length;i++){var childInst=inst.children[i];childInst.argvalues=[],_.each(childInst.argexpr,function(expr,index,list){childInst.argvalues.push(expr.evaluate(context))});var childAdaptor=this.factory.getAdaptor(childInst),evaluatedChild=childAdaptor.evaluate(parentContext,childInst);void 0!==evaluatedChild&&childModules.push(evaluatedChild)}return childModules.length<=1?childModules[0]:childModules[0]+"."+this.csgOperation+"(["+childModules.slice(1).join(",\n")+"])"},module.exports=CSGModule},{"./Context":15,"./Globals":19,lodash:2}],14:[function(require,module,exports){function Child(factory){this.factory=factory}var _=require("lodash"),Context=require("./Context"),Globals=require("./Globals");Child.prototype.evaluate=function(parentContext,inst){inst.argvalues=[],_.each(inst.argexpr,function(expr,index,list){inst.argvalues.push(expr.evaluate(parentContext))});var childIndex=(Context.newContext(parentContext,[],[],inst),0);void 0!==inst.argvalues[0]&&(childIndex=inst.argvalues[0]);for(var evaluatedChildren=[],i=Globals.context_stack.length-1;i>=0;i--){var ctx=Globals.context_stack[i];if(void 0!==ctx.inst_p){if(childIndex<ctx.inst_p.children.length){var childInst=ctx.inst_p.children[childIndex];_.each(childInst.argexpr,function(expr,index,list){childInst.argvalues.push(expr.evaluate(ctx.inst_p.ctx))});var childAdaptor=this.factory.getAdaptor(childInst);evaluatedChildren.push(childAdaptor.evaluate(ctx.inst_p.ctx,childInst))}return evaluatedChildren}ctx=ctx.parentContext}},module.exports=Child},{"./Context":15,"./Globals":19,lodash:2}],15:[function(require,module,exports){function Context(parentContext){this.vars=parentContext?{}:{$fn:Globals.FN_DEFAULT,$fs:Globals.FS_DEFAULT,$fa:Globals.FA_DEFAULT},this.parentContext=parentContext,this.inst_p,this.functions_p={},this.modules_p={},Globals.context_stack.push(this)}function rad2deg(rad){return rad*(180/Math.PI)}function deg2rad(deg){return deg*Math.PI/180}var _=require("lodash"),Globals=require("./Globals");Context.prototype.setVariable=function(name,value){void 0!==value&&(this.vars[name]=value)},Context.prototype.args=function(argnames,argexpr,call_argnames,call_argvalues){for(var i=0;i<argnames.length;i++)i<argexpr.length&&void 0!==argexpr[i]?this.setVariable(argnames[i],argexpr[i].evaluate(this.parentContext)):this.setVariable(argnames[i],void 0);for(var posarg=0,i=0;i<call_argnames.length;i++)void 0===call_argnames[i]?posarg<argnames.length&&this.setVariable(argnames[posarg++],call_argvalues[i]):this.setVariable(call_argnames[i],call_argvalues[i])},Context.prototype.lookupVariable=function(name){return _.has(this.vars,name)?this.vars[name]:void 0!==this.parentContext?this.parentContext.lookupVariable(name):void 0},Context.prototype.evaluateFunction=function(name,argnames,argvalues){return _.has(this.functions_p,name)?this.functions_p[name].evaluate(this,argnames,argvalues):_.has(functionNameLookup,name)?functionNameLookup[name].apply(this,argvalues):void 0!==this.parentContext?this.parentContext.evaluateFunction(name,argnames,argvalues):void console.log("WARNING: Ignoring unknown function '"+name+"'.")},Context.prototype.evaluateModule=function(inst,factory){var customModule=_.find(this.modules_p,function(x){return x.name==inst.name});if(void 0!==customModule)return customModule.evaluate(this,inst);if(void 0===inst.isSubmodule||!inst.isSubmodule){var adaptor=factory.getAdaptor(inst);if(void 0!==adaptor)return adaptor.evaluate(this,inst)}return this.parentContext?this.parentContext.evaluateModule(inst,factory):void console.log("WARNING: Ignoring unknown module: "+inst.name)},Context.newContext=function(parentContext,argnames,argexpr,inst){var context=new Context(parentCon
|
||
|
for(var buf="",i=sttPos;i<endPos;i++){var char=this.data[i].toString();buf+=String.fromCharCode(char)}return buf.replace("\r","")},STL.prototype.readUInt16=function(){var b1,b2;return b1=this.data[this.pos++],b2=this.data[this.pos++]<<8,b1|b2},STL.prototype.readUInt32=function(){var b1,b2,b3,b4;b1=this.data[this.pos++],b2=this.data[this.pos++]<<8,b3=this.data[this.pos++]<<16,b4=this.data[this.pos++]<<24;var num=b1|b2|b3|b4;return num},STL.prototype.readReal32=function(){if(this.data.length<=this.pos+4)return 0;var byteArray=[0,0,0,0];byteArray[3]=this.data[this.pos++],byteArray[2]=this.data[this.pos++],byteArray[1]=this.data[this.pos++],byteArray[0]=this.data[this.pos++];var sign=this.parseSign(byteArray),exponent=this.parseExponent(byteArray),mantissa=this.parseSignificand(byteArray),num=sign*exponent*mantissa;return num},STL.prototype.parseSign=function(byteArray){return 128&byteArray[0]?-1:1},STL.prototype.parseExponent=function(byteArray){var ex=127&byteArray[0];return ex<<=1,0!=(128&byteArray[1])&&(ex+=1),ex=Math.pow(2,ex-127)},STL.prototype.parseSignificand=function(byteArray){for(var num=0,mask=64,i=1;i<8;i++)0!=(byteArray[1]&mask)&&(num+=1/Math.pow(2,i)),mask>>=1;mask=128;for(var j=0;j<8;j++)0!=(byteArray[2]&mask)&&(num+=1/Math.pow(2,j+8)),mask>>=1;mask=128;for(var k=0;k<8;k++)0!=(byteArray[2]&mask)&&(num+=1/Math.pow(2,k+16)),mask>>=1;return num+1},STL.prototype.readNormal=function(index){var sttPos=this.listNormal[index],endPos=this.findEndPos(sttPos),vString=this.bin2String(sttPos,endPos),pos=vString.indexOf(this.TYPE_NORMAL);vString=vString.substring(pos+this.TYPE_NORMAL.length+1,vString.length);for(var list=vString.split(" "),normal=new Array,i=0;i<list.length;i++)list[i].length&&normal.push(Number(list[i]));return list.length<3?null:normal},STL.prototype.readVertex=function(index){var sttPos=this.listVertex[index],endPos=this.findEndPos(sttPos),vString=this.bin2String(sttPos,endPos),pos=vString.indexOf(this.TYPE_VERTEX);vString=vString.substring(pos+this.TYPE_VERTEX.length+1,vString.length);for(var list=vString.split(" "),vertex=new Array,i=0;i<list.length;i++)list[i].length&&vertex.push(Number(list[i]));return 3!=vertex.length?null:vertex},STL.prototype.decode=function(){if(this.dataType.length)return this.dataType;var str=this.bin2String(0,10).toLocaleLowerCase(),endPos=0,sttPos=0;if(str.indexOf(this.ASCII_TITLE)>=0)for(this.dataType=this.TYPE_ASCII,this.listVertex=new Array,this.listNormal=new Array;endPos<this.data.length-1;)endPos=this.findEndPos(sttPos),str=this.bin2String(sttPos,endPos),str.indexOf(this.TYPE_VERTEX)>=0?this.listVertex.push(sttPos):str.indexOf(this.TYPE_NORMAL)>=0&&this.listNormal.push(sttPos),sttPos=endPos+1;else this.dataType=this.TYPE_BINARY;return this.dataType},STL.prototype.getCSG=function(){var numTriangles,csgPolygons=[];if(this.dataType==this.TYPE_BINARY?(this.pos=HDR_LEN,numTriangles=this.readUInt32()):(this.pos=0,numTriangles=this.listVertex.length/3),this.dataType==this.TYPE_BINARY)for(i=0;i<numTriangles;i++){for(var csgVertices=[],normal=[0,0,0],j=0;j<3;j++)normal[j]=this.readReal32();for(var csgNormal=new CSG.Vector3D(normal),csgPlane=new CSG.Plane(csgNormal,1),j=0;j<3;j++){var x=this.readReal32(),y=this.readReal32(),z=this.readReal32();csgVertices.push(new CSG.Vertex(new CSG.Vector3D(x,y,z)))}this.pos+=2,csgPolygons.push(new CSG.Polygon(csgVertices,null,csgPlane))}else for(i=0;i<numTriangles;i++){for(var csgVertices=[],j=0;j<3;j++){var vtx=this.readVertex(3*i+j);csgVertices.push(new CSG.Vertex(new CSG.Vector3D(vtx)))}csgPolygons.push(new CSG.Polygon(csgVertices,null))}return CSG.fromPolygons(csgPolygons)},STL.prototype.getCSGString=function(){var numTriangles,csgPolygons=[];if(this.dataType==this.TYPE_BINARY?(this.pos=HDR_LEN,numTriangles=this.readUInt32()):(this.pos=0,numTriangles=this.listVertex.length/3),this.dataType==this.TYPE_BINARY)for(i=0;i<numTriangles;i++){for(var csgVertices=[],normal=[0,0,0],j=0;j<3;j++)normal[j]=this.readReal32();for(var j=(_.template("new CSG.Plane(new CSG.Vector3D([<%=normal%>]), 1)")({normal:normal}),0);j<3;j++){var x=this.readReal32(),y
|
||
|
},{13:118,43:$VQ,57:[1,119]},o($VV,$VQ,{13:120,57:$VR}),o($VW,[2,54],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB}),o($VW,[2,55],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB}),o($VW,[2,56],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB}),{14:[1,121],33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD,48:$VE,49:$VF,50:$VG,51:$VH,52:$VI,53:$VJ,54:$VK,55:$VL,56:$VM},o($Vu,[2,25]),o([10,11,31,35,36,37,39,40,41,46,47],$VQ,{13:122,57:$VR}),{10:$Vf,11:$Vg,20:123,31:$Vh,35:$Vi,36:$Vj,37:$Vk,39:$Vl,40:$Vm,41:$Vn,46:$Vo,47:$Vp},{13:124,14:$VQ,57:$VT},o($Ve,[2,16]),o($Vt,[2,24]),{10:$Vc,16:$Vd,18:28,23:125,25:19,26:$V4,27:14,29:13,31:$V5,32:$V6,33:$V7,34:$V8},{14:[1,126]},o([10,14],$VQ,{13:127,57:$VR}),{10:$Vf,11:$Vg,20:128,31:$Vh,35:$Vi,36:$Vj,37:$Vk,39:$Vl,40:$Vm,41:$Vn,46:$Vo,47:$Vp},o($VN,[2,34]),o($VX,[2,41],{38:$Vz,41:$VA}),o($VX,[2,42],{38:$Vz,41:$VA}),o($VX,[2,43],{38:$Vz,41:$VA}),o($VW,[2,44],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB}),o($VW,[2,45],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB}),o($VY,[2,46],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD,50:$VG,51:$VH}),o($VY,[2,47],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD,50:$VG,51:$VH}),o($VZ,[2,48],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD}),o($VZ,[2,49],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD}),o($VY,[2,50],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD,50:$VG,51:$VH}),o($VY,[2,51],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD,50:$VG,51:$VH}),o([14,15,42,43,54,55,56,57],[2,52],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD,48:$VE,49:$VF,50:$VG,51:$VH,52:$VI,53:$VJ}),o([14,15,42,43,55,56,57],[2,53],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD,48:$VE,49:$VF,50:$VG,51:$VH,52:$VI,53:$VJ,54:$VK}),{33:$Vx,34:$Vy,38:$Vz,41:$VA,42:[1,129],45:$VB,46:$VC,47:$VD,48:$VE,49:$VF,50:$VG,51:$VH,52:$VI,53:$VJ,54:$VK,55:$VL,56:$VM},{33:$Vx,34:$Vy,38:$Vz,41:$VA,43:[1,130],45:$VB,46:$VC,47:$VD,48:$VE,49:$VF,50:$VG,51:$VH,52:$VI,53:$VJ,54:$VK,55:$VL,56:$VM},{14:[1,131],57:$VS},{10:$Vf,11:$Vg,20:132,31:$Vh,35:$Vi,36:$Vj,37:$Vk,39:$Vl,40:$Vm,41:$Vn,46:$Vo,47:$Vp},o($VN,[2,39]),{43:[1,133]},o([10,11,31,35,36,37,39,40,41,43,46,47],$VQ,{13:134,57:$VR}),o($VV,$V_),o($VN,[2,57]),{10:$Vs,11:$Vg,20:54,31:$Vh,35:$Vi,36:$Vj,37:$Vk,39:$Vl,40:$Vm,41:$Vn,46:$Vo,47:$Vp,59:135},o($Vq,[2,74],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD,48:$VE,49:$VF,50:$VG,51:$VH,52:$VI,53:$VJ,54:$VK,55:$VL,56:$VM}),{14:[1,136]},o($Ve,[2,17]),o($V1,[2,8]),{10:$Vw,14:$V_,58:137},o($Vq,[2,69],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD,48:$VE,49:$VF,50:$VG,51:$VH,52:$VI,53:$VJ,54:$VK,55:$VL,56:$VM}),{10:$Vf,11:$Vg,20:138,31:$Vh,35:$Vi,36:$Vj,37:$Vk,39:$Vl,40:$Vm,41:$Vn,46:$Vo,47:$Vp},o($VN,[2,59]),o($VN,[2,60]),{33:$Vx,34:$Vy,38:$Vz,41:$VA,42:[1,140],43:[1,139],45:$VB,46:$VC,47:$VD,48:$VE,49:$VF,50:$VG,51:$VH,52:$VI,53:$VJ,54:$VK,55:$VL,56:$VM},o($VN,[2,40]),{10:$Vf,11:$Vg,20:141,31:$Vh,35:$Vi,36:$Vj,37:$Vk,39:$Vl,40:$Vm,41:$Vn,43:$V_,46:$Vo,47:$Vp},o($Vq,[2,72]),{19:[1,142]},o($Vq,[2,67]),o([14,15,42,43,57],[2,58],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD,48:$VE,49:$VF,50:$VG,51:$VH,52:$VI,53:$VJ,54:$VK,55:$VL,56:$VM}),o($VN,[2,37]),{10:$Vf,11:$Vg,20:143,31:$Vh,35:$Vi,36:$Vj,37:$Vk,39:$Vl,40:$Vm,41:$Vn,46:$Vo,47:$Vp},o($VU,[2,64],{33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD,48:$VE,49:$VF,50:$VG,51:$VH,52:$VI,53:$VJ,54:$VK,55:$VL,56:$VM}),{10:$Vf,11:$Vg,20:144,31:$Vh,35:$Vi,36:$Vj,37:$Vk,39:$Vl,40:$Vm,41:$Vn,46:$Vo,47:$Vp},{33:$Vx,34:$Vy,38:$Vz,41:$VA,43:[1,145],45:$VB,46:$VC,47:$VD,48:$VE,49:$VF,50:$VG,51:$VH,52:$VI,53:$VJ,54:$VK,55:$VL,56:$VM},{15:[1,146],33:$Vx,34:$Vy,38:$Vz,41:$VA,45:$VB,46:$VC,47:$VD,48:$VE,49:$VF,50:$VG,51:$VH,52:$VI,53:$VJ,54:$VK,55:$VL,56:$VM},o($VN,[2,38]),o($V9,[2,13])],defaultActions:{},parseError:function(str,hash){function _parseError(msg,hash){this.message=msg,this.hash=hash}if(!hash.recoverable)throw _parseError.prototype=Error,new _parseError(str,hash);this.trace(str)},parse:function(input){var self=this,stack=[0],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1,args=lstack.slice.call(arguments,1),lexer=Object.create(this
|