Handle emitting a specific segment of Catmull-Rom curve. This can be overridden by subclasses that need more efficient rendering options.
(float x1, float y1,
float x2, float y2,
float x3, float y3,
float x4, float y4)
| 2404 | * overridden by subclasses that need more efficient rendering options. |
| 2405 | */ |
| 2406 | protected void curveVertexSegment(float x1, float y1, |
| 2407 | float x2, float y2, |
| 2408 | float x3, float y3, |
| 2409 | float x4, float y4) { |
| 2410 | float x0 = x2; |
| 2411 | float y0 = y2; |
| 2412 | |
| 2413 | PMatrix3D draw = curveDrawMatrix; |
| 2414 | |
| 2415 | float xplot1 = draw.m10*x1 + draw.m11*x2 + draw.m12*x3 + draw.m13*x4; |
| 2416 | float xplot2 = draw.m20*x1 + draw.m21*x2 + draw.m22*x3 + draw.m23*x4; |
| 2417 | float xplot3 = draw.m30*x1 + draw.m31*x2 + draw.m32*x3 + draw.m33*x4; |
| 2418 | |
| 2419 | float yplot1 = draw.m10*y1 + draw.m11*y2 + draw.m12*y3 + draw.m13*y4; |
| 2420 | float yplot2 = draw.m20*y1 + draw.m21*y2 + draw.m22*y3 + draw.m23*y4; |
| 2421 | float yplot3 = draw.m30*y1 + draw.m31*y2 + draw.m32*y3 + draw.m33*y4; |
| 2422 | |
| 2423 | // vertex() will reset splineVertexCount, so save it |
| 2424 | int savedCount = curveVertexCount; |
| 2425 | |
| 2426 | vertex(x0, y0); |
| 2427 | for (int j = 0; j < curveDetail; j++) { |
| 2428 | x0 += xplot1; xplot1 += xplot2; xplot2 += xplot3; |
| 2429 | y0 += yplot1; yplot1 += yplot2; yplot2 += yplot3; |
| 2430 | vertex(x0, y0); |
| 2431 | } |
| 2432 | curveVertexCount = savedCount; |
| 2433 | } |
| 2434 | |
| 2435 | |
| 2436 | /** |