shape ops work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@7864 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/qc.htm b/experimental/Intersection/qc.htm
index 1d9cfa5..db77fa4 100644
--- a/experimental/Intersection/qc.htm
+++ b/experimental/Intersection/qc.htm
@@ -2065,11 +2065,34 @@
{{2.16505631,2.55782454}, {2.40541285,2.02193091}, {2.99836023,1.68247638}},
</div>
+<div id="cubicOp30d">
+{{0,1}, {2,5}, {6,0}, {5,3}},
+{{0,6}, {3,5}, {1,0}, {5,2}},
+
+ {{0,1}, {0.585028897,2.1161006}, {1.31572211,2.42528354}},
+ {{1.31572211,2.42528354}, {2.04641532,2.73446648}, {2.77656625,2.5918049}},
+ {{2.77656625,2.5918049}, {3.50671719,2.44914333}, {4.09011926,2.20971038}},
+ {{4.09011926,2.20971038}, {4.74608133,1.9335932}, {5.02469918,2.00694987}},
+ {{5.02469918,2.00694987}, {5.30331702,2.08030653}, {5,3}},
+
+ {{0,6}, {0.946962644,5.64705935}, {1.35765232,4.89865813}},
+ {{1.35765232,4.89865813}, {1.768342,4.1502569}, {1.97833659,3.34197296}},
+ {{1.97833659,3.34197296}, {2.2269947,2.25886123}, {2.79472921,1.73568666}},
+ {{2.79472921,1.73568666}, {3.36246373,1.21251209}, {5,2}},
+</div>
+
+<div id="quadOp30d">
+ {{4.09011926,2.20971038}, {4.74608133,1.9335932}, {5.02469918,2.00694987}},
+ {{2.79472921,1.73568666}, {3.36246373,1.21251209}, {5,2}},
+</div>
+
</div>
<script type="text/javascript">
var testDivs = [
+ quadOp30d,
+ cubicOp30d,
quadOp27d,
cubicOp27d,
quadSelf1,
@@ -2345,6 +2368,7 @@
var drawQuads = true;
var drawControlLines = true;
var drawTangents = false;
+var drawGrid = true;
var xmin, xmax, ymin, ymax;
function parse(test, title) {
@@ -2448,35 +2472,38 @@
var unit = scale * ticks;
ctx.lineWidth = 1;
- var i;
- for (i = 0; i <= rows * ticks; ++i) {
- ctx.strokeStyle = (i % ticks) != 0 ? "rgb(200,200,200)" : "black";
- ctx.beginPath();
- ctx.moveTo(at_x + 0, at_y + i * minScale);
- ctx.lineTo(at_x + ticks * columns * minScale, at_y + i * minScale);
- ctx.stroke();
+ if (drawGrid) {
+ var i;
+ for (i = 0; i <= rows * ticks; ++i) {
+ ctx.strokeStyle = (i % ticks) != 0 ? "rgb(200,200,200)" : "black";
+ ctx.beginPath();
+ ctx.moveTo(at_x + 0, at_y + i * minScale);
+ ctx.lineTo(at_x + ticks * columns * minScale, at_y + i * minScale);
+ ctx.stroke();
+ }
+ for (i = 0; i <= columns * ticks; ++i) {
+ ctx.strokeStyle = (i % ticks) != 0 ? "rgb(200,200,200)" : "black";
+ ctx.beginPath();
+ ctx.moveTo(at_x + i * minScale, at_y + 0);
+ ctx.lineTo(at_x + i * minScale, at_y + ticks * rows * minScale);
+ ctx.stroke();
+ }
}
- for (i = 0; i <= columns * ticks; ++i) {
- ctx.strokeStyle = (i % ticks) != 0 ? "rgb(200,200,200)" : "black";
- ctx.beginPath();
- ctx.moveTo(at_x + i * minScale, at_y + 0);
- ctx.lineTo(at_x + i * minScale, at_y + ticks * rows * minScale);
- ctx.stroke();
- }
-
var xoffset = xStart * -unit + at_x;
var yoffset = yStart * -unit + at_y;
- ctx.fillStyle = "rgb(40,80,60)"
- for (i = 0; i <= columns; i += 1)
- {
- num = xStart + i / subscale;
- ctx.fillText(num.toFixed(decimal_places), xoffset + num * unit - 5, 10);
- }
- for (i = 0; i <= rows; i += 1)
- {
- num = yStart + i / subscale;
- ctx.fillText(num.toFixed(decimal_places), 0, yoffset + num * unit + 0);
+ ctx.fillStyle = "rgb(40,80,60)"
+ if (drawGrid) {
+ for (i = 0; i <= columns; i += 1)
+ {
+ num = xStart + i / subscale;
+ ctx.fillText(num.toFixed(decimal_places), xoffset + num * unit - 5, 10);
+ }
+ for (i = 0; i <= rows; i += 1)
+ {
+ num = yStart + i / subscale;
+ ctx.fillText(num.toFixed(decimal_places), 0, yoffset + num * unit + 0);
+ }
}
var curves, pts;
for (curves in test) {
@@ -2609,6 +2636,10 @@
}
redraw();
break;
+ case 'g':
+ drawGrid ^= true;
+ redraw();
+ break;
case 'l':
drawControlLines ^= true;
redraw();