mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-14 16:28:41 +00:00
22 lines
39 KiB
JavaScript
22 lines
39 KiB
JavaScript
|
/**
|
||
|
* Copyright (C) 2010-2015 Graham Breach
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
/**
|
||
|
* jQuery.tagcanvas 2.6.1
|
||
|
* For more information, please contact <graham@goat1000.com>
|
||
|
*/
|
||
|
(function(am){var L,J,K=Math.abs,af=Math.sin,w=Math.cos,s=Math.max,aA=Math.min,an=Math.ceil,E=Math.sqrt,ap=Math.pow,h={},l={},m={0:"0,",1:"17,",2:"34,",3:"51,",4:"68,",5:"85,",6:"102,",7:"119,",8:"136,",9:"153,",a:"170,",A:"170,",b:"187,",B:"187,",c:"204,",C:"204,",d:"221,",D:"221,",e:"238,",E:"238,",f:"255,",F:"255,"},x,c,P,aC,G,aD,Z,C=document,p,b={};for(L=0;L<256;++L){J=L.toString(16);if(L<16){J="0"+J}l[J]=l[J.toUpperCase()]=L.toString()+","}function ag(i){return typeof i!="undefined"}function H(i){return typeof i=="object"&&i!=null}function ar(i,j,aE){return isNaN(i)?aE:aA(aE,s(j,i))}function ax(){return false}function F(){return new Date().valueOf()}function A(aE,aH){var j=[],aF=aE.length,aG;for(aG=0;aG<aF;++aG){j.push(aE[aG])}j.sort(aH);return j}function al(j){var aF=j.length-1,aE,aG;while(aF){aG=~~(Math.random()*aF);aE=j[aF];j[aF]=j[aG];j[aG]=aE;--aF}}function ac(i,aE,j){this.x=i;this.y=aE;this.z=j}G=ac.prototype;G.length=function(){return E(this.x*this.x+this.y*this.y+this.z*this.z)};G.dot=function(i){return this.x*i.x+this.y*i.y+this.z*i.z};G.cross=function(j){var i=this.y*j.z-this.z*j.y,aF=this.z*j.x-this.x*j.z,aE=this.x*j.y-this.y*j.x;return new ac(i,aF,aE)};G.angle=function(j){var i=this.dot(j),aE;if(i==0){return Math.PI/2}aE=i/(this.length()*j.length());if(aE>=1){return 0}if(aE<=-1){return Math.PI}return Math.acos(aE)};G.unit=function(){var i=this.length();return new ac(this.x/i,this.y/i,this.z/i)};function ah(aE,j){j=j*Math.PI/180;aE=aE*Math.PI/180;var i=af(aE)*w(j),aG=-af(j),aF=-w(aE)*w(j);return new ac(i,aG,aF)}function Q(i){this[1]={1:i[0],2:i[1],3:i[2]};this[2]={1:i[3],2:i[4],3:i[5]};this[3]={1:i[6],2:i[7],3:i[8]}}aC=Q.prototype;Q.Identity=function(){return new Q([1,0,0,0,1,0,0,0,1])};Q.Rotation=function(aF,i){var j=af(aF),aE=w(aF),aG=1-aE;return new Q([aE+ap(i.x,2)*aG,i.x*i.y*aG-i.z*j,i.x*i.z*aG+i.y*j,i.y*i.x*aG+i.z*j,aE+ap(i.y,2)*aG,i.y*i.z*aG-i.x*j,i.z*i.x*aG-i.y*j,i.z*i.y*aG+i.x*j,aE+ap(i.z,2)*aG])};aC.mul=function(aE){var aF=[],aI,aH,aG=(aE.xform?1:0);for(aI=1;aI<=3;++aI){for(aH=1;aH<=3;++aH){if(aG){aF.push(this[aI][1]*aE[1][aH]+this[aI][2]*aE[2][aH]+this[aI][3]*aE[3][aH])}else{aF.push(this[aI][aH]*aE)}}}return new Q(aF)};aC.xform=function(aE){var j={},i=aE.x,aG=aE.y,aF=aE.z;j.x=i*this[1][1]+aG*this[2][1]+aF*this[3][1];j.y=i*this[1][2]+aG*this[2][2]+aF*this[3][2];j.z=i*this[1][3]+aG*this[2][3]+aF*this[3][3];return j};function q(aF,aH,aM,aJ){var aI,aL,j,aK,aN=[],aG=Math.PI*(3-E(5)),aE=2/aF;for(aI=0;aI<aF;++aI){aL=aI*aE-1+(aE/2);j=E(1-aL*aL);aK=aI*aG;aN.push([w(aK)*j*aH,aL*aM,af(aK)*j*aJ])}return aN}function V(aG,aE,aJ,aP,aN){var aO,aQ=[],aH=Math.PI*(3-E(5)),aF=2/aG,aM,aL,aK,aI;for(aM=0;aM<aG;++aM){aL=aM*aF-1+(aF/2);aO=aM*aH;aK=w(aO);aI=af(aO);aQ.push(aE?[aL*aJ,aK*aP,aI*aN]:[aK*aJ,aL*aP,aI*aN])}return aQ}function M(aE,aF,aI,aO,aM,aK){var aN,aP=[],aG=Math.PI*2/aF,aL,aJ,aH;for(aL=0;aL<aF;++aL){aN=aL*aG;aJ=w(aN);aH=af(aN);aP.push(aE?[aK*aI,aJ*aO,aH*aM]:[aJ*aI,aK*aO,aH*aM])}return aP}function ak(aF,i,j,aE){return V(aF,0,i,j,aE)}function aq(aF,i,j,aE){return V(aF,1,i,j,aE)}function d(aG,i,j,aE,aF){aF=isNaN(aF)?0:aF*1;return M(0,aG,i,j,aE,aF)}function n(aG,i,j,aE,aF){aF=isNaN(aF)?0:aF*1;return M(1,aG,i,j,aE,aF)}function T(aH,i){var aG=aH,aF,aE,j=(i*1).toPrecision(3)+")";if(aH[0]==="#"){if(!h[aH]){if(aH.length===4){h[aH]="rgba("+m[aH[1]]+m[aH[2]]+m[aH[3]]}else{h[aH]="rgba("+l[aH.substr(1,2)]+l[aH.substr(3,2)]+l[aH.substr(5,2)]}}aG=h[aH]+j}else{if(aH.substr(0,4)==="rgb("||aH.substr(0,4)==="hsl("){aG=(aH.replace("(","a(").replace(")",","+j))}else{if(aH.substr(0,5)==="rgba("||aH.substr(0,5)==="hsla("){aF=aH.lastIndexOf(",")+1,aE=aH.indexOf(")");i*=parseFloat(aH.substring(aF,aE));aG=aH.substr(0,aF)+i.toPrecision(3)+")"}}}return aG}function O(i,j){if(window.G_vmlCanvasManager){return null}var aE=C.createElement("canvas");aE.width=i;aE.height=j;return aE}function aj(){var j=O(3,3),aF,aE;if(!j){return false}aF=j.getContext("2d");aF.strokeStyle="#000";aF.shadowColor="#fff";aF.shadowBlur=3;aF.globalAlpha=0;aF.strokeRect(2,2,2,2);aF.globalAlpha=1;aE=aF.getImageData(2,2,1,1);j=null;return(aE.data[0]>0)}function ai(aI
|