1 #if 0 // Disabled until updated to use current API. 2 // Copyright 2019 Google LLC. 3 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 4 #include "tools/fiddle/examples.h" 5 // HASH=8b8a4cd8a29d22bb9c5e63b70357bd65 6 REG_FIDDLE(Point_CrossProduct, 256, 256, false, 0) { 7 void draw(SkCanvas* canvas) { 8 SkPaint paint; 9 paint.setAntiAlias(true); 10 SkVector vectors[][2] = {{{50, 2}, {-14, 20}}, {{0, 50}, {-50, 0}}, {{-20, 25}, {25, -20}}, 11 {{-20, -24}, {-24, -20}}}; 12 SkPoint center[] = {{32, 32}, {160, 32}, {32, 160}, {160, 160}}; 13 paint.setStrokeWidth(2); 14 for (size_t i = 0; i < 4; ++i) { 15 paint.setColor(SK_ColorRED); 16 canvas->drawLine(center[i], center[i] + vectors[i][0], paint); 17 paint.setColor(SK_ColorBLUE); 18 canvas->drawLine(center[i], center[i] + vectors[i][1], paint); 19 SkString str; 20 SkScalar cross = SkPoint::CrossProduct(vectors[i][1], vectors[i][0]); 21 str.printf("cross = %g", cross); 22 paint.setColor(cross >= 0 ? SK_ColorRED : SK_ColorBLUE); 23 canvas->drawString(str, center[i].fX, center[i].fY, paint); 24 } 25 } 26 } // END FIDDLE 27 #endif // Disabled until updated to use current API. 28