| 140 | } |
| 141 | |
| 142 | nodesToPath( nodes ){ |
| 143 | const path = new Path(); |
| 144 | |
| 145 | nodes.forEach( node => { |
| 146 | switch( node.tool ){ |
| 147 | case 'moveTo': |
| 148 | path.moveTo( node.x, -node.y ); |
| 149 | break; |
| 150 | case 'lineTo': |
| 151 | path.lineTo( node.x, -node.y ); |
| 152 | break; |
| 153 | case 'quadraticCurveTo': |
| 154 | path.quadraticCurveTo( node.options.ctrlA.x, -node.options.ctrlA.y, node.x, -node.y ); |
| 155 | break; |
| 156 | case 'bezierCurveTo': |
| 157 | path.bezierCurveTo( node.options.ctrlA.x, -node.options.ctrlA.y, node.options.ctrlB.x, -node.options.ctrlB.y, node.x, -node.y ); |
| 158 | break; |
| 159 | case 'arc': |
| 160 | path.absarc( node.x, -node.y, node.options.radius, -node.options.start, -node.options.end, !node.options.clockwise ); |
| 161 | const pt = Geometry.calcPointOnCircle( node.x, node.y, node.options.radius, node.options.end ); |
| 162 | path.moveTo( pt.x, -pt.y ); |
| 163 | break; |
| 164 | } |
| 165 | }); |
| 166 | |
| 167 | return path; |
| 168 | } |
| 169 | |
| 170 | render(){ |
| 171 | this.renderer.render( this.scene, this.camera ); |