()
| 7803 | //internal curveInit |
| 7804 | //used by curveDetail, curveTightness |
| 7805 | var curveInit = function() { |
| 7806 | // allocate only if/when used to save startup time |
| 7807 | if (!curveDrawMatrix) { |
| 7808 | curveBasisMatrix = new PMatrix3D(); |
| 7809 | curveDrawMatrix = new PMatrix3D(); |
| 7810 | curveInited = true; |
| 7811 | } |
| 7812 | |
| 7813 | var s = curTightness; |
| 7814 | curveBasisMatrix.set(((s - 1) / 2).toFixed(2), ((s + 3) / 2).toFixed(2), |
| 7815 | ((-3 - s) / 2).toFixed(2), ((1 - s) / 2).toFixed(2), |
| 7816 | (1 - s), ((-5 - s) / 2).toFixed(2), (s + 2), ((s - 1) / 2).toFixed(2), |
| 7817 | ((s - 1) / 2).toFixed(2), 0, ((1 - s) / 2).toFixed(2), 0, 0, 1, 0, 0); |
| 7818 | |
| 7819 | splineForward(curveDet, curveDrawMatrix); |
| 7820 | |
| 7821 | if (!bezierBasisInverse) { |
| 7822 | //bezierBasisInverse = bezierBasisMatrix.get(); |
| 7823 | //bezierBasisInverse.invert(); |
| 7824 | curveToBezierMatrix = new PMatrix3D(); |
| 7825 | } |
| 7826 | |
| 7827 | // TODO only needed for PGraphicsJava2D? if so, move it there |
| 7828 | // actually, it's generally useful for other renderers, so keep it |
| 7829 | // or hide the implementation elsewhere. |
| 7830 | curveToBezierMatrix.set(curveBasisMatrix); |
| 7831 | curveToBezierMatrix.preApply(bezierBasisInverse); |
| 7832 | |
| 7833 | // multiply the basis and forward diff matrices together |
| 7834 | // saves much time since this needn't be done for each curve |
| 7835 | curveDrawMatrix.apply(curveBasisMatrix); |
| 7836 | }; |
| 7837 | |
| 7838 | p.bezierVertex = function bezierVertex() { |
| 7839 | isBezier = true; |
no test coverage detected