shape ops work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@7637 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/qc.htm b/experimental/Intersection/qc.htm
index 6bb96cc..865fc13 100644
--- a/experimental/Intersection/qc.htm
+++ b/experimental/Intersection/qc.htm
@@ -1795,11 +1795,115 @@
{{x = 0, y = 1}, {x = 0, y = 2}, {x = 1, y = 0}, {x = 6, y = 1}}
</div>
+<div id="cubicOp2d">
+{{0,2}, {0,1}, {1,0}, {1,0}},
+{{0,1}, {0,1}, {2,0}, {1,0}},
+ {{0,2}, {0.0185185185,1.49074074}, {0.259259259,1.03703704}},
+ {{0.259259259,1.03703704}, {0.5,0.583333333}, {0.740740741,0.296296296}},
+ {{0.740740741,0.296296296}, {0.981481481,0.00925925926}, {1,0}},
+
+ {{0,1}, {0.01953125,0.9921875}, {0.296875,0.84375}},
+ {{0.296875,0.84375}, {0.57421875,0.6953125}, {0.875,0.5}},
+ {{0.875,0.5}, {1.17578125,0.3046875}, {1.265625,0.15625}},
+ {{1.265625,0.15625}, {1.35546875,0.0078125}, {1,0}},
+</div>
+
+<div id="cubicOp2da">
+{{0.395593847,0.78966024}, {0.576287939,0.496887363}, {0.740740741,0.296296296}},
+{{0.395098308,0.789538003}, {0.634357518,0.657581172}, {0.875,0.5}},
+</div>
+
+<div id="cubicOp3d">
+{{0,1}, {2,3}, {1,0}, {1,0}},
+{{0,1}, {0,1}, {1,0}, {3,2}},
+ {{0,1}, {0.592,1.584}, {0.872,1.664}},
+ {{0.872,1.664}, {1.152,1.744}, {1.216,1.512}},
+ {{1.216,1.512}, {1.28,1.28}, {1.224,0.928}},
+ {{1.224,0.928}, {1.168,0.576}, {1.088,0.296}},
+ {{1.088,0.296}, {1.008,0.016}, {1,0}},
+
+ {{0,1}, {0,0.962962963}, {0.333333333,0.814814815}},
+ {{0.333333333,0.814814815}, {0.666666667,0.666666667}, {1.33333333,0.851851852}},
+ {{1.33333333,0.851851852}, {2,1.03703704}, {3,2}},
+</div>
+
+<div id="cubicOp3da">
+{{1.224,0.928}, {1.17328164,0.604609714}, {1.09894996,0.336624845}},
+{{1.09895195,0.33662897}, {1.22307655,0.2359436}, {1.265625,0.15625}},
+</div>
+
+<div id="cubicOp3db">
+{{x = 1.2071879545809394, y = 0.82163474041730045}, {x = 1.1534203513372994, y = 0.52790870069930229}, {x = 1.0880000000000001, y = 0.29599999999999982}}
+{{x = 1.205732763658403, y = 0.81345617746834109}, {x = 1.267928895828891, y = 0.83008534558465619}, {x = 1.3333333333333333, y = 0.85185185185185175}}
+</div>
+
+<div id="cubicOp3dc">
+part=(1.20718795,0.82163474 1.17452925,0.632190117 1.1284272,0.444233064 1.088,0.296)
+quad=(1.20718795,0.82163474 1.15342035,0.527908701 1.088,0.296)
+part=(1.20573276,0.813456177 1.24719685,0.824565605 1.28973037,0.837317532 1.33333333,0.851851852)
+quad=(1.20573276,0.813456177 1.2679289,0.830085346 1.33333333,0.851851852)
+</div>
+
+<div id="cubicOp3dd">
+{{1.20718795,0.82163474 1.17452925,0.632190117 1.1284272,0.444233064 1.088,0.296)
+{{1.20718795,0.82163474 1.15342035,0.527908701 1.088,0.296)
+{{1.20568441,0.813443223 1.20570053,0.813447541 1.20571665,0.813451859 1.20573276,0.813456177)
+{{1.20568441,0.813443223 1.20570859,0.8134497 1.20573276,0.813456177)
+{{0.33333333333333326, y = 0.81481481481481488}, {x = 0.63396444791444551, y = 0.68743368362444768}, {x = 1.205732763658403, y = 0.81345617746834109}}
+</div>
+
+<div id="cubicOp3de">
+{{1.2071879545809394,0.82163474041730045}, {1.2065040319428038,0.81766753259119995}, {1.2058123269101506,0.81370135061854221}},
+{{1.205684411948591,0.81344322326274499}, {1.2057085875611198,0.81344969999329253}, {1.205732763658403,0.81345617746834109}},
+</div>
+
+<div id="cubicOp7">
+{{0,1}, {3,4}, {1,0}, {3,0}},
+{{0,1}, {0,3}, {1,0}, {4,3}},
+
+ {{0,1}, {0.837764189,1.83435757}, {1.22841861,2.02640973}},
+ {{1.22841861,2.02640973}, {1.61907304,2.21846188}, {1.74657491,1.9930452}},
+ {{1.74657491,1.9930452}, {1.87407679,1.76762853}, {1.92238332,1.34957962}},
+ {{1.92238332,1.34957962}, {1.97220681,0.867804601}, {2.17393047,0.447689071}},
+ {{2.17393047,0.447689071}, {2.37565413,0.0275735418}, {3,0}},
+
+ {{0,1}, {-0.00234073071,1.60655471}, {0.142631845,1.70125304}},
+ {{0.142631845,1.70125304}, {0.28760442,1.79595137}, {0.60797907,1.68776977}},
+ {{0.60797907,1.68776977}, {1.0447864,1.50810914}, {1.87464474,1.63655092}},
+ {{1.87464474,1.63655092}, {2.70450308,1.76499271}, {4,3}},
+</div>
+
+<div id="cubicOp7a">
+{{x = 1.7465749139282332, y = 1.9930452039527999}, {x = 1.8417960084006277, y = 1.8552583419678612}, {x = 1.8799591210677749, y = 1.6157879692142081}, {x = 1.9223833226085514, y = 1.3495796165215643}}
+{{x = 0.6079790696638232, y = 1.6877697663020552}, {x = 0.90321659591661663, y = 1.6123550739533821}, {x = 1.3173732025571312, y = 1.5065640064343382}, {x = 1.8746447406062119, y = 1.636550924974228}}
+
+{{x = 1.7465749139282332, y = 1.9930452039527999}, {x = 1.8740767879671056, y = 1.7676285282679607}, {x = 1.9223833226085514, y = 1.3495796165215643}}
+{{x = 0.6079790696638232, y = 1.6877697663020552}, {x = 1.0447863962878021, y = 1.5081091374717195}, {x = 1.8746447406062119, y = 1.636550924974228}}
+</div>
+
+<div id="cubicOp7b">
+{{x = 1.7465749139282332, y = 1.9930452039527999}, {x = 1.8417960084006277, y = 1.8552583419678612}, {x = 1.8799591210677749, y = 1.6157879692142081}, {x = 1.9223833226085514, y = 1.3495796165215643}}
+{{x = 1.8746447406062119, y = 1.636550924974228}, {x = 2.4319162786552919, y = 1.7665378435141166}, {x = 3.1323027481129411, y = 2.1323027481129406}, {x = 4, y = 3}}
+{{x = 1.7465749139282332, y = 1.9930452039527999}, {x = 1.8740767879671056, y = 1.7676285282679607}, {x = 1.9223833226085514, y = 1.3495796165215643}}
+{{x = 1.8746447406062119, y = 1.636550924974228}, {x = 2.7045030849246219, y = 1.7649927124767357}, {x = 4, y = 3}}
+</div>
+
</div>
<script type="text/javascript">
var testDivs = [
+ cubicOp7b,
+ cubicOp7a,
+ cubicOp7,
+ cubicOp3de,
+ cubicOp3dd,
+ cubicOp3dc,
+ cubicOp3db,
+ cubicOp3da,
+ cubicOp3d,
+ cubicOp2da,
+ cubicOp2d,
cubicX,
x1,
x2,
@@ -2205,9 +2309,9 @@
xoffset + curve[6] * unit, yoffset + curve[7] * unit);
break;
}
- if (curves == 2) ctx.strokeStyle = curves ? "red" : "blue";
+ ctx.strokeStyle = drawQuads && drawCubics && curve.length == 6 ? "red" : "black";
ctx.stroke();
- if (drawControlLines && curve.length >= 6) {
+ if (drawControlLines && (curve.length == 6 || curve.length == 8)) {
ctx.strokeStyle = "rgba(0,0,0, 0.3)";
ctx.beginPath();
ctx.moveTo(xoffset + curve[0] * unit, yoffset + curve[1] * unit);
@@ -2215,6 +2319,7 @@
ctx.lineTo(xoffset + curve[4] * unit, yoffset + curve[5] * unit);
if (curve.length == 8)
ctx.lineTo(xoffset + curve[6] * unit, yoffset + curve[7] * unit);
+ ctx.lineTo(xoffset + curve[0] * unit, yoffset + curve[1] * unit);
ctx.stroke();
}
if (curveT >= 0 && curveT <= 1) {