aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental
diff options
context:
space:
mode:
authorGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:14:13 +0000
committerGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:14:13 +0000
commitd6176b0dcacb124539e0cfd051e6d93a9782f020 (patch)
tree9e6f4b465e54c9b26e1ba70cd8890b55abb08464 /experimental
parentfbfcd5602128ec010c82cb733c9cdc0a3254f9f3 (diff)
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part II of IV (I broke down the 1280 files into 4 CLs). Review URL: https://codereview.appspot.com/6474054 git-svn-id: http://skia.googlecode.com/svn/trunk@5263 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental')
-rw-r--r--experimental/Debugger/DebuggerCommandsView.cpp18
-rw-r--r--experimental/Debugger/DebuggerContentView.cpp66
-rw-r--r--experimental/Debugger/DebuggerStateView.cpp6
-rw-r--r--experimental/Debugger/DebuggerViews.h8
-rw-r--r--experimental/Debugger/SkDebugDumper.cpp32
-rw-r--r--experimental/Debugger/SkDebugDumper.h4
-rw-r--r--experimental/DrawingBoard/SampleDrawingClient.cpp74
-rw-r--r--experimental/DrawingBoard/SampleDrawingServer.cpp54
-rw-r--r--experimental/DrawingBoard/SkColorPalette.cpp58
-rw-r--r--experimental/DrawingBoard/SkNetPipeController.cpp10
-rw-r--r--experimental/DrawingBoard/SkNetPipeController.h8
-rw-r--r--experimental/FileReaderApp/ReaderView.cpp22
-rw-r--r--experimental/FileReaderApp/ReaderView.h6
-rwxr-xr-xexperimental/Intersection/ActiveEdge_Test.cpp4
-rw-r--r--experimental/Intersection/ConvexHull.cpp12
-rw-r--r--experimental/Intersection/ConvexHull_Test.cpp28
-rw-r--r--experimental/Intersection/CubeRoot.cpp400
-rw-r--r--experimental/Intersection/CubicBezierClip.cpp10
-rw-r--r--experimental/Intersection/CubicIntersection.cpp18
-rw-r--r--experimental/Intersection/CubicIntersection_TestData.cpp8
-rw-r--r--experimental/Intersection/CubicParameterization.cpp182
-rw-r--r--experimental/Intersection/CubicParameterizationCode.cpp126
-rw-r--r--experimental/Intersection/CubicParameterization_Test.cpp2
-rw-r--r--experimental/Intersection/CubicReduceOrder.cpp6
-rw-r--r--experimental/Intersection/CubicReduceOrder_Test.cpp8
-rw-r--r--experimental/Intersection/CubicSubDivide.cpp18
-rw-r--r--experimental/Intersection/DataTypes.cpp12
-rw-r--r--experimental/Intersection/DataTypes.h12
-rw-r--r--experimental/Intersection/EdgeDemo.cpp2
-rw-r--r--experimental/Intersection/EdgeWalker.cpp74
-rwxr-xr-xexperimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp2
-rw-r--r--experimental/Intersection/EdgeWalkerPolygons_Test.cpp12
-rw-r--r--experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp2
-rw-r--r--experimental/Intersection/EdgeWalkerRectangles_Test.cpp26
-rw-r--r--experimental/Intersection/EdgeWalker_Test.h2
-rw-r--r--experimental/Intersection/IntersectionUtilities.cpp4
-rw-r--r--experimental/Intersection/IntersectionUtilities.h2
-rw-r--r--experimental/Intersection/Intersection_Tests.cpp2
-rw-r--r--experimental/Intersection/Intersections.h2
-rw-r--r--experimental/Intersection/LineCubicIntersection.cpp22
-rw-r--r--experimental/Intersection/LineIntersection.cpp6
-rw-r--r--experimental/Intersection/LineIntersection_Test.cpp2
-rw-r--r--experimental/Intersection/LineParameterization.cpp4
-rw-r--r--experimental/Intersection/LineParameters.h14
-rw-r--r--experimental/Intersection/LineParameteters_Test.cpp4
-rw-r--r--experimental/Intersection/LineQuadraticIntersection.cpp30
-rw-r--r--experimental/Intersection/LineQuadraticIntersection_Test.cpp6
-rw-r--r--experimental/Intersection/LineUtilities.cpp8
-rw-r--r--experimental/Intersection/QuadraticBezierClip.cpp10
-rw-r--r--experimental/Intersection/QuadraticIntersection.cpp24
-rw-r--r--experimental/Intersection/QuadraticParameterization.cpp2
-rw-r--r--experimental/Intersection/QuadraticParameterization_Test.cpp2
-rw-r--r--experimental/Intersection/QuadraticReduceOrder.cpp2
-rw-r--r--experimental/Intersection/QuadraticSubDivide.cpp2
-rw-r--r--experimental/Intersection/QuadraticUtilities.cpp2
-rw-r--r--experimental/Intersection/Simplify.cpp126
-rw-r--r--experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp6
-rw-r--r--experimental/Intersection/SimplifyFindNext_Test.cpp4
-rw-r--r--experimental/Intersection/SimplifyNew_Test.cpp2
-rw-r--r--experimental/Intersection/SimplifyRect4x4_Test.cpp30
-rw-r--r--experimental/Intersection/SkAntiEdge.cpp10
-rw-r--r--experimental/Networking/SampleNetPipeReader.cpp24
-rw-r--r--experimental/Networking/SkSockets.cpp22
-rw-r--r--experimental/Networking/SkSockets.h36
-rw-r--r--experimental/SkSetPoly3To3.cpp10
-rw-r--r--experimental/SkSetPoly3To3_A.cpp10
-rw-r--r--experimental/SkSetPoly3To3_D.cpp6
-rw-r--r--experimental/iOSSampleApp/Shared/SkOptionListController.h2
-rw-r--r--experimental/iOSSampleApp/SkSampleUIView.h6
69 files changed, 888 insertions, 888 deletions
diff --git a/experimental/Debugger/DebuggerCommandsView.cpp b/experimental/Debugger/DebuggerCommandsView.cpp
index bd1fe03b61..735c808a59 100644
--- a/experimental/Debugger/DebuggerCommandsView.cpp
+++ b/experimental/Debugger/DebuggerCommandsView.cpp
@@ -12,7 +12,7 @@ DebuggerCommandsView::DebuggerCommandsView() {
fTopIndex = 0;
fHighlight = 0;
fResizing = false;
-
+
SkPaint p;
p.setTextSize(SkIntToScalar(SKDEBUGGER_TEXTSIZE));
fSpacing = p.getFontSpacing();
@@ -42,7 +42,7 @@ void DebuggerCommandsView::alignCenter() {
if (!fCentered || fHighlight < fRange/2 || fHighlight > (fList.count() - fRange/2)) {
return;
} else {
- if (fHighlight > (fTopIndex + fRange/2))
+ if (fHighlight > (fTopIndex + fRange/2))
fTopIndex += fHighlight - (fTopIndex + fRange/2);
if (fHighlight < (fTopIndex + fRange/2))
fTopIndex -= (fTopIndex + fRange/2) - fHighlight;
@@ -115,30 +115,30 @@ void DebuggerCommandsView::toggleCentered() {
void DebuggerCommandsView::onDraw(SkCanvas* canvas) {
canvas->drawColor(fBGColor);
-
+
SkPaint p;
p.setTextSize(SkIntToScalar(SKDEBUGGER_TEXTSIZE));
p.setAntiAlias(true);
-
+
//draw highlight
int selected = fHighlight - fTopIndex;
SkRect r = {0, fSpacing * selected, this->width(), fSpacing * (selected+1)};
p.setColor(SKDEBUGGER_HIGHLIGHTCOLOR);
canvas->drawRect(r, p);
-
- int endIndex = fTopIndex + fRange;
+
+ int endIndex = fTopIndex + fRange;
if (endIndex > fList.count())
endIndex = fList.count();
-
+
p.setColor(SKDEBUGGER_TEXTCOLOR);
int pos;
for (int i = fTopIndex; i < endIndex; ++i) {
pos = i - fTopIndex;
- canvas->drawText(fList[i]->c_str(), fList[i]->size(),
+ canvas->drawText(fList[i]->c_str(), fList[i]->size(),
0, fSpacing - 2 + fSpacing * pos, p);
}
p.setColor(SKDEBUGGER_RESIZEBARCOLOR);
- r = SkRect::MakeXYWH(this->width() - SKDEBUGGER_RESIZEBARSIZE, 0,
+ r = SkRect::MakeXYWH(this->width() - SKDEBUGGER_RESIZEBARSIZE, 0,
SKDEBUGGER_RESIZEBARSIZE, this->height());
canvas->drawRect(r, p);
}
diff --git a/experimental/Debugger/DebuggerContentView.cpp b/experimental/Debugger/DebuggerContentView.cpp
index 27fc8c6a2a..02ea404c0b 100644
--- a/experimental/Debugger/DebuggerContentView.cpp
+++ b/experimental/Debugger/DebuggerContentView.cpp
@@ -11,44 +11,44 @@ public:
fCommandsResizing = false;
fStateVisible = true;
fStateResizing = false;
-
+
fCommands = new DebuggerCommandsView;
fCommands->setVisibleP(fCommandsVisible);
this->attachChildToFront(fCommands)->unref();
-
+
fState = new DebuggerStateView;
fState->setVisibleP(fStateVisible);
this->attachChildToFront(fState)->unref();
-
+
fAtomsToRead = 0;
fDisplayClip = false;
-
- fDumper = new SkDebugDumper(this->getSinkID(), fCommands->getSinkID(),
+
+ fDumper = new SkDebugDumper(this->getSinkID(), fCommands->getSinkID(),
fState->getSinkID());
-
+
fDumper->unload();
fAtomBounds.reset();
fFrameBounds.reset();
-
+
SkDumpCanvas* dumpCanvas = new SkDumpCanvas(fDumper);
SkGPipeReader* dumpReader = new SkGPipeReader(dumpCanvas);
-
+
if (size > 0) {
int offset = 0;
int frameBound = 0;
size_t bytesRead;
while (static_cast<unsigned>(offset) < size) {
- SkGPipeReader::Status s = dumpReader->playback(data + offset,
- size - offset,
- &bytesRead,
+ SkGPipeReader::Status s = dumpReader->playback(data + offset,
+ size - offset,
+ &bytesRead,
true);
SkASSERT(SkGPipeReader::kError_Status != s);
offset += bytesRead;
-
+
if (SkGPipeReader::kDone_Status == s) {
- fDumper->dump(dumpCanvas, SkDumpCanvas::kNULL_Verb,
+ fDumper->dump(dumpCanvas, SkDumpCanvas::kNULL_Verb,
"End of Frame", NULL);
delete dumpReader;
delete dumpCanvas;
@@ -60,34 +60,34 @@ public:
fFrameBounds.append(1, &frameBound);
}
}
-
+
delete dumpReader;
delete dumpCanvas;
-
+
fDumper->load();
}
-
+
~DebuggerView() {
fAtomBounds.reset();
fFrameBounds.reset();
delete fDumper;
}
-
+
virtual void requestMenu(SkOSMenu* menu) {
menu->setTitle("Debugger");
menu->appendSwitch("Show Commands", "Commands", this->getSinkID(), fCommandsVisible);
menu->appendSwitch("Show State", "State", this->getSinkID(), fStateVisible);
menu->appendSwitch("Display Clip", "Clip", this->getSinkID(), fDisplayClip);
}
-
-
+
+
void goToAtom(int atom) {
if (atom != fAtomsToRead) {
fAtomsToRead = atom;
this->inval(NULL);
}
}
-
+
protected:
virtual bool onQuery(SkEvent* evt) {
if (SampleCode::TitleQ(*evt)) {
@@ -99,7 +99,7 @@ protected:
}
return this->INHERITED::onQuery(evt);
}
-
+
virtual bool onEvent(const SkEvent& evt) {
if (SkOSMenu::FindSwitchState(evt, "Commands", &fCommandsVisible) ||
SkOSMenu::FindSwitchState(evt, "State", &fStateVisible)) {
@@ -117,13 +117,13 @@ protected:
}
return this->INHERITED::onEvent(evt);
}
-
+
virtual void onDrawContent(SkCanvas* canvas) {
if (fData.count() <= 0)
return;
SkAutoCanvasRestore acr(canvas, true);
canvas->translate(fStateOffset, 0);
-
+
int lastFrameBound = fFrameBounds[fAtomsToRead];
int toBeRead = fAtomBounds[fAtomsToRead] - lastFrameBound;
int firstChunk = (fAtomsToRead > 0) ? fAtomBounds[fAtomsToRead - 1] - lastFrameBound: 0;
@@ -132,7 +132,7 @@ protected:
SkGPipeReader* dumpReader = new SkGPipeReader(dumpCanvas);
SkGPipeReader* reader = new SkGPipeReader(canvas);
fDumper->disable();
-
+
int offset = 0;
size_t bytesRead;
SkGPipeReader::Status s;
@@ -163,7 +163,7 @@ protected:
delete reader;
delete dumpReader;
delete dumpCanvas;
-
+
if (fDisplayClip) {
SkPaint p;
p.setColor(0x440000AA);
@@ -173,11 +173,11 @@ protected:
}
}
}
-
+
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
return new Click(this);
}
-
+
virtual bool onClick(SkView::Click* click) {
SkPoint prev = click->fPrev;
SkPoint curr = click->fCurr;
@@ -195,7 +195,7 @@ protected:
fAtomsToRead = fCommands->selectHighlight(
SkScalarFloorToInt(curr.fY));
}
- else
+ else
handled = false;
break;
case SkView::Click::kMoved_State:
@@ -220,7 +220,7 @@ protected:
default:
break;
}
-
+
fStateOffset = fCommands->width();
fState->setSize(this->width() - fStateOffset, fState->height());
fState->setLoc(fStateOffset, this->height() - fState->height());
@@ -228,7 +228,7 @@ protected:
this->inval(NULL);
return handled;
}
-
+
virtual void onSizeChange() {
this->INHERITED::onSizeChange();
fCommands->setSize(CMD_WIDTH, this->height());
@@ -236,7 +236,7 @@ protected:
fState->setSize(this->width() - CMD_WIDTH, SkFloatToScalar(INFO_HEIGHT));
fState->setLoc(CMD_WIDTH, this->height() - SkFloatToScalar(INFO_HEIGHT));
}
-
+
private:
DebuggerCommandsView* fCommands;
DebuggerStateView* fState;
@@ -251,7 +251,7 @@ private:
SkTDArray<int> fFrameBounds;
SkTDArray<char> fData;
SkDebugDumper* fDumper;
-
+
typedef SampleView INHERITED;
};
@@ -264,5 +264,5 @@ SkView* create_debugger(const char* data, size_t size) {
bool is_debugger(SkView* view) {
SkEvent isDebugger(gIsDebuggerQuery);
- return view->doQuery(&isDebugger);
+ return view->doQuery(&isDebugger);
}
diff --git a/experimental/Debugger/DebuggerStateView.cpp b/experimental/Debugger/DebuggerStateView.cpp
index aaf6fb5dcf..27befcbaa0 100644
--- a/experimental/Debugger/DebuggerStateView.cpp
+++ b/experimental/Debugger/DebuggerStateView.cpp
@@ -18,7 +18,7 @@ bool DebuggerStateView::onEvent(const SkEvent& evt) {
if (evt.isType(SKDEBUGGER_STATETYPE)) {
fMatrix = evt.findString(SKDEBUGGER_MATRIX);
fClip = evt.findString(SKDEBUGGER_CLIP);
-
+
SkPaint* ptr;
if (evt.getMetaData().findPtr(SKDEBUGGER_PAINT, (void**)&ptr)) {
fPaint = *ptr;
@@ -32,7 +32,7 @@ bool DebuggerStateView::onEvent(const SkEvent& evt) {
void DebuggerStateView::onDraw(SkCanvas* canvas) {
canvas->drawColor(fBGColor);
-
+
//Display Current Paint
SkRect r = {10, 20, 40, 50};
canvas->drawRect(r, fPaint);
@@ -44,7 +44,7 @@ void DebuggerStateView::onDraw(SkCanvas* canvas) {
canvas->drawText(fPaintInfo.c_str(), fPaintInfo.size(), x, 30, p);
canvas->drawText(fMatrix.c_str(), fMatrix.size(), x, 60, p);
canvas->drawText(fClip.c_str(), fClip.size(), x, 90, p);
-
+
p.setColor(SKDEBUGGER_RESIZEBARCOLOR);
r = SkRect::MakeXYWH(0, 0, this->width(), SKDEBUGGER_RESIZEBARSIZE);
canvas->drawRect(r, p);
diff --git a/experimental/Debugger/DebuggerViews.h b/experimental/Debugger/DebuggerViews.h
index f025c79755..c63283f895 100644
--- a/experimental/Debugger/DebuggerViews.h
+++ b/experimental/Debugger/DebuggerViews.h
@@ -37,7 +37,7 @@
class DebuggerStateView : public SkView {
public:
DebuggerStateView();
-
+
protected:
virtual bool onEvent(const SkEvent& evt);
virtual void onDraw(SkCanvas* canvas);
@@ -65,7 +65,7 @@ public:
void highlight(int index);
int selectHighlight(int ypos);
void toggleCentered();
-
+
protected:
virtual bool onEvent(const SkEvent& evt);
virtual void onSizeChange();
@@ -87,7 +87,7 @@ private:
static void* PaintProc(void* ptr, bool doRef) {
SkPaint* p = (SkPaint*) ptr;
-
+
if (doRef) {
return new SkPaint(*p);
}
@@ -95,6 +95,6 @@ static void* PaintProc(void* ptr, bool doRef) {
delete p;
return NULL;
}
-
+
}
diff --git a/experimental/Debugger/SkDebugDumper.cpp b/experimental/Debugger/SkDebugDumper.cpp
index 69b1896626..cfda184ebe 100644
--- a/experimental/Debugger/SkDebugDumper.cpp
+++ b/experimental/Debugger/SkDebugDumper.cpp
@@ -16,7 +16,7 @@
#include "SkMaskFilter.h"
#include "DebuggerViews.h"
-SkDebugDumper::SkDebugDumper(SkEventSinkID cID, SkEventSinkID clID,
+SkDebugDumper::SkDebugDumper(SkEventSinkID cID, SkEventSinkID clID,
SkEventSinkID ipID) {
fContentID = cID;
fCommandsID = clID;
@@ -43,17 +43,17 @@ static SkString dumpMatrix(SkDumpCanvas* canvas) {
SkString str;
SkMatrix m = canvas->getTotalMatrix();
str.append("Matrix:");
- str.appendf("Translate (%0.4g, %0.4g) ",
- SkScalarToFloat(m.get(SkMatrix::kMTransX)),
+ str.appendf("Translate (%0.4g, %0.4g) ",
+ SkScalarToFloat(m.get(SkMatrix::kMTransX)),
SkScalarToFloat(m.get(SkMatrix::kMTransY)));
- str.appendf("Scale (%0.4g, %0.4g) ",
- SkScalarToFloat(m.get(SkMatrix::kMScaleX)),
+ str.appendf("Scale (%0.4g, %0.4g) ",
+ SkScalarToFloat(m.get(SkMatrix::kMScaleX)),
SkScalarToFloat(m.get(SkMatrix::kMScaleY)));
- str.appendf("Skew (%0.4g, %0.4g) ",
- SkScalarToFloat(m.get(SkMatrix::kMSkewX)),
+ str.appendf("Skew (%0.4g, %0.4g) ",
+ SkScalarToFloat(m.get(SkMatrix::kMSkewX)),
SkScalarToFloat(m.get(SkMatrix::kMSkewY)));
- str.appendf("Perspective (%0.4g, %0.4g, %0.4g) ",
- SkScalarToFloat(SkPerspToScalar(m.get(SkMatrix::kMPersp0))),
+ str.appendf("Perspective (%0.4g, %0.4g, %0.4g) ",
+ SkScalarToFloat(SkPerspToScalar(m.get(SkMatrix::kMPersp0))),
SkScalarToFloat(SkPerspToScalar(m.get(SkMatrix::kMPersp1))),
SkScalarToFloat(SkPerspToScalar(m.get(SkMatrix::kMPersp2))));
return str;
@@ -67,7 +67,7 @@ static SkString dumpClip(SkDumpCanvas* canvas) {
if (canvas->getTotalClip().getBoundaryPath(&p)) {
SkPoint pts[maxPts];
int numPts = p.getPoints(pts, maxPts);
-
+
str.append("Clip: [ ");
for (int i = 0; i < numPts; ++i) {
str.appendf("(%0.4g, %0.4g)", pts[i].x(), pts[i].y());
@@ -99,7 +99,7 @@ static const char* gPaintFlags[] = {
static SkString dumpPaint(SkDumpCanvas* canvas, const SkPaint* p,
SkDumpCanvas::Verb verb) {
SkString str;
- str.appendf("Color: #%08X\n", p->getColor());
+ str.appendf("Color: #%08X\n", p->getColor());
str.appendf("Flags: %s\n", gPaintFlags[p->getFlags()]);
appendFlattenable(&str, p->getShader(), "shader");
appendFlattenable(&str, p->getXfermode(), "xfermode");
@@ -107,26 +107,26 @@ static SkString dumpPaint(SkDumpCanvas* canvas, const SkPaint* p,
appendFlattenable(&str, p->getMaskFilter(), "maskFilter");
appendFlattenable(&str, p->getPathEffect(), "pathEffect");
appendFlattenable(&str, p->getColorFilter(), "filter");
-
+
if (SkDumpCanvas::kDrawText_Verb == verb) {
str.appendf("Text Size:%0.4g\n", SkScalarToFloat(p->getTextSize()));
appendPtr(&str, p->getTypeface(), "typeface");
}
-
+
return str;
}
void SkDebugDumper::dump(SkDumpCanvas* canvas, SkDumpCanvas::Verb verb,
- const char str[], const SkPaint* p) {
+ const char str[], const SkPaint* p) {
if (!fDisabled) {
SkString msg, tab;
-
+
const int level = canvas->getNestLevel() + canvas->getSaveCount() - 1;
SkASSERT(level >= 0);
for (int i = 0; i < level; i++) {
tab.append("| ");
}
-
+
msg.appendf("%03d: %s%s\n", fCount, tab.c_str(), str);
++fCount;
if (!fInit) {
diff --git a/experimental/Debugger/SkDebugDumper.h b/experimental/Debugger/SkDebugDumper.h
index fdc7e0fc64..e7d69562d5 100644
--- a/experimental/Debugger/SkDebugDumper.h
+++ b/experimental/Debugger/SkDebugDumper.h
@@ -20,7 +20,7 @@ public:
// the function pointer that was passed to the constructor
virtual void dump(SkDumpCanvas*, SkDumpCanvas::Verb, const char str[],
const SkPaint*);
-
+
void load() { fInit = true; };
void unload() { fInit = false; fCount = 0;};
void disable() { fDisabled = true; };
@@ -32,7 +32,7 @@ private:
SkEventSinkID fContentID;
SkEventSinkID fCommandsID;
SkEventSinkID fStateID;
-
+
typedef SkDumpCanvas::Dumper INHERITED;
};
#endif
diff --git a/experimental/DrawingBoard/SampleDrawingClient.cpp b/experimental/DrawingBoard/SampleDrawingClient.cpp
index 02b7a3b4f7..fbefbc8f12 100644
--- a/experimental/DrawingBoard/SampleDrawingClient.cpp
+++ b/experimental/DrawingBoard/SampleDrawingClient.cpp
@@ -12,22 +12,22 @@
/**
* Drawing Client
*
- * A drawing client that allows a user to perform simple brush stokes with
- * a selected color and brush size. The drawing client communicates with a
+ * A drawing client that allows a user to perform simple brush stokes with
+ * a selected color and brush size. The drawing client communicates with a
* drawing server to send/receive data to/from other clients connected to the
* same server. The drawing client stores data in fData and fBuffer depending on
* the data type. Append type means that the drawing data is a completed stroke
- * and Replace type means that the drawing data is in progress and will be
- * replaced by subsequent data. fData and fBuffer are read by a pipe reader and
+ * and Replace type means that the drawing data is in progress and will be
+ * replaced by subsequent data. fData and fBuffer are read by a pipe reader and
* reproduce the drawing. When the client is in a normal state, the data stored
* on the client and the server should be identical.
* The drawing client is also able to switch between vector and bitmap drawing.
* The drawing client also renders the latest drawing stroke locally in order to
- * produce better reponses. This can be disabled by calling
- * controller.disablePlayBack(), which will introduce a lag between the input
+ * produce better reponses. This can be disabled by calling
+ * controller.disablePlayBack(), which will introduce a lag between the input
* and the drawing.
* Note: in order to keep up with the drawing data, the client will try to read
- * a few times each frame in case more than one frame worth of data has been
+ * a few times each frame in case more than one frame worth of data has been
* received and render them together. This behavior can be adjusted by tweaking
* MAX_READ_PER_FRAME or disabled by turning fSync to false
*/
@@ -36,7 +36,7 @@
class DrawingClientView : public SampleView {
public:
- DrawingClientView() {
+ DrawingClientView() {
fSocket = NULL;
fTotalBytesRead = 0;
fPalette = new SkColorPalette;
@@ -57,29 +57,29 @@ public:
fData.reset();
fBuffer.reset();
}
-
+
virtual void requestMenu(SkOSMenu* menu) {
menu->setTitle("Drawing Client");
- menu->appendTextField("Server IP", "Server IP", this->getSinkID(),
+ menu->appendTextField("Server IP", "Server IP", this->getSinkID(),
"IP address or hostname");
menu->appendSwitch("Vector", "Vector", this->getSinkID(), fVector);
- menu->appendSlider("Brush Size", "Brush Size", this->getSinkID(), 1.0,
+ menu->appendSlider("Brush Size", "Brush Size", this->getSinkID(), 1.0,
100.0, fBrushSize);
menu->appendSwitch("Anti-Aliasing", "AA", this->getSinkID(), fAA);
- menu->appendSwitch("Show Color Palette", "Palette", this->getSinkID(),
+ menu->appendSwitch("Show Color Palette", "Palette", this->getSinkID(),
fPaletteVisible);
menu->appendSwitch("Sync", "Sync", this->getSinkID(), fSync);
menu->appendAction("Clear", this->getSinkID());
}
-
+
protected:
-
+
static void readData(int cid, const void* data, size_t size,
SkSocket::DataType type, void* context) {
DrawingClientView* view = (DrawingClientView*)context;
view->onRead(cid, data, size, type);
}
-
+
void onRead(int cid, const void* data, size_t size, SkSocket::DataType type) {
if (size > 0) {
fBuffer.reset();
@@ -92,20 +92,20 @@ protected:
}
}
}
-
+
bool onQuery(SkEvent* evt) {
if (SampleCode::TitleQ(*evt)) {
SampleCode::TitleR(evt, "Drawing Client");
return true;
}
-
+
return this->INHERITED::onQuery(evt);
}
-
+
bool onEvent(const SkEvent& evt) {;
if (SkOSMenu::FindSliderValue(evt, "Brush Size", &fBrushSize))
return true;
-
+
SkString s;
if (SkOSMenu::FindText(evt, "Server IP", &s)) {
if (NULL != fSocket) {
@@ -137,11 +137,11 @@ protected:
}
return this->INHERITED::onEvent(evt);
}
-
+
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
return new Click(this);
}
-
+
virtual bool onClick(SkView::Click* click) {
switch (click->fState) {
case SkView::Click::kDown_State:
@@ -161,20 +161,20 @@ protected:
}
return true;
}
-
+
virtual void onDrawContent(SkCanvas* canvas) {
if (fSocket) {
if (fSocket->isConnected()) {
if (fSync) {
int count = 0;
while (fSocket->readPacket(readData, this) > 0 &&
- count < MAX_READ_PER_FRAME)
+ count < MAX_READ_PER_FRAME)
++count;
}
- else
+ else
fSocket->readPacket(readData, this);
}
- else
+ else
fSocket->connectToServer();
}
size_t bytesRead = 0;
@@ -186,7 +186,7 @@ protected:
tempCanvas = canvas;
else
tempCanvas = &bufferCanvas;
- SkGPipeReader reader(tempCanvas);
+ SkGPipeReader reader(tempCanvas);
status = reader.playback(fData.begin() + fTotalBytesRead,
fData.count() - fTotalBytesRead,
&bytesRead);
@@ -197,22 +197,22 @@ protected:
fTotalBytesRead = 0;
else
canvas->drawBitmap(fBase, 0, 0, NULL);
-
+
size_t totalBytesRead = 0;
while (totalBytesRead < fBuffer.count()) {
SkGPipeReader reader(canvas);
- status = reader.playback(fBuffer.begin() + totalBytesRead,
- fBuffer.count() - totalBytesRead,
+ status = reader.playback(fBuffer.begin() + totalBytesRead,
+ fBuffer.count() - totalBytesRead,
&bytesRead);
SkASSERT(SkGPipeReader::kError_Status != status);
totalBytesRead += bytesRead;
}
-
+
SkNetPipeController controller(canvas);
SkGPipeWriter writer;
- SkCanvas* writerCanvas = writer.startRecording(&controller,
+ SkCanvas* writerCanvas = writer.startRecording(&controller,
SkGPipeWriter::kCrossProcess_Flag);
-
+
//controller.disablePlayback();
SkPaint p;
p.setColor(fPalette->getColor());
@@ -224,16 +224,16 @@ protected:
p.setPathEffect(new SkCornerPathEffect(55))->unref();
writerCanvas->drawPath(fCurrLine, p);
writer.endRecording();
-
+
controller.writeToSocket(fSocket, fType);
if (fType == SkSocket::kPipeAppend_type && fSocket) {
fSocket->suspendWrite();
fCurrLine.reset();
}
-
+
this->inval(NULL);
}
-
+
virtual void onSizeChange() {
this->INHERITED::onSizeChange();
fPalette->setLoc(this->width()-100, 0);
@@ -241,7 +241,7 @@ protected:
fBase.allocPixels(NULL);
this->clearBitmap();
}
-
+
private:
void clear() {
fData.reset();
@@ -267,7 +267,7 @@ private:
bool fAA;
bool fSync;
bool fVector;
-
+
typedef SampleView INHERITED;
};
diff --git a/experimental/DrawingBoard/SampleDrawingServer.cpp b/experimental/DrawingBoard/SampleDrawingServer.cpp
index c79f8d3470..fa059fa70a 100644
--- a/experimental/DrawingBoard/SampleDrawingServer.cpp
+++ b/experimental/DrawingBoard/SampleDrawingServer.cpp
@@ -11,14 +11,14 @@
/**
* Drawing Server
*
- * This simple drawing server can accept connections from multiple drawing
- * clients simultaneously. It accumulates drawing data from each client each
+ * This simple drawing server can accept connections from multiple drawing
+ * clients simultaneously. It accumulates drawing data from each client each
* frame, stores it in the appropriate place, and then broadcasts incremental
* changes back to all the clients. Each logical packet, meaning one brush
* stoke in this case can be of two types, append and replace. Append types are
* completed strokes ready to be stored in the fData queue and will no longer be
- * modified. Replace types are drawing operations that are still in progress on
- * the client side, so they are appended to fBuffer. The location and size of
+ * modified. Replace types are drawing operations that are still in progress on
+ * the client side, so they are appended to fBuffer. The location and size of
* the buffered data for each client is stored in a map and updated properly.
* Each time a new replace drawing call is received from a client, its previous
* buffered data is discarded.
@@ -28,7 +28,7 @@
class DrawingServerView : public SampleView {
public:
- DrawingServerView(){
+ DrawingServerView(){
fServer = new SkTCPServer(40000);
fServer->suspendWrite();
fTotalBytesRead = fTotalBytesWritten = 0;
@@ -40,24 +40,24 @@ public:
fBuffer.reset();
fClientMap.clear();
}
-
+
virtual void requestMenu(SkOSMenu* menu) {
menu->setTitle("Drawing Server");
menu->appendAction("Clear", this->getSinkID());
menu->appendSwitch("Vector", "Vector", this->getSinkID(), fVector);
}
-
+
protected:
- static void readData(int cid, const void* data, size_t size,
+ static void readData(int cid, const void* data, size_t size,
SkSocket::DataType type, void* context) {
DrawingServerView* view = (DrawingServerView*)context;
view->onRead(cid, data, size, type);
}
-
+
void onRead(int cid, const void* data, size_t size, SkSocket::DataType type) {
if (NULL == data && size <= 0)
return;
-
+
ClientState* cs;
std::map<int, ClientState*>::iterator it = fClientMap.find(cid);
if (it == fClientMap.end()) { //New client
@@ -69,10 +69,10 @@ protected:
else {
cs = it->second;
}
-
+
if (type == SkSocket::kPipeReplace_type) {
fBuffer.remove(cs->bufferBase, cs->bufferSize);
-
+
for (it = fClientMap.begin(); it != fClientMap.end(); ++it) {
if (cid == it->first)
continue;
@@ -83,7 +83,7 @@ protected:
}
}
}
-
+
cs->bufferBase = fBuffer.count();
cs->bufferSize = size;
fBuffer.append(size, (const char*)data);
@@ -101,7 +101,7 @@ protected:
//other types of data
}
}
-
+
bool onQuery(SkEvent* evt) {
if (SampleCode::TitleQ(*evt)) {
SampleCode::TitleR(evt, "Drawing Server");
@@ -109,7 +109,7 @@ protected:
}
return this->INHERITED::onQuery(evt);
}
-
+
bool onEvent(const SkEvent& evt) {
if (SkOSMenu::FindAction(evt, "Clear")) {
this->clear();
@@ -121,8 +121,8 @@ protected:
}
return this->INHERITED::onEvent(evt);
}
-
-
+
+
virtual void onDrawContent(SkCanvas* canvas) {
if (fCurrMatrix != canvas->getTotalMatrix()) {
fTotalBytesRead = 0;
@@ -136,7 +136,7 @@ protected:
else {
fServer->suspendWrite();
}
-
+
size_t bytesRead;
SkGPipeReader::Status stat;
SkCanvas bufferCanvas(fBase);
@@ -159,7 +159,7 @@ protected:
} else {
canvas->drawBitmap(fBase, 0, 0, NULL);
}
-
+
size_t totalBytesRead = 0;
while (totalBytesRead < fBuffer.count()) {
SkGPipeReader reader(canvas);
@@ -169,22 +169,22 @@ protected:
SkASSERT(SkGPipeReader::kError_Status != stat);
totalBytesRead += bytesRead;
}
-
- fServer->writePacket(fBuffer.begin(), fBuffer.count(),
+
+ fServer->writePacket(fBuffer.begin(), fBuffer.count(),
SkSocket::kPipeReplace_type);
this->inval(NULL);
}
-
+
virtual void onSizeChange() {
this->INHERITED::onSizeChange();
- fBase.setConfig(SkBitmap::kARGB_8888_Config,
- this->width(),
+ fBase.setConfig(SkBitmap::kARGB_8888_Config,
+ this->width(),
this->height());
fBase.allocPixels(NULL);
this->clearBitmap();
}
-
+
private:
void clear() {
fData.reset();
@@ -197,12 +197,12 @@ private:
fTotalBytesRead = 0;
fBase.eraseColor(fBGColor);
}
-
+
struct ClientState {
int bufferBase;
int bufferSize;
};
-
+
std::map<int, ClientState*> fClientMap;
SkTDArray<char> fData;
SkTDArray<char> fBuffer;
diff --git a/experimental/DrawingBoard/SkColorPalette.cpp b/experimental/DrawingBoard/SkColorPalette.cpp
index a7ceb2e703..566c134c0f 100644
--- a/experimental/DrawingBoard/SkColorPalette.cpp
+++ b/experimental/DrawingBoard/SkColorPalette.cpp
@@ -16,7 +16,7 @@ SkColorPalette::SkColorPalette() {
fGradientRect = SkRect::MakeWH(SkIntToScalar(100), SkIntToScalar(100));
fSelected = 0;
fCurrColor = 0xFF000000;
-
+
fColors[0] = SK_ColorWHITE;
fColors[1] = SK_ColorBLACK;
fColors[2] = SK_ColorRED;
@@ -27,15 +27,15 @@ SkColorPalette::SkColorPalette() {
bool SkColorPalette::onEvent(const SkEvent& evt) {
return this->INHERITED::onEvent(evt);
}
-
+
void SkColorPalette::onDraw(SkCanvas* canvas) {
canvas->drawColor(SK_ColorWHITE);
-
+
SkPaint paint;
paint.setAntiAlias(true);
-
+
canvas->translate(PalettePadding, PalettePadding);
-
+
for (int i = 0; i < PaletteSlots; ++i) {
if (fSelected == i) {
paint.setStrokeWidth(SkIntToScalar(3));
@@ -43,7 +43,7 @@ void SkColorPalette::onDraw(SkCanvas* canvas) {
else {
paint.setStrokeWidth(1);
}
-
+
paint.setStyle(SkPaint::kStroke_Style);
paint.setColor(SK_ColorBLACK);
canvas->drawRect(fSlotRect, paint);
@@ -57,16 +57,16 @@ void SkColorPalette::onDraw(SkCanvas* canvas) {
SkPoint p = SkPoint::Make(0,0);
SkPoint q = SkPoint::Make(this->width(), 0);
SkPoint pts[] = {p, q};
-
- SkColor colors[] = { SK_ColorRED, SK_ColorYELLOW, SK_ColorGREEN,
+
+ SkColor colors[] = { SK_ColorRED, SK_ColorYELLOW, SK_ColorGREEN,
SK_ColorCYAN, SK_ColorBLUE, SK_ColorMAGENTA,SK_ColorRED};
SkScalar colorPositions[] = { 0, 0.2, 0.4, 0.5, 0.6, 0.8, 1.0};
-
-
- SkShader* shader1 = SkGradientShader::CreateLinear(pts, colors, colorPositions,7,
+
+
+ SkShader* shader1 = SkGradientShader::CreateLinear(pts, colors, colorPositions,7,
SkShader::kMirror_TileMode);
paint.setShader(shader1)->unref();
-
+
canvas->drawRect(fGradientRect, paint);
//this->INHERITED::onDraw(canvas);
@@ -127,7 +127,7 @@ int SkColorPalette::selectSlot(SkPoint& cursorPosition) {
//account for padding
cursorPosition.fX -= PalettePadding;
cursorPosition.fY -= PalettePadding;
-
+
if (cursorPosition.fX < 0 || cursorPosition.fX > fSlotRect.width() ||
cursorPosition.fY < 0 || cursorPosition.fY > (fSlotRect.height() + PalettePadding) * PaletteSlots) {
return -1;
@@ -143,8 +143,8 @@ int SkColorPalette::selectSlot(SkPoint& cursorPosition) {
}
SkColor SkColorPalette::selectColorFromGradient(SkPoint& cursorPosition) {
- float h = cursorPosition.fX/fGradientRect.width();
- float s = 1.0 - cursorPosition.fY/fGradientRect.height();
+ float h = cursorPosition.fX/fGradientRect.width();
+ float s = 1.0 - cursorPosition.fY/fGradientRect.height();
float v = 1.0;
float _h,r,g,b;
float _1, _2, _3;
@@ -155,38 +155,38 @@ SkColor SkColorPalette::selectColorFromGradient(SkPoint& cursorPosition) {
_1 = v * (1 - s);
_2 = v * (1 - s * (_h - _i));
_3 = v * (1 - s * (1 - (_h - _i)));
-
+
if (_i == 0) {
- r = v;
- g = _3;
+ r = v;
+ g = _3;
b = _1;
}
else if (_i == 1) {
- r = _2;
- g = v;
+ r = _2;
+ g = v;
b = _1;
}
else if (_i == 2) {
- r = _1;
- g = v;
+ r = _1;
+ g = v;
b = _3;
}
else if (_i == 3) {
- r = _1;
- g = _2;
+ r = _1;
+ g = _2;
b = v;
}
else if (_i == 4) {
- r = _3;
- g = _1;
+ r = _3;
+ g = _1;
b = v;
}
else {
- r = v;
- g = _1;
+ r = v;
+ g = _1;
b = _2;
};
-
+
SkColor retval = 0xFF000000;
retval += ((int)(r * 255) << 16);
retval += ((int)(g * 255) << 8);
diff --git a/experimental/DrawingBoard/SkNetPipeController.cpp b/experimental/DrawingBoard/SkNetPipeController.cpp
index 71db86ae78..a61ca64478 100644
--- a/experimental/DrawingBoard/SkNetPipeController.cpp
+++ b/experimental/DrawingBoard/SkNetPipeController.cpp
@@ -21,13 +21,13 @@ SkNetPipeController::~SkNetPipeController() {
int SkNetPipeController::writeToSocket(SkSocket* sockfd, SkSocket::DataType type) {
if (NULL != sockfd && fTotalWritten > 4)
return sockfd->writePacket(fBlock, fBytesWritten, type);
- else
+ else
return -1;
}
void* SkNetPipeController::requestBlock(size_t minRequest, size_t* actual) {
sk_free(fBlock);
-
+
fBlockSize = minRequest * 4;
fBlock = sk_malloc_throw(fBlockSize);
fBytesWritten = 0;
@@ -37,15 +37,15 @@ void* SkNetPipeController::requestBlock(size_t minRequest, size_t* actual) {
void SkNetPipeController::notifyWritten(size_t bytes) {
SkASSERT(fBytesWritten + bytes <= fBlockSize);
-
+
if (fPlayback) {
fStatus = fReader.playback((const char*)fBlock + fBytesWritten, bytes);
}
-
+
SkASSERT(SkGPipeReader::kError_Status != fStatus);
fBytesWritten += bytes;
fTotalWritten += bytes;
-
+
fAtomsWritten += 1;
}
diff --git a/experimental/DrawingBoard/SkNetPipeController.h b/experimental/DrawingBoard/SkNetPipeController.h
index 334fd8cccb..081239bad5 100644
--- a/experimental/DrawingBoard/SkNetPipeController.h
+++ b/experimental/DrawingBoard/SkNetPipeController.h
@@ -14,14 +14,14 @@ class SkNetPipeController : public SkGPipeController {
public:
SkNetPipeController(SkCanvas* target);
~SkNetPipeController();
-
+
virtual void* requestBlock(size_t minRequest, size_t* actual);
virtual void notifyWritten(size_t bytes);
-
+
int writeToSocket(SkSocket* sockfd, SkSocket::DataType type);
void enablePlayback() { fPlayback = true; }
void disablePlayback() { fPlayback = false; }
-
+
private:
SkGPipeReader fReader;
bool fPlayback;
@@ -30,7 +30,7 @@ private:
size_t fBytesWritten;
int fAtomsWritten;
size_t fTotalWritten;
-
+
SkGPipeReader::Status fStatus;
};
#endif
diff --git a/experimental/FileReaderApp/ReaderView.cpp b/experimental/FileReaderApp/ReaderView.cpp
index f6876adeac..78a7a21e28 100644
--- a/experimental/FileReaderApp/ReaderView.cpp
+++ b/experimental/FileReaderApp/ReaderView.cpp
@@ -25,38 +25,38 @@ ReaderView::ReaderView() {
void ReaderView::draw(SkCanvas* canvas) {
canvas->drawColor(fBGColor);
-
+
SkAutoCanvasRestore acr(canvas, true);
-
- //Create a temporary canvas and reader object that draws into the back
+
+ //Create a temporary canvas and reader object that draws into the back
//bitmap so that the incremental changes or incomplete reads are not shown
//on screen
SkCanvas bufferCanvas(fBufferBitmaps[fBack]);
SkGPipeReader reader(&bufferCanvas);
-
+
//The file specified by FILE_PATH MUST exist
FILE* f = fopen(FILE_PATH, "rb");
SkASSERT(f != NULL);
-
+
fseek(f, 0, SEEK_END);
int size = ftell(f) * sizeof(char);
if (size <= fFilePos) {
fFilePos = 0;
}
-
+
//Resume from the last read location
fseek(f, fFilePos, SEEK_SET);
int toBeRead = size - fFilePos;
if (size > 0 && toBeRead > 0) {
void* block = sk_malloc_throw(toBeRead);
fread(block, 1, toBeRead, f);
-
+
size_t bytesRead;
SkGPipeReader::Status fStatus = reader.playback(block, toBeRead, &bytesRead);
SkASSERT(SkGPipeReader::kError_Status != fStatus);
SkASSERT(toBeRead >= bytesRead);
-
- //if the reader reaches a done verb, a frame is complete.
+
+ //if the reader reaches a done verb, a frame is complete.
//Update the file location and swap the front and back bitmaps to show
//the new frame
if (SkGPipeReader::kDone_Status == fStatus) {
@@ -66,9 +66,9 @@ void ReaderView::draw(SkCanvas* canvas) {
}
sk_free(block);
}
-
+
fclose(f);
-
+
//the front bitmap is always drawn
canvas->drawBitmap(fBufferBitmaps[fFront], 0, 0, NULL);
this->inval(NULL);
diff --git a/experimental/FileReaderApp/ReaderView.h b/experimental/FileReaderApp/ReaderView.h
index 5d06777d48..e3032d3a68 100644
--- a/experimental/FileReaderApp/ReaderView.h
+++ b/experimental/FileReaderApp/ReaderView.h
@@ -10,15 +10,15 @@
#include "SkBitmap.h"
/*
- * Pipe Reader with File IO. This view reads from the data file produced by the
- * Pipe Writer.
+ * Pipe Reader with File IO. This view reads from the data file produced by the
+ * Pipe Writer.
*/
class ReaderView : public SkView {
public:
ReaderView();
virtual void draw(SkCanvas* canvas);
-
+
private:
int fFilePos;
int fFront;
diff --git a/experimental/Intersection/ActiveEdge_Test.cpp b/experimental/Intersection/ActiveEdge_Test.cpp
index 5456155abc..d460ba0644 100755
--- a/experimental/Intersection/ActiveEdge_Test.cpp
+++ b/experimental/Intersection/ActiveEdge_Test.cpp
@@ -52,7 +52,7 @@ static bool operator_less_than(const UnitTest::ActiveEdge& lh,
return (check.fY - lh.fAbove.fY) * (lh.fBelow.fX - lh.fAbove.fX)
< (lh.fBelow.fY - lh.fAbove.fY) * (check.fX - lh.fAbove.fX);
}
- const SkPoint& check = lh.fBelow.fY <= rh.fBelow.fY
+ const SkPoint& check = lh.fBelow.fY <= rh.fBelow.fY
&& lh.fBelow != rh.fBelow ? lh.fBelow : lh.fAbove;
return (rh.fBelow.fY - rh.fAbove.fY) * (check.fX - rh.fAbove.fX)
< (check.fY - rh.fAbove.fY) * (rh.fBelow.fX - rh.fAbove.fX);
@@ -66,7 +66,7 @@ void ActiveEdge_Test() {
right.fWorkEdge.fEdge = &rightIn;
for (size_t x = 0; x < leftRightCount; ++x) {
left.fAbove = leftRight[x][0];
- left.fTangent = left.fBelow = leftRight[x][1];
+ left.fTangent = left.fBelow = leftRight[x][1];
right.fAbove = leftRight[x][2];
right.fTangent = right.fBelow = leftRight[x][3];
SkASSERT(left < right);
diff --git a/experimental/Intersection/ConvexHull.cpp b/experimental/Intersection/ConvexHull.cpp
index 1551720eef..f291e7491e 100644
--- a/experimental/Intersection/ConvexHull.cpp
+++ b/experimental/Intersection/ConvexHull.cpp
@@ -5,12 +5,12 @@
/* Given a cubic, find the convex hull described by the end and control points.
The hull may have 3 or 4 points. Cubics that degenerate into a point or line
are not considered.
-
+
The hull is computed by assuming that three points, if unique and non-linear,
form a triangle. The fourth point may replace one of the first three, may be
discarded if in the triangle or on an edge, or may be inserted between any of
the three to form a convex quadralateral.
-
+
The indices returned in order describe the convex hull.
*/
int convex_hull(const Cubic& cubic, char order[4]) {
@@ -71,7 +71,7 @@ int convex_hull(const Cubic& cubic, char order[4]) {
int most = midX ^ mask;
order[0] = yMin;
order[1] = least;
-
+
// see if mid value is on same side of line (least, most) as yMin
Cubic midPath;
if (!rotate(cubic, least, most, midPath)) { // ! if cbc[least]==cbc[most]
@@ -80,7 +80,7 @@ int convex_hull(const Cubic& cubic, char order[4]) {
}
int midSides = side(midPath[yMin].y - midPath[least].y);
midSides ^= side(midPath[midX].y - midPath[least].y);
- if (midSides != 2) { // if mid point is not between
+ if (midSides != 2) { // if mid point is not between
order[2] = most;
return 3; // result is a triangle
}
@@ -91,10 +91,10 @@ int convex_hull(const Cubic& cubic, char order[4]) {
/* Find the convex hull for cubics with the x-axis interval regularly spaced.
Cubics computed as distance functions are formed this way.
-
+
connectTo0[0], connectTo0[1] are the point indices that cubic[0] connects to.
connectTo3[0], connectTo3[1] are the point indices that cubic[3] connects to.
-
+
Returns true if cubic[1] to cubic[2] also forms part of the hull.
*/
bool convex_x_hull(const Cubic& cubic, char connectTo0[2], char connectTo3[2]) {
diff --git a/experimental/Intersection/ConvexHull_Test.cpp b/experimental/Intersection/ConvexHull_Test.cpp
index 4eb524b3bd..a350391eaa 100644
--- a/experimental/Intersection/ConvexHull_Test.cpp
+++ b/experimental/Intersection/ConvexHull_Test.cpp
@@ -46,17 +46,17 @@ const Cubic triangle[] = {
{{1, 0}, {2, 0}, {0, 1}, {0, 0}},
{{2, 0}, {0, 1}, {0, 0}, {1, 0}},
{{0, 1}, {0, 0}, {1, 0}, {2, 0}},
-
+
{{0, 0}, {0, 1}, {0, 2}, {1, 1}}, // extra point on vert
{{0, 1}, {0, 2}, {1, 1}, {0, 0}},
{{0, 2}, {1, 1}, {0, 0}, {0, 1}},
{{1, 1}, {0, 0}, {0, 1}, {0, 2}},
-
+
{{0, 0}, {1, 1}, {2, 2}, {2, 0}}, // extra point on diag
{{1, 1}, {2, 2}, {2, 0}, {0, 0}},
{{2, 2}, {2, 0}, {0, 0}, {1, 1}},
{{2, 0}, {0, 0}, {1, 1}, {2, 2}},
-
+
{{0, 0}, {2, 0}, {2, 2}, {1, 1}}, // extra point on diag
{{2, 0}, {2, 2}, {1, 1}, {0, 0}},
{{2, 2}, {1, 1}, {0, 0}, {2, 0}},
@@ -99,9 +99,9 @@ static bool rotateToAxis(const _Point& a, const _Point& b, Matrix3x2& matrix) {
static void transform(const Cubic& cubic, const Matrix3x2& matrix, Cubic& rotPath) {
for (int index = 0; index < 4; ++index) {
- rotPath[index].x = cubic[index].x * matrix[0][0]
+ rotPath[index].x = cubic[index].x * matrix[0][0]
+ cubic[index].y * matrix[1][0] + matrix[2][0];
- rotPath[index].y = cubic[index].x * matrix[0][1]
+ rotPath[index].y = cubic[index].x * matrix[0][1]
+ cubic[index].y * matrix[1][1] + matrix[2][1];
}
}
@@ -146,7 +146,7 @@ static int rotate_to_hull(const Cubic& cubic, char order[4], size_t idx, size_t
for (int index = 0; index < 4; ++index) {
if (debug_rotate_to_hull) printf("(%g,%g) ", rotPath[index].x, rotPath[index].y);
sides[side(rotPath[index].y - rotPath[inner].y)]++;
- if (index != outer && index != inner
+ if (index != outer && index != inner
&& side(rotPath[index].y - rotPath[inner].y) == 1)
zeroes = index;
}
@@ -169,13 +169,13 @@ static int rotate_to_hull(const Cubic& cubic, char order[4], size_t idx, size_t
__FUNCTION__, (int)idx, (int)inr, (int)outer, (int)inner);
continue;
}
- if (rotPath[zeroes].x < rotPath[inner].x
+ if (rotPath[zeroes].x < rotPath[inner].x
&& rotPath[zeroes].x < rotPath[outer].x) {
if (debug_rotate_to_hull) printf("%s [%d,%d] [o=%d,i=%d] zeroes < inner && outer\n",
__FUNCTION__, (int)idx, (int)inr, (int)outer, (int)inner);
continue;
}
- if (rotPath[zeroes].x > rotPath[inner].x
+ if (rotPath[zeroes].x > rotPath[inner].x
&& rotPath[zeroes].x > rotPath[outer].x) {
if (debug_rotate_to_hull) printf("%s [%d,%d] [o=%d,i=%d] zeroes > inner && outer\n",
__FUNCTION__, (int)idx, (int)inr, (int)outer, (int)inner);
@@ -242,7 +242,7 @@ void ConvexHull_Test() {
for (pt = 0; pt < cmp; ++pt) {
if (pts & 1 << order[pt]) {
printf("%s [%d,%d] duplicate index in order: %d,%d,%d",
- __FUNCTION__, (int)index, (int)inner,
+ __FUNCTION__, (int)index, (int)inner,
order[0], order[1], order[2]);
if (cmp == 4) {
printf(",%d", order[3]);
@@ -252,7 +252,7 @@ void ConvexHull_Test() {
}
if (cmpPts & 1 << cmpOrder[pt]) {
printf("%s [%d,%d] duplicate index in order: %d,%d,%d",
- __FUNCTION__, (int)index, (int)inner,
+ __FUNCTION__, (int)index, (int)inner,
cmpOrder[0], cmpOrder[1], cmpOrder[2]);
if (cmp == 4) {
printf(",%d", cmpOrder[3]);
@@ -291,7 +291,7 @@ void ConvexHull_Test() {
}
if (pts != cmpPts) {
printf("%s [%d,%d] mismatch indices: order=%d,%d,%d",
- __FUNCTION__, (int)index, (int)inner,
+ __FUNCTION__, (int)index, (int)inner,
order[0], order[1], order[2]);
if (cmp == 4) {
printf(",%d", order[3]);
@@ -311,7 +311,7 @@ void ConvexHull_Test() {
if (cmpOrder[match ^ 2] != order[2]) {
printf("%s [%d,%d] bowtie mismatch: order=%d,%d,%d,%d"
" cmpOrder=%d,%d,%d,%d\n",
- __FUNCTION__, (int)index, (int)inner,
+ __FUNCTION__, (int)index, (int)inner,
order[0], order[1], order[2], order[3],
cmpOrder[0], cmpOrder[1], cmpOrder[2], cmpOrder[3]);
}
@@ -383,10 +383,10 @@ void ConvexHull_X_Test() {
}
for (idx = 0; idx < cmp; ++idx) {
if (cmpOrder[idx] == 0) {
- rOrder[0] = cmpOrder[(idx + 1) % cmp];
+ rOrder[0] = cmpOrder[(idx + 1) % cmp];
rOrder[1] = cmpOrder[(idx + cmp - 1) % cmp];
} else if (cmpOrder[idx] == 3) {
- rOrder[2] = cmpOrder[(idx + 1) % cmp];
+ rOrder[2] = cmpOrder[(idx + 1) % cmp];
rOrder[3] = cmpOrder[(idx + cmp - 1) % cmp];
}
}
diff --git a/experimental/Intersection/CubeRoot.cpp b/experimental/Intersection/CubeRoot.cpp
index 37c8844bb2..4f602f7c17 100644
--- a/experimental/Intersection/CubeRoot.cpp
+++ b/experimental/Intersection/CubeRoot.cpp
@@ -1,4 +1,4 @@
-// http://metamerist.com/cbrt/CubeRoot.cpp
+// http://metamerist.com/cbrt/CubeRoot.cpp
//
#include <math.h>
@@ -12,102 +12,102 @@ typedef double (*cuberootfnd) (double);
// estimate bits of precision (32-bit float case)
inline int bits_of_precision(float a, float b)
{
- const double kd = 1.0 / log(2.0);
+ const double kd = 1.0 / log(2.0);
- if (a==b)
- return 23;
+ if (a==b)
+ return 23;
- const double kdmin = pow(2.0, -23.0);
+ const double kdmin = pow(2.0, -23.0);
- double d = fabs(a-b);
- if (d < kdmin)
- return 23;
+ double d = fabs(a-b);
+ if (d < kdmin)
+ return 23;
- return int(-log(d)*kd);
+ return int(-log(d)*kd);
}
// estiamte bits of precision (64-bit double case)
inline int bits_of_precision(double a, double b)
{
- const double kd = 1.0 / log(2.0);
+ const double kd = 1.0 / log(2.0);
- if (a==b)
- return 52;
+ if (a==b)
+ return 52;
- const double kdmin = pow(2.0, -52.0);
+ const double kdmin = pow(2.0, -52.0);
- double d = fabs(a-b);
- if (d < kdmin)
- return 52;
+ double d = fabs(a-b);
+ if (d < kdmin)
+ return 52;
- return int(-log(d)*kd);
+ return int(-log(d)*kd);
}
// cube root via x^(1/3)
static float pow_cbrtf(float x)
{
- return (float) pow(x, 1.0f/3.0f);
+ return (float) pow(x, 1.0f/3.0f);
}
// cube root via x^(1/3)
static double pow_cbrtd(double x)
{
- return pow(x, 1.0/3.0);
+ return pow(x, 1.0/3.0);
}
// cube root approximation using bit hack for 32-bit float
static float cbrt_5f(float f)
{
- unsigned int* p = (unsigned int *) &f;
- *p = *p/3 + 709921077;
- return f;
+ unsigned int* p = (unsigned int *) &f;
+ *p = *p/3 + 709921077;
+ return f;
}
#endif
-// cube root approximation using bit hack for 64-bit float
+// cube root approximation using bit hack for 64-bit float
// adapted from Kahan's cbrt
static double cbrt_5d(double d)
{
- const unsigned int B1 = 715094163;
- double t = 0.0;
- unsigned int* pt = (unsigned int*) &t;
- unsigned int* px = (unsigned int*) &d;
- pt[1]=px[1]/3+B1;
- return t;
+ const unsigned int B1 = 715094163;
+ double t = 0.0;
+ unsigned int* pt = (unsigned int*) &t;
+ unsigned int* px = (unsigned int*) &d;
+ pt[1]=px[1]/3+B1;
+ return t;
}
#if TEST_ALTERNATIVES
-// cube root approximation using bit hack for 64-bit float
+// cube root approximation using bit hack for 64-bit float
// adapted from Kahan's cbrt
#if 0
static double quint_5d(double d)
{
- return sqrt(sqrt(d));
-
- const unsigned int B1 = 71509416*5/3;
- double t = 0.0;
- unsigned int* pt = (unsigned int*) &t;
- unsigned int* px = (unsigned int*) &d;
- pt[1]=px[1]/5+B1;
- return t;
+ return sqrt(sqrt(d));
+
+ const unsigned int B1 = 71509416*5/3;
+ double t = 0.0;
+ unsigned int* pt = (unsigned int*) &t;
+ unsigned int* px = (unsigned int*) &d;
+ pt[1]=px[1]/5+B1;
+ return t;
}
#endif
// iterative cube root approximation using Halley's method (float)
static float cbrta_halleyf(const float a, const float R)
{
- const float a3 = a*a*a;
+ const float a3 = a*a*a;
const float b= a * (a3 + R + R) / (a3 + a3 + R);
- return b;
+ return b;
}
#endif
// iterative cube root approximation using Halley's method (double)
static double cbrta_halleyd(const double a, const double R)
{
- const double a3 = a*a*a;
+ const double a3 = a*a*a;
const double b= a * (a3 + R + R) / (a3 + a3 + R);
- return b;
+ return b;
}
#if TEST_ALTERNATIVES
@@ -115,255 +115,255 @@ static double cbrta_halleyd(const double a, const double R)
static float cbrta_newtonf(const float a, const float x)
{
// return (1.0 / 3.0) * ((a + a) + x / (a * a));
- return a - (1.0f / 3.0f) * (a - x / (a*a));
+ return a - (1.0f / 3.0f) * (a - x / (a*a));
}
// iterative cube root approximation using Newton's method (double)
static double cbrta_newtond(const double a, const double x)
{
- return (1.0/3.0) * (x / (a*a) + 2*a);
+ return (1.0/3.0) * (x / (a*a) + 2*a);
}
// cube root approximation using 1 iteration of Halley's method (double)
static double halley_cbrt1d(double d)
{
- double a = cbrt_5d(d);
- return cbrta_halleyd(a, d);
+ double a = cbrt_5d(d);
+ return cbrta_halleyd(a, d);
}
// cube root approximation using 1 iteration of Halley's method (float)
static float halley_cbrt1f(float d)
{
- float a = cbrt_5f(d);
- return cbrta_halleyf(a, d);
+ float a = cbrt_5f(d);
+ return cbrta_halleyf(a, d);
}
// cube root approximation using 2 iterations of Halley's method (double)
static double halley_cbrt2d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_halleyd(a, d);
- return cbrta_halleyd(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_halleyd(a, d);
+ return cbrta_halleyd(a, d);
}
#endif
// cube root approximation using 3 iterations of Halley's method (double)
static double halley_cbrt3d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_halleyd(a, d);
- a = cbrta_halleyd(a, d);
- return cbrta_halleyd(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_halleyd(a, d);
+ a = cbrta_halleyd(a, d);
+ return cbrta_halleyd(a, d);
}
#if TEST_ALTERNATIVES
// cube root approximation using 2 iterations of Halley's method (float)
static float halley_cbrt2f(float d)
{
- float a = cbrt_5f(d);
- a = cbrta_halleyf(a, d);
- return cbrta_halleyf(a, d);
+ float a = cbrt_5f(d);
+ a = cbrta_halleyf(a, d);
+ return cbrta_halleyf(a, d);
}
// cube root approximation using 1 iteration of Newton's method (double)
static double newton_cbrt1d(double d)
{
- double a = cbrt_5d(d);
- return cbrta_newtond(a, d);
+ double a = cbrt_5d(d);
+ return cbrta_newtond(a, d);
}
// cube root approximation using 2 iterations of Newton's method (double)
static double newton_cbrt2d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_newtond(a, d);
- return cbrta_newtond(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_newtond(a, d);
+ return cbrta_newtond(a, d);
}
// cube root approximation using 3 iterations of Newton's method (double)
static double newton_cbrt3d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_newtond(a, d);
- a = cbrta_newtond(a, d);
- return cbrta_newtond(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_newtond(a, d);
+ a = cbrta_newtond(a, d);
+ return cbrta_newtond(a, d);
}
// cube root approximation using 4 iterations of Newton's method (double)
static double newton_cbrt4d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_newtond(a, d);
- a = cbrta_newtond(a, d);
- a = cbrta_newtond(a, d);
- return cbrta_newtond(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_newtond(a, d);
+ a = cbrta_newtond(a, d);
+ a = cbrta_newtond(a, d);
+ return cbrta_newtond(a, d);
}
// cube root approximation using 2 iterations of Newton's method (float)
static float newton_cbrt1f(float d)
{
- float a = cbrt_5f(d);
- return cbrta_newtonf(a, d);
+ float a = cbrt_5f(d);
+ return cbrta_newtonf(a, d);
}
// cube root approximation using 2 iterations of Newton's method (float)
static float newton_cbrt2f(float d)
{
- float a = cbrt_5f(d);
- a = cbrta_newtonf(a, d);
- return cbrta_newtonf(a, d);
+ float a = cbrt_5f(d);
+ a = cbrta_newtonf(a, d);
+ return cbrta_newtonf(a, d);
}
// cube root approximation using 3 iterations of Newton's method (float)
static float newton_cbrt3f(float d)
{
- float a = cbrt_5f(d);
- a = cbrta_newtonf(a, d);
- a = cbrta_newtonf(a, d);
- return cbrta_newtonf(a, d);
+ float a = cbrt_5f(d);
+ a = cbrta_newtonf(a, d);
+ a = cbrta_newtonf(a, d);
+ return cbrta_newtonf(a, d);
}
// cube root approximation using 4 iterations of Newton's method (float)
static float newton_cbrt4f(float d)
{
- float a = cbrt_5f(d);
- a = cbrta_newtonf(a, d);
- a = cbrta_newtonf(a, d);
- a = cbrta_newtonf(a, d);
- return cbrta_newtonf(a, d);
+ float a = cbrt_5f(d);
+ a = cbrta_newtonf(a, d);
+ a = cbrta_newtonf(a, d);
+ a = cbrta_newtonf(a, d);
+ return cbrta_newtonf(a, d);
}
static double TestCubeRootf(const char* szName, cuberootfnf cbrt, double rA, double rB, int rN)
{
- const int N = rN;
-
- float dd = float((rB-rA) / N);
-
- // calculate 1M numbers
- int i=0;
- float d = (float) rA;
-
- double s = 0.0;
-
- for(d=(float) rA, i=0; i<N; i++, d += dd)
- {
- s += cbrt(d);
- }
-
- double bits = 0.0;
- double worstx=0.0;
- double worsty=0.0;
- int minbits=64;
-
- for(d=(float) rA, i=0; i<N; i++, d += dd)
- {
- float a = cbrt((float) d);
- float b = (float) pow((double) d, 1.0/3.0);
-
- int bc = bits_of_precision(a, b);
- bits += bc;
-
- if (b > 1.0e-6)
- {
- if (bc < minbits)
- {
- minbits = bc;
- worstx = d;
- worsty = a;
- }
- }
- }
-
- bits /= N;
+ const int N = rN;
+
+ float dd = float((rB-rA) / N);
+
+ // calculate 1M numbers
+ int i=0;
+ float d = (float) rA;
+
+ double s = 0.0;
+
+ for(d=(float) rA, i=0; i<N; i++, d += dd)
+ {
+ s += cbrt(d);
+ }
+
+ double bits = 0.0;
+ double worstx=0.0;
+ double worsty=0.0;
+ int minbits=64;
+
+ for(d=(float) rA, i=0; i<N; i++, d += dd)
+ {
+ float a = cbrt((float) d);
+ float b = (float) pow((double) d, 1.0/3.0);
+
+ int bc = bits_of_precision(a, b);
+ bits += bc;
+
+ if (b > 1.0e-6)
+ {
+ if (bc < minbits)
+ {
+ minbits = bc;
+ worstx = d;
+ worsty = a;
+ }
+ }
+ }
+
+ bits /= N;
printf(" %3d mbp %6.3f abp\n", minbits, bits);
- return s;
+ return s;
}
static double TestCubeRootd(const char* szName, cuberootfnd cbrt, double rA, double rB, int rN)
{
- const int N = rN;
-
- double dd = (rB-rA) / N;
-
- int i=0;
-
- double s = 0.0;
- double d = 0.0;
-
- for(d=rA, i=0; i<N; i++, d += dd)
- {
- s += cbrt(d);
- }
-
-
- double bits = 0.0;
- double worstx = 0.0;
- double worsty = 0.0;
- int minbits = 64;
- for(d=rA, i=0; i<N; i++, d += dd)
- {
- double a = cbrt(d);
- double b = pow(d, 1.0/3.0);
-
- int bc = bits_of_precision(a, b); // min(53, count_matching_bitsd(a, b) - 12);
- bits += bc;
-
- if (b > 1.0e-6)
- {
- if (bc < minbits)
- {
- bits_of_precision(a, b);
- minbits = bc;
- worstx = d;
- worsty = a;
- }
- }
- }
-
- bits /= N;
+ const int N = rN;
+
+ double dd = (rB-rA) / N;
+
+ int i=0;
+
+ double s = 0.0;
+ double d = 0.0;
+
+ for(d=rA, i=0; i<N; i++, d += dd)
+ {
+ s += cbrt(d);
+ }
+
+
+ double bits = 0.0;
+ double worstx = 0.0;
+ double worsty = 0.0;
+ int minbits = 64;
+ for(d=rA, i=0; i<N; i++, d += dd)
+ {
+ double a = cbrt(d);
+ double b = pow(d, 1.0/3.0);
+
+ int bc = bits_of_precision(a, b); // min(53, count_matching_bitsd(a, b) - 12);
+ bits += bc;
+
+ if (b > 1.0e-6)
+ {
+ if (bc < minbits)
+ {
+ bits_of_precision(a, b);
+ minbits = bc;
+ worstx = d;
+ worsty = a;
+ }
+ }
+ }
+
+ bits /= N;
printf(" %3d mbp %6.3f abp\n", minbits, bits);
- return s;
+ return s;
}
static int _tmain()
{
- // a million uniform steps through the range from 0.0 to 1.0
- // (doing uniform steps in the log scale would be better)
- double a = 0.0;
- double b = 1.0;
- int n = 1000000;
-
- printf("32-bit float tests\n");
- printf("----------------------------------------\n");
- TestCubeRootf("cbrt_5f", cbrt_5f, a, b, n);
- TestCubeRootf("pow", pow_cbrtf, a, b, n);
- TestCubeRootf("halley x 1", halley_cbrt1f, a, b, n);
- TestCubeRootf("halley x 2", halley_cbrt2f, a, b, n);
- TestCubeRootf("newton x 1", newton_cbrt1f, a, b, n);
- TestCubeRootf("newton x 2", newton_cbrt2f, a, b, n);
- TestCubeRootf("newton x 3", newton_cbrt3f, a, b, n);
- TestCubeRootf("newton x 4", newton_cbrt4f, a, b, n);
- printf("\n\n");
-
- printf("64-bit double tests\n");
- printf("----------------------------------------\n");
- TestCubeRootd("cbrt_5d", cbrt_5d, a, b, n);
- TestCubeRootd("pow", pow_cbrtd, a, b, n);
- TestCubeRootd("halley x 1", halley_cbrt1d, a, b, n);
- TestCubeRootd("halley x 2", halley_cbrt2d, a, b, n);
- TestCubeRootd("halley x 3", halley_cbrt3d, a, b, n);
- TestCubeRootd("newton x 1", newton_cbrt1d, a, b, n);
- TestCubeRootd("newton x 2", newton_cbrt2d, a, b, n);
- TestCubeRootd("newton x 3", newton_cbrt3d, a, b, n);
- TestCubeRootd("newton x 4", newton_cbrt4d, a, b, n);
- printf("\n\n");
-
- return 0;
+ // a million uniform steps through the range from 0.0 to 1.0
+ // (doing uniform steps in the log scale would be better)
+ double a = 0.0;
+ double b = 1.0;
+ int n = 1000000;
+
+ printf("32-bit float tests\n");
+ printf("----------------------------------------\n");
+ TestCubeRootf("cbrt_5f", cbrt_5f, a, b, n);
+ TestCubeRootf("pow", pow_cbrtf, a, b, n);
+ TestCubeRootf("halley x 1", halley_cbrt1f, a, b, n);
+ TestCubeRootf("halley x 2", halley_cbrt2f, a, b, n);
+ TestCubeRootf("newton x 1", newton_cbrt1f, a, b, n);
+ TestCubeRootf("newton x 2", newton_cbrt2f, a, b, n);
+ TestCubeRootf("newton x 3", newton_cbrt3f, a, b, n);
+ TestCubeRootf("newton x 4", newton_cbrt4f, a, b, n);
+ printf("\n\n");
+
+ printf("64-bit double tests\n");
+ printf("----------------------------------------\n");
+ TestCubeRootd("cbrt_5d", cbrt_5d, a, b, n);
+ TestCubeRootd("pow", pow_cbrtd, a, b, n);
+ TestCubeRootd("halley x 1", halley_cbrt1d, a, b, n);
+ TestCubeRootd("halley x 2", halley_cbrt2d, a, b, n);
+ TestCubeRootd("halley x 3", halley_cbrt3d, a, b, n);
+ TestCubeRootd("newton x 1", newton_cbrt1d, a, b, n);
+ TestCubeRootd("newton x 2", newton_cbrt2d, a, b, n);
+ TestCubeRootd("newton x 3", newton_cbrt3d, a, b, n);
+ TestCubeRootd("newton x 4", newton_cbrt4d, a, b, n);
+ printf("\n\n");
+
+ return 0;
}
#endif
diff --git a/experimental/Intersection/CubicBezierClip.cpp b/experimental/Intersection/CubicBezierClip.cpp
index 4eddc70a42..f3c78a247c 100644
--- a/experimental/Intersection/CubicBezierClip.cpp
+++ b/experimental/Intersection/CubicBezierClip.cpp
@@ -10,7 +10,7 @@ bool bezier_clip(const Cubic& cubic1, const Cubic& cubic2, double& minT, double&
maxT = 0;
// determine normalized implicit line equation for pt[0] to pt[3]
// of the form ax + by + c = 0, where a*a + b*b == 1
-
+
// find the implicit line equation parameters
LineParameters endLine;
endLine.cubicEndPoints(cubic1);
@@ -21,7 +21,7 @@ bool bezier_clip(const Cubic& cubic1, const Cubic& cubic2, double& minT, double&
double distance[2];
endLine.controlPtDistance(cubic1, distance);
-
+
// find fat line
double top = distance[0];
double bottom = distance[1];
@@ -42,11 +42,11 @@ bool bezier_clip(const Cubic& cubic1, const Cubic& cubic2, double& minT, double&
top *= scale;
bottom *= scale;
}
-
+
// compute intersecting candidate distance
Cubic distance2y; // points with X of (0, 1/3, 2/3, 1)
endLine.cubicDistanceY(cubic2, distance2y);
-
+
int flags = 0;
if (approximately_lesser(distance2y[0].y, top)) {
flags |= kFindTopMin;
@@ -78,7 +78,7 @@ bool bezier_clip(const Cubic& cubic1, const Cubic& cubic2, double& minT, double&
if (do_1_2_edge) {
x_at(distance2y[1], distance2y[2], top, bottom, flags, minT, maxT);
}
-
+
return minT < maxT; // returns false if distance shows no intersection
}
diff --git a/experimental/Intersection/CubicIntersection.cpp b/experimental/Intersection/CubicIntersection.cpp
index 13c472672d..594e12c9f2 100644
--- a/experimental/Intersection/CubicIntersection.cpp
+++ b/experimental/Intersection/CubicIntersection.cpp
@@ -6,11 +6,11 @@
class CubicIntersections : public Intersections {
public:
-CubicIntersections(const Cubic& c1, const Cubic& c2, Intersections& i)
+CubicIntersections(const Cubic& c1, const Cubic& c2, Intersections& i)
: cubic1(c1)
, cubic2(c2)
, intersections(i)
- , depth(0)
+ , depth(0)
, splits(0) {
}
@@ -37,10 +37,10 @@ bool intersect() {
}
protected:
-
+
bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
Cubic smaller, larger;
- // FIXME: carry last subdivide and reduceOrder result with cubic
+ // FIXME: carry last subdivide and reduceOrder result with cubic
sub_divide(cubic1, minT1, maxT1, intersections.swapped() ? larger : smaller);
sub_divide(cubic2, minT2, maxT2, intersections.swapped() ? smaller : larger);
Cubic smallResult;
@@ -58,11 +58,11 @@ bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
return false;
}
if (intersections.swapped()) {
- smallT[0] = interp(minT2, maxT2, smallT[0]);
- largeT[0] = interp(minT1, maxT1, largeT[0]);
+ smallT[0] = interp(minT2, maxT2, smallT[0]);
+ largeT[0] = interp(minT1, maxT1, largeT[0]);
} else {
- smallT[0] = interp(minT1, maxT1, smallT[0]);
- largeT[0] = interp(minT2, maxT2, largeT[0]);
+ smallT[0] = interp(minT1, maxT1, smallT[0]);
+ largeT[0] = interp(minT2, maxT2, largeT[0]);
}
intersections.add(smallT[0], largeT[0]);
return true;
@@ -83,7 +83,7 @@ bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
}
return false;
}
-
+
int split;
if (intersections.swapped()) {
double newMinT1 = interp(minT1, maxT1, minT);
diff --git a/experimental/Intersection/CubicIntersection_TestData.cpp b/experimental/Intersection/CubicIntersection_TestData.cpp
index 066d9b5b97..e1da4c577e 100644
--- a/experimental/Intersection/CubicIntersection_TestData.cpp
+++ b/experimental/Intersection/CubicIntersection_TestData.cpp
@@ -12,7 +12,7 @@ const Cubic pointDegenerates[] = {
};
const size_t pointDegenerates_count = sizeof(pointDegenerates) / sizeof(pointDegenerates[0]);
-
+
const Cubic notPointDegenerates[] = {
{{1 + PointEpsilon + std::numeric_limits<double>::epsilon(), 1}, {1, 1 + PointEpsilon}, {1, 1}, {1, 1}},
{{1 + PointEpsilon/2 + std::numeric_limits<double>::epsilon(), 1}, {1 - PointEpsilon/2, 1}, {1, 1}, {1, 1}}
@@ -69,7 +69,7 @@ const Cubic tests[][2] = {
{{317.122, 309.05}, {316.112, 315.102}, {310.385, 319.19}, {304.332, 318.179}}
},
{
- {{1046.604051, 172.937967}, {1046.604051, 178.9763059}, {1041.76745, 183.9279165}, {1035.703842, 184.0432409}},
+ {{1046.604051, 172.937967}, {1046.604051, 178.9763059}, {1041.76745, 183.9279165}, {1035.703842, 184.0432409}},
{{1046.452235, 174.7640504}, {1045.544872, 180.1973817}, {1040.837966, 184.0469882}, {1035.505925, 184.0469882}}
},
{
@@ -81,7 +81,7 @@ const Cubic tests[][2] = {
const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
Cubic hexTests[][2] = {
- {
+ {
{{0}} // placeholder for hex converted below
}
};
@@ -95,7 +95,7 @@ static const uint64_t testx[2][8] = {
},
{
0x92c56ed7b6145d40LLU, 0xede4f1255edb7740LLU, 0x1138c1101af75940LLU, 0x42e4f1255edb7740LLU,
- 0x408e51603ad95640LLU, 0x1e2e8fe9dd927740LLU, 0x1cb4777cd3a75440LLU, 0x212e1390de017740LLU
+ 0x408e51603ad95640LLU, 0x1e2e8fe9dd927740LLU, 0x1cb4777cd3a75440LLU, 0x212e1390de017740LLU
}
};
diff --git a/experimental/Intersection/CubicParameterization.cpp b/experimental/Intersection/CubicParameterization.cpp
index bb75771115..7656c663cd 100644
--- a/experimental/Intersection/CubicParameterization.cpp
+++ b/experimental/Intersection/CubicParameterization.cpp
@@ -3,7 +3,7 @@
/* from http://tom.cs.byu.edu/~tom/papers/cvgip84.pdf 4.1
*
- * This paper proves that Syvester's method can compute the implicit form of
+ * This paper proves that Syvester's method can compute the implicit form of
* the quadratic from the parameterzied form.
*
* Given x = a*t*t*t + b*t*t + c*t + d (the parameterized form)
@@ -28,30 +28,30 @@
*
* Resultant[a*t^3 + b*t^2 + c*t + d - x, e*t^3 + f*t^2 + g*t + h - y, t]
*
- * -d^3 e^3 + c d^2 e^2 f - b d^2 e f^2 + a d^2 f^3 - c^2 d e^2 g +
- * 2 b d^2 e^2 g + b c d e f g - 3 a d^2 e f g - a c d f^2 g -
- * b^2 d e g^2 + 2 a c d e g^2 + a b d f g^2 - a^2 d g^3 + c^3 e^2 h -
- * 3 b c d e^2 h + 3 a d^2 e^2 h - b c^2 e f h + 2 b^2 d e f h +
- * a c d e f h + a c^2 f^2 h - 2 a b d f^2 h + b^2 c e g h -
- * 2 a c^2 e g h - a b d e g h - a b c f g h + 3 a^2 d f g h +
- * a^2 c g^2 h - b^3 e h^2 + 3 a b c e h^2 - 3 a^2 d e h^2 +
- * a b^2 f h^2 - 2 a^2 c f h^2 - a^2 b g h^2 + a^3 h^3 + 3 d^2 e^3 x -
- * 2 c d e^2 f x + 2 b d e f^2 x - 2 a d f^3 x + c^2 e^2 g x -
- * 4 b d e^2 g x - b c e f g x + 6 a d e f g x + a c f^2 g x +
- * b^2 e g^2 x - 2 a c e g^2 x - a b f g^2 x + a^2 g^3 x +
- * 3 b c e^2 h x - 6 a d e^2 h x - 2 b^2 e f h x - a c e f h x +
- * 2 a b f^2 h x + a b e g h x - 3 a^2 f g h x + 3 a^2 e h^2 x -
- * 3 d e^3 x^2 + c e^2 f x^2 - b e f^2 x^2 + a f^3 x^2 +
- * 2 b e^2 g x^2 - 3 a e f g x^2 + 3 a e^2 h x^2 + e^3 x^3 -
- * c^3 e^2 y + 3 b c d e^2 y - 3 a d^2 e^2 y + b c^2 e f y -
- * 2 b^2 d e f y - a c d e f y - a c^2 f^2 y + 2 a b d f^2 y -
- * b^2 c e g y + 2 a c^2 e g y + a b d e g y + a b c f g y -
- * 3 a^2 d f g y - a^2 c g^2 y + 2 b^3 e h y - 6 a b c e h y +
- * 6 a^2 d e h y - 2 a b^2 f h y + 4 a^2 c f h y + 2 a^2 b g h y -
- * 3 a^3 h^2 y - 3 b c e^2 x y + 6 a d e^2 x y + 2 b^2 e f x y +
- * a c e f x y - 2 a b f^2 x y - a b e g x y + 3 a^2 f g x y -
- * 6 a^2 e h x y - 3 a e^2 x^2 y - b^3 e y^2 + 3 a b c e y^2 -
- * 3 a^2 d e y^2 + a b^2 f y^2 - 2 a^2 c f y^2 - a^2 b g y^2 +
+ * -d^3 e^3 + c d^2 e^2 f - b d^2 e f^2 + a d^2 f^3 - c^2 d e^2 g +
+ * 2 b d^2 e^2 g + b c d e f g - 3 a d^2 e f g - a c d f^2 g -
+ * b^2 d e g^2 + 2 a c d e g^2 + a b d f g^2 - a^2 d g^3 + c^3 e^2 h -
+ * 3 b c d e^2 h + 3 a d^2 e^2 h - b c^2 e f h + 2 b^2 d e f h +
+ * a c d e f h + a c^2 f^2 h - 2 a b d f^2 h + b^2 c e g h -
+ * 2 a c^2 e g h - a b d e g h - a b c f g h + 3 a^2 d f g h +
+ * a^2 c g^2 h - b^3 e h^2 + 3 a b c e h^2 - 3 a^2 d e h^2 +
+ * a b^2 f h^2 - 2 a^2 c f h^2 - a^2 b g h^2 + a^3 h^3 + 3 d^2 e^3 x -
+ * 2 c d e^2 f x + 2 b d e f^2 x - 2 a d f^3 x + c^2 e^2 g x -
+ * 4 b d e^2 g x - b c e f g x + 6 a d e f g x + a c f^2 g x +
+ * b^2 e g^2 x - 2 a c e g^2 x - a b f g^2 x + a^2 g^3 x +
+ * 3 b c e^2 h x - 6 a d e^2 h x - 2 b^2 e f h x - a c e f h x +
+ * 2 a b f^2 h x + a b e g h x - 3 a^2 f g h x + 3 a^2 e h^2 x -
+ * 3 d e^3 x^2 + c e^2 f x^2 - b e f^2 x^2 + a f^3 x^2 +
+ * 2 b e^2 g x^2 - 3 a e f g x^2 + 3 a e^2 h x^2 + e^3 x^3 -
+ * c^3 e^2 y + 3 b c d e^2 y - 3 a d^2 e^2 y + b c^2 e f y -
+ * 2 b^2 d e f y - a c d e f y - a c^2 f^2 y + 2 a b d f^2 y -
+ * b^2 c e g y + 2 a c^2 e g y + a b d e g y + a b c f g y -
+ * 3 a^2 d f g y - a^2 c g^2 y + 2 b^3 e h y - 6 a b c e h y +
+ * 6 a^2 d e h y - 2 a b^2 f h y + 4 a^2 c f h y + 2 a^2 b g h y -
+ * 3 a^3 h^2 y - 3 b c e^2 x y + 6 a d e^2 x y + 2 b^2 e f x y +
+ * a c e f x y - 2 a b f^2 x y - a b e g x y + 3 a^2 f g x y -
+ * 6 a^2 e h x y - 3 a e^2 x^2 y - b^3 e y^2 + 3 a b c e y^2 -
+ * 3 a^2 d e y^2 + a b^2 f y^2 - 2 a^2 c f y^2 - a^2 b g y^2 +
* 3 a^3 h y^2 + 3 a^2 e x y^2 - a^3 y^3
*/
@@ -75,7 +75,7 @@ enum {
// FIXME: factoring version unwritten
// static bool straight_forward = true;
-/* from CubicParameterizationCode.cpp output:
+/* from CubicParameterizationCode.cpp output:
* double A = e * e * e;
* double B = -3 * a * e * e;
* double C = 3 * a * a * e;
@@ -96,7 +96,7 @@ static void calc_ABCD(double a, double e, double p[coeff_count]) {
// start of generated code
static double calc_xx(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-3 * d * e * e * e
+ c * e * e * f
- b * e * f * f
@@ -108,7 +108,7 @@ static double calc_xx(double a, double b, double c, double d,
static double calc_xy(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-3 * b * c * e * e
+ 6 * a * d * e * e
+ 2 * b * b * e * f
@@ -121,7 +121,7 @@ static double calc_xy(double a, double b, double c, double d,
static double calc_yy(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-b * b * b * e
+ 3 * a * b * c * e
- 3 * a * a * d * e
@@ -133,7 +133,7 @@ static double calc_yy(double a, double b, double c, double d,
static double calc_x(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
3 * d * d * e * e * e
- 2 * c * d * e * e * f
+ 2 * b * d * e * f * f
@@ -159,7 +159,7 @@ static double calc_x(double a, double b, double c, double d,
static double calc_y(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-c * c * c * e * e
+ 3 * b * c * d * e * e
- 3 * a * d * d * e * e
@@ -185,7 +185,7 @@ static double calc_y(double a, double b, double c, double d,
static double calc_c(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-d * d * d * e * e * e
+ c * d * d * e * e * f
- b * d * d * e * f * f
@@ -231,65 +231,65 @@ static double calc_c(double a, double b, double c, double d,
*/
static double calc_c(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
-d*d*d*e*e*e - 3*d*d*(3*c*e*e*f + 3*b*e*(-3*f*f + 2*e*g) + a*(9*f*f*f - 9*e*f*g + e*e*h)) -
- h*(27*c*c*c*e*e - 27*c*c*(3*b*e*f - 3*a*f*f + 2*a*e*g) +
- h*(-27*b*b*b*e + 27*a*b*b*f - 9*a*a*b*g + a*a*a*h) +
- 9*c*(9*b*b*e*g + a*b*(-9*f*g + 3*e*h) + a*a*(3*g*g - 2*f*h))) +
- 3*d*(9*c*c*e*e*g + 9*b*b*e*(3*g*g - 2*f*h) + 3*a*b*(-9*f*g*g + 6*f*f*h + e*g*h) +
+ return
+d*d*d*e*e*e - 3*d*d*(3*c*e*e*f + 3*b*e*(-3*f*f + 2*e*g) + a*(9*f*f*f - 9*e*f*g + e*e*h)) -
+ h*(27*c*c*c*e*e - 27*c*c*(3*b*e*f - 3*a*f*f + 2*a*e*g) +
+ h*(-27*b*b*b*e + 27*a*b*b*f - 9*a*a*b*g + a*a*a*h) +
+ 9*c*(9*b*b*e*g + a*b*(-9*f*g + 3*e*h) + a*a*(3*g*g - 2*f*h))) +
+ 3*d*(9*c*c*e*e*g + 9*b*b*e*(3*g*g - 2*f*h) + 3*a*b*(-9*f*g*g + 6*f*f*h + e*g*h) +
a*a*(9*g*g*g - 9*f*g*h + e*h*h) + 3*c*(3*b*e*(-3*f*g + e*h) + a*(9*f*f*g - 6*e*g*g - e*f*h)))
;
}
-// - Power(e - 3*f + 3*g - h,3)*Power(x,3)
+// - Power(e - 3*f + 3*g - h,3)*Power(x,3)
static double calc_xxx(double e3f3gh) {
return -e3f3gh * e3f3gh * e3f3gh;
}
static double calc_y(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
-+ 3*(6*b*d*d*e*e - d*d*d*e*e + 18*b*b*d*e*f - 18*b*d*d*e*f -
- 9*b*d*d*f*f - 54*b*b*d*e*g + 12*b*d*d*e*g - 27*b*b*d*g*g - 18*b*b*b*e*h + 18*b*b*d*e*h +
- 18*b*b*d*f*h + a*a*a*h*h - 9*b*b*b*h*h + 9*c*c*c*e*(e + 2*h) +
- a*a*(-3*b*h*(2*g + h) + d*(-27*g*g + 9*g*h - h*(2*e + h) + 9*f*(g + h))) +
- a*(9*b*b*h*(2*f + h) - 3*b*d*(6*f*f - 6*f*(3*g - 2*h) + g*(-9*g + h) + e*(g + h)) +
- d*d*(e*e + 9*f*(3*f - g) + e*(-9*f - 9*g + 2*h))) -
- 9*c*c*(d*e*(e + 2*g) + 3*b*(f*h + e*(f + h)) + a*(-3*f*f - 6*f*h + 2*(g*h + e*(g + h)))) +
- 3*c*(d*d*e*(e + 2*f) + a*a*(3*g*g + 6*g*h - 2*h*(2*f + h)) + 9*b*b*(g*h + e*(g + h)) +
- a*d*(-9*f*f - 18*f*g + 6*g*g + f*h + e*(f + 12*g + h)) +
- b*(d*(-3*e*e + 9*f*g + e*(9*f + 9*g - 6*h)) + 3*a*(h*(2*e - 3*g + h) - 3*f*(g + h))))) // *y
+ return
++ 3*(6*b*d*d*e*e - d*d*d*e*e + 18*b*b*d*e*f - 18*b*d*d*e*f -
+ 9*b*d*d*f*f - 54*b*b*d*e*g + 12*b*d*d*e*g - 27*b*b*d*g*g - 18*b*b*b*e*h + 18*b*b*d*e*h +
+ 18*b*b*d*f*h + a*a*a*h*h - 9*b*b*b*h*h + 9*c*c*c*e*(e + 2*h) +
+ a*a*(-3*b*h*(2*g + h) + d*(-27*g*g + 9*g*h - h*(2*e + h) + 9*f*(g + h))) +
+ a*(9*b*b*h*(2*f + h) - 3*b*d*(6*f*f - 6*f*(3*g - 2*h) + g*(-9*g + h) + e*(g + h)) +
+ d*d*(e*e + 9*f*(3*f - g) + e*(-9*f - 9*g + 2*h))) -
+ 9*c*c*(d*e*(e + 2*g) + 3*b*(f*h + e*(f + h)) + a*(-3*f*f - 6*f*h + 2*(g*h + e*(g + h)))) +
+ 3*c*(d*d*e*(e + 2*f) + a*a*(3*g*g + 6*g*h - 2*h*(2*f + h)) + 9*b*b*(g*h + e*(g + h)) +
+ a*d*(-9*f*f - 18*f*g + 6*g*g + f*h + e*(f + 12*g + h)) +
+ b*(d*(-3*e*e + 9*f*g + e*(9*f + 9*g - 6*h)) + 3*a*(h*(2*e - 3*g + h) - 3*f*(g + h))))) // *y
;
}
static double calc_yy(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
-- 3*(18*c*c*c*e - 18*c*c*d*e + 6*c*d*d*e - d*d*d*e + 3*c*d*d*f - 9*c*c*d*g + a*a*a*h + 9*c*c*c*h -
- 9*b*b*b*(e + 2*h) - a*a*(d*(e - 9*f + 18*g - 7*h) + 3*c*(2*f - 6*g + h)) +
- a*(-9*c*c*(2*e - 6*f + 2*g - h) + d*d*(-7*e + 18*f - 9*g + h) + 3*c*d*(7*e - 17*f + 3*g + h)) +
- 9*b*b*(3*c*(e + g + h) + a*(f + 2*h) - d*(e - 2*(f - 3*g + h))) -
- 3*b*(-(d*d*(e - 6*f + 2*g)) - 3*c*d*(e + 3*f + 3*g - h) + 9*c*c*(e + f + h) + a*a*(g + 2*h) +
- a*(c*(-3*e + 9*f + 9*g + 3*h) + d*(e + 3*f - 17*g + 7*h)))) // *Power(y,2)
+ return
+- 3*(18*c*c*c*e - 18*c*c*d*e + 6*c*d*d*e - d*d*d*e + 3*c*d*d*f - 9*c*c*d*g + a*a*a*h + 9*c*c*c*h -
+ 9*b*b*b*(e + 2*h) - a*a*(d*(e - 9*f + 18*g - 7*h) + 3*c*(2*f - 6*g + h)) +
+ a*(-9*c*c*(2*e - 6*f + 2*g - h) + d*d*(-7*e + 18*f - 9*g + h) + 3*c*d*(7*e - 17*f + 3*g + h)) +
+ 9*b*b*(3*c*(e + g + h) + a*(f + 2*h) - d*(e - 2*(f - 3*g + h))) -
+ 3*b*(-(d*d*(e - 6*f + 2*g)) - 3*c*d*(e + 3*f + 3*g - h) + 9*c*c*(e + f + h) + a*a*(g + 2*h) +
+ a*(c*(-3*e + 9*f + 9*g + 3*h) + d*(e + 3*f - 17*g + 7*h)))) // *Power(y,2)
;
}
-// + Power(a - 3*b + 3*c - d,3)*Power(y,3)
+// + Power(a - 3*b + 3*c - d,3)*Power(y,3)
static double calc_yyy(double a3b3cd) {
return a3b3cd * a3b3cd * a3b3cd;
}
static double calc_xx(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
// + Power(x,2)*
-(-3*(-9*b*e*f*f + 9*a*f*f*f + 6*b*e*e*g - 9*a*e*f*g + 27*b*e*f*g - 27*a*f*f*g + 18*a*e*g*g - 54*b*e*g*g +
- 27*a*f*g*g + 27*b*f*g*g - 18*a*g*g*g + a*e*e*h - 9*b*e*e*h + 3*a*e*f*h + 9*b*e*f*h + 9*a*f*f*h -
- 18*b*f*f*h - 21*a*e*g*h + 51*b*e*g*h - 9*a*f*g*h - 27*b*f*g*h + 18*a*g*g*h + 7*a*e*h*h - 18*b*e*h*h - 3*a*f*h*h +
- 18*b*f*h*h - 6*a*g*h*h - 3*b*g*h*h + a*h*h*h +
- 3*c*(-9*f*f*(g - 2*h) + 3*g*g*h - f*h*(9*g + 2*h) + e*e*(f - 6*g + 6*h) +
- e*(9*f*g + 6*g*g - 17*f*h - 3*g*h + 3*h*h)) -
- d*(e*e*e + e*e*(-6*f - 3*g + 7*h) - 9*(2*f - g)*(f*f + g*g - f*(g + h)) +
+(-3*(-9*b*e*f*f + 9*a*f*f*f + 6*b*e*e*g - 9*a*e*f*g + 27*b*e*f*g - 27*a*f*f*g + 18*a*e*g*g - 54*b*e*g*g +
+ 27*a*f*g*g + 27*b*f*g*g - 18*a*g*g*g + a*e*e*h - 9*b*e*e*h + 3*a*e*f*h + 9*b*e*f*h + 9*a*f*f*h -
+ 18*b*f*f*h - 21*a*e*g*h + 51*b*e*g*h - 9*a*f*g*h - 27*b*f*g*h + 18*a*g*g*h + 7*a*e*h*h - 18*b*e*h*h - 3*a*f*h*h +
+ 18*b*f*h*h - 6*a*g*h*h - 3*b*g*h*h + a*h*h*h +
+ 3*c*(-9*f*f*(g - 2*h) + 3*g*g*h - f*h*(9*g + 2*h) + e*e*(f - 6*g + 6*h) +
+ e*(9*f*g + 6*g*g - 17*f*h - 3*g*h + 3*h*h)) -
+ d*(e*e*e + e*e*(-6*f - 3*g + 7*h) - 9*(2*f - g)*(f*f + g*g - f*(g + h)) +
e*(18*f*f + 9*g*g + 3*g*h + h*h - 3*f*(3*g + 7*h)))) )
;
}
@@ -301,35 +301,35 @@ static double calc_xxy(double a3b3cd, double e3f3gh) {
static double calc_x(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
// + x*
-(-3*(27*b*b*e*g*g - 27*a*b*f*g*g + 9*a*a*g*g*g - 18*b*b*e*f*h + 18*a*b*f*f*h + 3*a*b*e*g*h -
- 27*b*b*e*g*h - 9*a*a*f*g*h + 27*a*b*f*g*h - 9*a*a*g*g*h + a*a*e*h*h - 9*a*b*e*h*h +
- 27*b*b*e*h*h + 6*a*a*f*h*h - 18*a*b*f*h*h - 9*b*b*f*h*h + 3*a*a*g*h*h +
- 6*a*b*g*h*h - a*a*h*h*h + 9*c*c*(e*e*(g - 3*h) - 3*f*f*h + e*(3*f + 2*g)*h) +
- d*d*(e*e*e - 9*f*f*f + 9*e*f*(f + g) - e*e*(3*f + 6*g + h)) +
- d*(-3*c*(-9*f*f*g + e*e*(2*f - 6*g - 3*h) + e*(9*f*g + 6*g*g + f*h)) +
- a*(-18*f*f*f - 18*e*g*g + 18*g*g*g - 2*e*e*h + 3*e*g*h + 2*e*h*h + 9*f*f*(3*g + 2*h) +
- 3*f*(6*e*g - 9*g*g - e*h - 6*g*h)) - 3*b*(9*f*g*g + e*e*(4*g - 3*h) - 6*f*f*h -
- e*(6*f*f + g*(18*g + h) - 3*f*(3*g + 4*h)))) +
- 3*c*(3*b*(e*e*h + 3*f*g*h - e*(3*f*g - 6*f*h + 6*g*h + h*h)) +
+(-3*(27*b*b*e*g*g - 27*a*b*f*g*g + 9*a*a*g*g*g - 18*b*b*e*f*h + 18*a*b*f*f*h + 3*a*b*e*g*h -
+ 27*b*b*e*g*h - 9*a*a*f*g*h + 27*a*b*f*g*h - 9*a*a*g*g*h + a*a*e*h*h - 9*a*b*e*h*h +
+ 27*b*b*e*h*h + 6*a*a*f*h*h - 18*a*b*f*h*h - 9*b*b*f*h*h + 3*a*a*g*h*h +
+ 6*a*b*g*h*h - a*a*h*h*h + 9*c*c*(e*e*(g - 3*h) - 3*f*f*h + e*(3*f + 2*g)*h) +
+ d*d*(e*e*e - 9*f*f*f + 9*e*f*(f + g) - e*e*(3*f + 6*g + h)) +
+ d*(-3*c*(-9*f*f*g + e*e*(2*f - 6*g - 3*h) + e*(9*f*g + 6*g*g + f*h)) +
+ a*(-18*f*f*f - 18*e*g*g + 18*g*g*g - 2*e*e*h + 3*e*g*h + 2*e*h*h + 9*f*f*(3*g + 2*h) +
+ 3*f*(6*e*g - 9*g*g - e*h - 6*g*h)) - 3*b*(9*f*g*g + e*e*(4*g - 3*h) - 6*f*f*h -
+ e*(6*f*f + g*(18*g + h) - 3*f*(3*g + 4*h)))) +
+ 3*c*(3*b*(e*e*h + 3*f*g*h - e*(3*f*g - 6*f*h + 6*g*h + h*h)) +
a*(9*f*f*(g - 2*h) + f*h*(-e + 9*g + 4*h) - 3*(2*g*g*h + e*(2*g*g - 4*g*h + h*h))))) )
;
}
-
+
static double calc_xy(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
// + x*3*
-(-2*a*d*e*e - 7*d*d*e*e + 15*a*d*e*f + 21*d*d*e*f - 9*a*d*f*f - 18*d*d*f*f - 15*a*d*e*g -
- 3*d*d*e*g - 9*a*a*f*g + 9*d*d*f*g + 18*a*a*g*g + 9*a*d*g*g + 2*a*a*e*h - 2*d*d*e*h +
- 3*a*a*f*h + 15*a*d*f*h - 21*a*a*g*h - 15*a*d*g*h + 7*a*a*h*h + 2*a*d*h*h -
- 9*c*c*(2*e*e + 3*f*f + 3*f*h - 2*g*h + e*(-3*f - 4*g + h)) +
- 9*b*b*(3*g*g - 3*g*h + 2*h*(-2*f + h) + e*(-2*f + 3*g + h)) +
- 3*b*(3*c*(e*e + 3*e*(f - 3*g) + (9*f - 3*g - h)*h) + a*(6*f*f + e*g - 9*f*g - 9*g*g - 5*e*h + 9*f*h + 14*g*h - 7*h*h) +
- d*(-e*e + 12*f*f - 27*f*g + e*(-9*f + 20*g - 5*h) + g*(9*g + h))) +
- 3*c*(a*(-(e*f) - 9*f*f + 27*f*g - 12*g*g + 5*e*h - 20*f*h + 9*g*h + h*h) +
- d*(7*e*e + 9*f*f + 9*f*g - 6*g*g - f*h + e*(-14*f - 9*g + 5*h)))) // *y
+(-2*a*d*e*e - 7*d*d*e*e + 15*a*d*e*f + 21*d*d*e*f - 9*a*d*f*f - 18*d*d*f*f - 15*a*d*e*g -
+ 3*d*d*e*g - 9*a*a*f*g + 9*d*d*f*g + 18*a*a*g*g + 9*a*d*g*g + 2*a*a*e*h - 2*d*d*e*h +
+ 3*a*a*f*h + 15*a*d*f*h - 21*a*a*g*h - 15*a*d*g*h + 7*a*a*h*h + 2*a*d*h*h -
+ 9*c*c*(2*e*e + 3*f*f + 3*f*h - 2*g*h + e*(-3*f - 4*g + h)) +
+ 9*b*b*(3*g*g - 3*g*h + 2*h*(-2*f + h) + e*(-2*f + 3*g + h)) +
+ 3*b*(3*c*(e*e + 3*e*(f - 3*g) + (9*f - 3*g - h)*h) + a*(6*f*f + e*g - 9*f*g - 9*g*g - 5*e*h + 9*f*h + 14*g*h - 7*h*h) +
+ d*(-e*e + 12*f*f - 27*f*g + e*(-9*f + 20*g - 5*h) + g*(9*g + h))) +
+ 3*c*(a*(-(e*f) - 9*f*f + 27*f*g - 12*g*g + 5*e*h - 20*f*h + 9*g*h + h*h) +
+ d*(7*e*e + 9*f*f + 9*f*g - 6*g*g - f*h + e*(-14*f - 9*g + 5*h)))) // *y
;
}
@@ -358,7 +358,7 @@ static double (*calc_proc[])(double a, double b, double c, double d,
c = 3*C - 3*D
d = D
*/
-
+
/* http://www.algorithmist.net/bezier3.html
p = 3 * A
q = 3 * B
@@ -369,9 +369,9 @@ static double (*calc_proc[])(double a, double b, double c, double d,
d = D - A + q - r
B(t) = a + t * (b + t * (c + t * d))
-
+
so
-
+
B(t) = a + t*b + t*t*(c + t*d)
= a + t*b + t*t*c + t*t*t*d
*/
diff --git a/experimental/Intersection/CubicParameterizationCode.cpp b/experimental/Intersection/CubicParameterizationCode.cpp
index 15767ddff3..3fe0492bff 100644
--- a/experimental/Intersection/CubicParameterizationCode.cpp
+++ b/experimental/Intersection/CubicParameterizationCode.cpp
@@ -73,80 +73,80 @@ const char result2[] =
const size_t len2 = sizeof(result2) - 1;
/* Given: r1 = Resultant[
- * a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - x,
+ * a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - x,
* e*(1 - t)^3 + 3*f*(1 - t)^2*t + 3*g*(1 - t)*t^2 + h*t^3 - y, t]
* Collect[r1, {x, y}, Simplify]
* CForm[%]
* then use regex to replace Power\(([a-h]),3\) with \1*\1*\1
* and Power\(([a-h]),2\) with \1*\1
* yields:
-
-d*d*d*e*e*e - 3*d*d*(3*c*e*e*f + 3*b*e*(-3*f*f + 2*e*g) + a*(9*f*f*f - 9*e*f*g + e*e*h)) -
- h*(27*c*c*c*e*e - 27*c*c*(3*b*e*f - 3*a*f*f + 2*a*e*g) +
- h*(-27*b*b*b*e + 27*a*b*b*f - 9*a*a*b*g + a*a*a*h) +
- 9*c*(9*b*b*e*g + a*b*(-9*f*g + 3*e*h) + a*a*(3*g*g - 2*f*h))) +
- 3*d*(9*c*c*e*e*g + 9*b*b*e*(3*g*g - 2*f*h) + 3*a*b*(-9*f*g*g + 6*f*f*h + e*g*h) +
+
+d*d*d*e*e*e - 3*d*d*(3*c*e*e*f + 3*b*e*(-3*f*f + 2*e*g) + a*(9*f*f*f - 9*e*f*g + e*e*h)) -
+ h*(27*c*c*c*e*e - 27*c*c*(3*b*e*f - 3*a*f*f + 2*a*e*g) +
+ h*(-27*b*b*b*e + 27*a*b*b*f - 9*a*a*b*g + a*a*a*h) +
+ 9*c*(9*b*b*e*g + a*b*(-9*f*g + 3*e*h) + a*a*(3*g*g - 2*f*h))) +
+ 3*d*(9*c*c*e*e*g + 9*b*b*e*(3*g*g - 2*f*h) + 3*a*b*(-9*f*g*g + 6*f*f*h + e*g*h) +
a*a*(9*g*g*g - 9*f*g*h + e*h*h) + 3*c*(3*b*e*(-3*f*g + e*h) + a*(9*f*f*g - 6*e*g*g - e*f*h)))
-
-- Power(e - 3*f + 3*g - h,3)*Power(x,3)
-
-+ 3*(6*b*d*d*e*e - d*d*d*e*e + 18*b*b*d*e*f - 18*b*d*d*e*f -
- 9*b*d*d*f*f - 54*b*b*d*e*g + 12*b*d*d*e*g - 27*b*b*d*g*g - 18*b*b*b*e*h + 18*b*b*d*e*h +
- 18*b*b*d*f*h + a*a*a*h*h - 9*b*b*b*h*h + 9*c*c*c*e*(e + 2*h) +
- a*a*(-3*b*h*(2*g + h) + d*(-27*g*g + 9*g*h - h*(2*e + h) + 9*f*(g + h))) +
- a*(9*b*b*h*(2*f + h) - 3*b*d*(6*f*f - 6*f*(3*g - 2*h) + g*(-9*g + h) + e*(g + h)) +
- d*d*(e*e + 9*f*(3*f - g) + e*(-9*f - 9*g + 2*h))) -
- 9*c*c*(d*e*(e + 2*g) + 3*b*(f*h + e*(f + h)) + a*(-3*f*f - 6*f*h + 2*(g*h + e*(g + h)))) +
- 3*c*(d*d*e*(e + 2*f) + a*a*(3*g*g + 6*g*h - 2*h*(2*f + h)) + 9*b*b*(g*h + e*(g + h)) +
- a*d*(-9*f*f - 18*f*g + 6*g*g + f*h + e*(f + 12*g + h)) +
- b*(d*(-3*e*e + 9*f*g + e*(9*f + 9*g - 6*h)) + 3*a*(h*(2*e - 3*g + h) - 3*f*(g + h)))))*y
-
-- 3*(18*c*c*c*e - 18*c*c*d*e + 6*c*d*d*e - d*d*d*e + 3*c*d*d*f - 9*c*c*d*g + a*a*a*h + 9*c*c*c*h -
- 9*b*b*b*(e + 2*h) - a*a*(d*(e - 9*f + 18*g - 7*h) + 3*c*(2*f - 6*g + h)) +
- a*(-9*c*c*(2*e - 6*f + 2*g - h) + d*d*(-7*e + 18*f - 9*g + h) + 3*c*d*(7*e - 17*f + 3*g + h)) +
- 9*b*b*(3*c*(e + g + h) + a*(f + 2*h) - d*(e - 2*(f - 3*g + h))) -
- 3*b*(-(d*d*(e - 6*f + 2*g)) - 3*c*d*(e + 3*f + 3*g - h) + 9*c*c*(e + f + h) + a*a*(g + 2*h) +
- a*(c*(-3*e + 9*f + 9*g + 3*h) + d*(e + 3*f - 17*g + 7*h))))*Power(y,2)
-
-+ Power(a - 3*b + 3*c - d,3)*Power(y,3)
-
-+ Power(x,2)*(-3*(-9*b*e*f*f + 9*a*f*f*f + 6*b*e*e*g - 9*a*e*f*g + 27*b*e*f*g - 27*a*f*f*g + 18*a*e*g*g - 54*b*e*g*g +
- 27*a*f*g*g + 27*b*f*g*g - 18*a*g*g*g + a*e*e*h - 9*b*e*e*h + 3*a*e*f*h + 9*b*e*f*h + 9*a*f*f*h -
- 18*b*f*f*h - 21*a*e*g*h + 51*b*e*g*h - 9*a*f*g*h - 27*b*f*g*h + 18*a*g*g*h + 7*a*e*h*h - 18*b*e*h*h - 3*a*f*h*h +
- 18*b*f*h*h - 6*a*g*h*h - 3*b*g*h*h + a*h*h*h +
- 3*c*(-9*f*f*(g - 2*h) + 3*g*g*h - f*h*(9*g + 2*h) + e*e*(f - 6*g + 6*h) +
- e*(9*f*g + 6*g*g - 17*f*h - 3*g*h + 3*h*h)) -
- d*(e*e*e + e*e*(-6*f - 3*g + 7*h) - 9*(2*f - g)*(f*f + g*g - f*(g + h)) +
+
+- Power(e - 3*f + 3*g - h,3)*Power(x,3)
+
++ 3*(6*b*d*d*e*e - d*d*d*e*e + 18*b*b*d*e*f - 18*b*d*d*e*f -
+ 9*b*d*d*f*f - 54*b*b*d*e*g + 12*b*d*d*e*g - 27*b*b*d*g*g - 18*b*b*b*e*h + 18*b*b*d*e*h +
+ 18*b*b*d*f*h + a*a*a*h*h - 9*b*b*b*h*h + 9*c*c*c*e*(e + 2*h) +
+ a*a*(-3*b*h*(2*g + h) + d*(-27*g*g + 9*g*h - h*(2*e + h) + 9*f*(g + h))) +
+ a*(9*b*b*h*(2*f + h) - 3*b*d*(6*f*f - 6*f*(3*g - 2*h) + g*(-9*g + h) + e*(g + h)) +
+ d*d*(e*e + 9*f*(3*f - g) + e*(-9*f - 9*g + 2*h))) -
+ 9*c*c*(d*e*(e + 2*g) + 3*b*(f*h + e*(f + h)) + a*(-3*f*f - 6*f*h + 2*(g*h + e*(g + h)))) +
+ 3*c*(d*d*e*(e + 2*f) + a*a*(3*g*g + 6*g*h - 2*h*(2*f + h)) + 9*b*b*(g*h + e*(g + h)) +
+ a*d*(-9*f*f - 18*f*g + 6*g*g + f*h + e*(f + 12*g + h)) +
+ b*(d*(-3*e*e + 9*f*g + e*(9*f + 9*g - 6*h)) + 3*a*(h*(2*e - 3*g + h) - 3*f*(g + h)))))*y
+
+- 3*(18*c*c*c*e - 18*c*c*d*e + 6*c*d*d*e - d*d*d*e + 3*c*d*d*f - 9*c*c*d*g + a*a*a*h + 9*c*c*c*h -
+ 9*b*b*b*(e + 2*h) - a*a*(d*(e - 9*f + 18*g - 7*h) + 3*c*(2*f - 6*g + h)) +
+ a*(-9*c*c*(2*e - 6*f + 2*g - h) + d*d*(-7*e + 18*f - 9*g + h) + 3*c*d*(7*e - 17*f + 3*g + h)) +
+ 9*b*b*(3*c*(e + g + h) + a*(f + 2*h) - d*(e - 2*(f - 3*g + h))) -
+ 3*b*(-(d*d*(e - 6*f + 2*g)) - 3*c*d*(e + 3*f + 3*g - h) + 9*c*c*(e + f + h) + a*a*(g + 2*h) +
+ a*(c*(-3*e + 9*f + 9*g + 3*h) + d*(e + 3*f - 17*g + 7*h))))*Power(y,2)
+
++ Power(a - 3*b + 3*c - d,3)*Power(y,3)
+
++ Power(x,2)*(-3*(-9*b*e*f*f + 9*a*f*f*f + 6*b*e*e*g - 9*a*e*f*g + 27*b*e*f*g - 27*a*f*f*g + 18*a*e*g*g - 54*b*e*g*g +
+ 27*a*f*g*g + 27*b*f*g*g - 18*a*g*g*g + a*e*e*h - 9*b*e*e*h + 3*a*e*f*h + 9*b*e*f*h + 9*a*f*f*h -
+ 18*b*f*f*h - 21*a*e*g*h + 51*b*e*g*h - 9*a*f*g*h - 27*b*f*g*h + 18*a*g*g*h + 7*a*e*h*h - 18*b*e*h*h - 3*a*f*h*h +
+ 18*b*f*h*h - 6*a*g*h*h - 3*b*g*h*h + a*h*h*h +
+ 3*c*(-9*f*f*(g - 2*h) + 3*g*g*h - f*h*(9*g + 2*h) + e*e*(f - 6*g + 6*h) +
+ e*(9*f*g + 6*g*g - 17*f*h - 3*g*h + 3*h*h)) -
+ d*(e*e*e + e*e*(-6*f - 3*g + 7*h) - 9*(2*f - g)*(f*f + g*g - f*(g + h)) +
e*(18*f*f + 9*g*g + 3*g*h + h*h - 3*f*(3*g + 7*h)))) )
-
+
+ Power(x,2)*(3*(a - 3*b + 3*c - d)*Power(e - 3*f + 3*g - h,2)*y)
-
-+ x*(-3*(27*b*b*e*g*g - 27*a*b*f*g*g + 9*a*a*g*g*g - 18*b*b*e*f*h + 18*a*b*f*f*h + 3*a*b*e*g*h -
- 27*b*b*e*g*h - 9*a*a*f*g*h + 27*a*b*f*g*h - 9*a*a*g*g*h + a*a*e*h*h - 9*a*b*e*h*h +
- 27*b*b*e*h*h + 6*a*a*f*h*h - 18*a*b*f*h*h - 9*b*b*f*h*h + 3*a*a*g*h*h +
- 6*a*b*g*h*h - a*a*h*h*h + 9*c*c*(e*e*(g - 3*h) - 3*f*f*h + e*(3*f + 2*g)*h) +
- d*d*(e*e*e - 9*f*f*f + 9*e*f*(f + g) - e*e*(3*f + 6*g + h)) +
- d*(-3*c*(-9*f*f*g + e*e*(2*f - 6*g - 3*h) + e*(9*f*g + 6*g*g + f*h)) +
- a*(-18*f*f*f - 18*e*g*g + 18*g*g*g - 2*e*e*h + 3*e*g*h + 2*e*h*h + 9*f*f*(3*g + 2*h) +
- 3*f*(6*e*g - 9*g*g - e*h - 6*g*h)) - 3*b*(9*f*g*g + e*e*(4*g - 3*h) - 6*f*f*h -
- e*(6*f*f + g*(18*g + h) - 3*f*(3*g + 4*h)))) +
- 3*c*(3*b*(e*e*h + 3*f*g*h - e*(3*f*g - 6*f*h + 6*g*h + h*h)) +
+
++ x*(-3*(27*b*b*e*g*g - 27*a*b*f*g*g + 9*a*a*g*g*g - 18*b*b*e*f*h + 18*a*b*f*f*h + 3*a*b*e*g*h -
+ 27*b*b*e*g*h - 9*a*a*f*g*h + 27*a*b*f*g*h - 9*a*a*g*g*h + a*a*e*h*h - 9*a*b*e*h*h +
+ 27*b*b*e*h*h + 6*a*a*f*h*h - 18*a*b*f*h*h - 9*b*b*f*h*h + 3*a*a*g*h*h +
+ 6*a*b*g*h*h - a*a*h*h*h + 9*c*c*(e*e*(g - 3*h) - 3*f*f*h + e*(3*f + 2*g)*h) +
+ d*d*(e*e*e - 9*f*f*f + 9*e*f*(f + g) - e*e*(3*f + 6*g + h)) +
+ d*(-3*c*(-9*f*f*g + e*e*(2*f - 6*g - 3*h) + e*(9*f*g + 6*g*g + f*h)) +
+ a*(-18*f*f*f - 18*e*g*g + 18*g*g*g - 2*e*e*h + 3*e*g*h + 2*e*h*h + 9*f*f*(3*g + 2*h) +
+ 3*f*(6*e*g - 9*g*g - e*h - 6*g*h)) - 3*b*(9*f*g*g + e*e*(4*g - 3*h) - 6*f*f*h -
+ e*(6*f*f + g*(18*g + h) - 3*f*(3*g + 4*h)))) +
+ 3*c*(3*b*(e*e*h + 3*f*g*h - e*(3*f*g - 6*f*h + 6*g*h + h*h)) +
a*(9*f*f*(g - 2*h) + f*h*(-e + 9*g + 4*h) - 3*(2*g*g*h + e*(2*g*g - 4*g*h + h*h))))) )
-
-+ x*3*(-2*a*d*e*e - 7*d*d*e*e + 15*a*d*e*f + 21*d*d*e*f - 9*a*d*f*f - 18*d*d*f*f - 15*a*d*e*g -
- 3*d*d*e*g - 9*a*a*f*g + 9*d*d*f*g + 18*a*a*g*g + 9*a*d*g*g + 2*a*a*e*h - 2*d*d*e*h +
- 3*a*a*f*h + 15*a*d*f*h - 21*a*a*g*h - 15*a*d*g*h + 7*a*a*h*h + 2*a*d*h*h -
- 9*c*c*(2*e*e + 3*f*f + 3*f*h - 2*g*h + e*(-3*f - 4*g + h)) +
- 9*b*b*(3*g*g - 3*g*h + 2*h*(-2*f + h) + e*(-2*f + 3*g + h)) +
- 3*b*(3*c*(e*e + 3*e*(f - 3*g) + (9*f - 3*g - h)*h) + a*(6*f*f + e*g - 9*f*g - 9*g*g - 5*e*h + 9*f*h + 14*g*h - 7*h*h) +
- d*(-e*e + 12*f*f - 27*f*g + e*(-9*f + 20*g - 5*h) + g*(9*g + h))) +
- 3*c*(a*(-(e*f) - 9*f*f + 27*f*g - 12*g*g + 5*e*h - 20*f*h + 9*g*h + h*h) +
- d*(7*e*e + 9*f*f + 9*f*g - 6*g*g - f*h + e*(-14*f - 9*g + 5*h))))*y
-
+
++ x*3*(-2*a*d*e*e - 7*d*d*e*e + 15*a*d*e*f + 21*d*d*e*f - 9*a*d*f*f - 18*d*d*f*f - 15*a*d*e*g -
+ 3*d*d*e*g - 9*a*a*f*g + 9*d*d*f*g + 18*a*a*g*g + 9*a*d*g*g + 2*a*a*e*h - 2*d*d*e*h +
+ 3*a*a*f*h + 15*a*d*f*h - 21*a*a*g*h - 15*a*d*g*h + 7*a*a*h*h + 2*a*d*h*h -
+ 9*c*c*(2*e*e + 3*f*f + 3*f*h - 2*g*h + e*(-3*f - 4*g + h)) +
+ 9*b*b*(3*g*g - 3*g*h + 2*h*(-2*f + h) + e*(-2*f + 3*g + h)) +
+ 3*b*(3*c*(e*e + 3*e*(f - 3*g) + (9*f - 3*g - h)*h) + a*(6*f*f + e*g - 9*f*g - 9*g*g - 5*e*h + 9*f*h + 14*g*h - 7*h*h) +
+ d*(-e*e + 12*f*f - 27*f*g + e*(-9*f + 20*g - 5*h) + g*(9*g + h))) +
+ 3*c*(a*(-(e*f) - 9*f*f + 27*f*g - 12*g*g + 5*e*h - 20*f*h + 9*g*h + h*h) +
+ d*(7*e*e + 9*f*f + 9*f*g - 6*g*g - f*h + e*(-14*f - 9*g + 5*h))))*y
+
- x*3*Power(a - 3*b + 3*c - d,2)*(e - 3*f + 3*g - h)*Power(y,2)
-
+
*/
-
+
const int factors = 8;
struct coeff {
@@ -276,7 +276,7 @@ void cubecode_test(int test) {
"\n ", 'A' + (it - c.begin()));
if (co[0].s > 0) {
printf(" ");
- }
+ }
if (abs(co[0].s) == 1) {
printf(" ");
}
diff --git a/experimental/Intersection/CubicParameterization_Test.cpp b/experimental/Intersection/CubicParameterization_Test.cpp
index 716aaec9e2..2139f3bc6b 100644
--- a/experimental/Intersection/CubicParameterization_Test.cpp
+++ b/experimental/Intersection/CubicParameterization_Test.cpp
@@ -91,7 +91,7 @@ void CubicParameterization_Test() {
for (size_t index = firstCubicParameterizationTest; index < cubics_count; ++index) {
for (size_t inner = 0; inner < 4; inner += 3) {
if (!point_on_parameterized_curve(cubics[index], cubics[index][inner])) {
- printf("%s [%zu,%zu] 1 parameterization failed\n",
+ printf("%s [%zu,%zu] 1 parameterization failed\n",
__FUNCTION__, index, inner);
}
if (!point_on_parameterized_curve(cubics[index], cubics[index ^ 1][inner])) {
diff --git a/experimental/Intersection/CubicReduceOrder.cpp b/experimental/Intersection/CubicReduceOrder.cpp
index 84f2079826..b9c3c59581 100644
--- a/experimental/Intersection/CubicReduceOrder.cpp
+++ b/experimental/Intersection/CubicReduceOrder.cpp
@@ -30,7 +30,7 @@ static int vertical_line(const Cubic& cubic, Cubic& reduction) {
if (reduction[smaller].y > yExtrema) {
reduction[smaller].y = yExtrema;
continue;
- }
+ }
if (reduction[larger].y < yExtrema) {
reduction[larger].y = yExtrema;
}
@@ -50,7 +50,7 @@ static int horizontal_line(const Cubic& cubic, Cubic& reduction) {
if (reduction[smaller].x > xExtrema) {
reduction[smaller].x = xExtrema;
continue;
- }
+ }
if (reduction[larger].x < xExtrema) {
reduction[larger].x = xExtrema;
}
@@ -183,7 +183,7 @@ http://kaba.hilvi.org
// reduce to a quadratic or smaller
// look for identical points
-// look for all four points in a line
+// look for all four points in a line
// note that three points in a line doesn't simplify a cubic
// look for approximation with single quadratic
// save approximation with multiple quadratics for later
diff --git a/experimental/Intersection/CubicReduceOrder_Test.cpp b/experimental/Intersection/CubicReduceOrder_Test.cpp
index 98662e2049..4a8e622026 100644
--- a/experimental/Intersection/CubicReduceOrder_Test.cpp
+++ b/experimental/Intersection/CubicReduceOrder_Test.cpp
@@ -37,7 +37,7 @@ void CubicReduceOrder_Test() {
int firstQuadraticLineTest = run == RunAll ? 0 : run == RunQuadraticLines ? firstTestIndex : INT_MAX;
int firstQuadraticModLineTest = run == RunAll ? 0 : run == RunQuadraticModLines ? firstTestIndex : INT_MAX;
int firstComputedLinesTest = run == RunAll ? 0 : run == RunComputedLines ? firstTestIndex : INT_MAX;
-
+
for (index = firstPointDegeneratesTest; index < pointDegenerates_count; ++index) {
const Cubic& cubic = pointDegenerates[index];
order = reduceOrder(cubic, reduce, kReduceOrder_QuadraticsAllowed);
@@ -105,11 +105,11 @@ void CubicReduceOrder_Test() {
printf("[%d] line mod quad order=%d\n", (int) index, order);
}
}
-
+
// test if computed line end points are valid
for (index = firstComputedLinesTest; index < lines_count; ++index) {
const Cubic& cubic = lines[index];
- bool controlsInside = controls_inside(cubic);
+ bool controlsInside = controls_inside(cubic);
order = reduceOrder(cubic, reduce, kReduceOrder_QuadraticsAllowed);
if (reduce[0].x == reduce[1].x && reduce[0].y == reduce[1].y) {
printf("[%d] line computed ends match order=%d\n", (int) index, order);
@@ -132,7 +132,7 @@ void CubicReduceOrder_Test() {
|| !approximately_equal(reduce[1].y, bounds.top) && !approximately_equal(reduce[1].y, bounds.bottom)) {
printf("[%d] line computed tight bounds order=%d\n", (int) index, order);
}
-
+
}
}
}
diff --git a/experimental/Intersection/CubicSubDivide.cpp b/experimental/Intersection/CubicSubDivide.cpp
index 0c6ed424f3..98250ad426 100644
--- a/experimental/Intersection/CubicSubDivide.cpp
+++ b/experimental/Intersection/CubicSubDivide.cpp
@@ -3,21 +3,21 @@
/*
Given a cubic c, t1, and t2, find a small cubic segment.
-
+
The new cubic is defined as points A, B, C, and D, where
s1 = 1 - t1
s2 = 1 - t2
A = c[0]*s1*s1*s1 + 3*c[1]*s1*s1*t1 + 3*c[2]*s1*t1*t1 + c[3]*t1*t1*t1
D = c[0]*s2*s2*s2 + 3*c[1]*s2*s2*t2 + 3*c[2]*s2*t2*t2 + c[3]*t2*t2*t2
-
+
We don't have B or C. So We define two equations to isolate them.
First, compute two reference T values 1/3 and 2/3 from t1 to t2:
-
+
c(at (2*t1 + t2)/3) == E
c(at (t1 + 2*t2)/3) == F
-
+
Next, compute where those values must be if we know the values of B and C:
-
+
_12 = A*2/3 + B*1/3
12_ = A*1/3 + B*2/3
_23 = B*2/3 + C*1/3
@@ -36,9 +36,9 @@
= F
E*27 = A*8 + B*12 + C*6 + D
F*27 = A + B*6 + C*12 + D*8
-
+
Group the known values on one side:
-
+
M = E*27 - A*8 - D = B*12 + C* 6
N = F*27 - A - D*8 = B* 6 + C*12
M*2 - N = B*18
@@ -46,7 +46,7 @@ Group the known values on one side:
B = (M*2 - N)/18
C = (N*2 - M)/18
*/
-
+
static double interp_cubic_coords(const double* src, double t)
{
double ab = interp(src[0], src[2], t);
@@ -57,7 +57,7 @@ static double interp_cubic_coords(const double* src, double t)
double abcd = interp(abc, bcd, t);
return abcd;
}
-
+
void sub_divide(const Cubic& src, double t1, double t2, Cubic& dst) {
double ax = dst[0].x = interp_cubic_coords(&src[0].x, t1);
double ay = dst[0].y = interp_cubic_coords(&src[0].y, t1);
diff --git a/experimental/Intersection/DataTypes.cpp b/experimental/Intersection/DataTypes.cpp
index db153f6f9a..546665cebf 100644
--- a/experimental/Intersection/DataTypes.cpp
+++ b/experimental/Intersection/DataTypes.cpp
@@ -7,7 +7,7 @@
extern "C" {
#endif
-void *memcpy(void *, const void *, size_t);
+void *memcpy(void *, const void *, size_t);
#ifdef __cplusplus
}
@@ -29,7 +29,7 @@ union Float_t
bool Negative() const { return (i >> 31) != 0; }
int32_t RawMantissa() const { return i & ((1 << 23) - 1); }
int32_t RawExponent() const { return (i >> 23) & 0xFF; }
-
+
int32_t i;
float f;
#ifdef _DEBUG
@@ -41,25 +41,25 @@ union Float_t
} parts;
#endif
};
-
+
bool AlmostEqualUlps(float A, float B, int maxUlpsDiff)
{
Float_t uA(A);
Float_t uB(B);
-
+
// Different signs means they do not match.
if (uA.Negative() != uB.Negative())
{
// Check for equality to make sure +0==-0
return A == B;
}
-
+
// Find the difference in ULPs.
int ulpsDiff = abs(uA.i - uB.i);
return ulpsDiff <= maxUlpsDiff;
}
-int UlpsDiff(float A, float B)
+int UlpsDiff(float A, float B)
{
Float_t uA(A);
Float_t uB(B);
diff --git a/experimental/Intersection/DataTypes.h b/experimental/Intersection/DataTypes.h
index c06e6ee827..8c924af48d 100644
--- a/experimental/Intersection/DataTypes.h
+++ b/experimental/Intersection/DataTypes.h
@@ -59,7 +59,7 @@ const double SquaredEpsilon = PointEpsilon * PointEpsilon;
#endif
inline bool approximately_zero(double x) {
-
+
return fabs(x) < FLT_EPSILON;
}
@@ -121,7 +121,7 @@ struct _Point {
friend bool operator!=(const _Point& a, const _Point& b) {
return a.x!= b.x || a.y != b.y;
}
-
+
bool approximatelyEqual(const _Point& a) const {
return approximately_equal(a.y, y) && approximately_equal(a.x, x);
}
@@ -137,7 +137,7 @@ struct _Rect {
double top;
double right;
double bottom;
-
+
void add(const _Point& pt) {
if (left > pt.x) {
left = pt.x;
@@ -152,17 +152,17 @@ struct _Rect {
bottom = pt.y;
}
}
-
+
void set(const _Point& pt) {
left = right = pt.x;
top = bottom = pt.y;
}
-
+
void setBounds(const _Line& line) {
set(line[0]);
add(line[1]);
}
-
+
void setBounds(const Cubic& );
void setBounds(const Quadratic& );
void setRawBounds(const Cubic& );
diff --git a/experimental/Intersection/EdgeDemo.cpp b/experimental/Intersection/EdgeDemo.cpp
index 21eefee1f3..33aae21750 100644
--- a/experimental/Intersection/EdgeDemo.cpp
+++ b/experimental/Intersection/EdgeDemo.cpp
@@ -68,7 +68,7 @@ static bool drawCircles(SkCanvas* canvas, int step, bool useOld)
return true;
}
-static void createStar(SkPath& path, SkScalar innerRadius, SkScalar outerRadius,
+static void createStar(SkPath& path, SkScalar innerRadius, SkScalar outerRadius,
SkScalar startAngle, int points, SkPoint center) {
SkScalar angle = startAngle;
for (int index = 0; index < points * 2; ++index) {
diff --git a/experimental/Intersection/EdgeWalker.cpp b/experimental/Intersection/EdgeWalker.cpp
index 4442e9226a..47bd0373e8 100644
--- a/experimental/Intersection/EdgeWalker.cpp
+++ b/experimental/Intersection/EdgeWalker.cpp
@@ -275,10 +275,10 @@ bounds for edge
sort
active T
-if a contour's bounds is outside of the active area, no need to create edges
+if a contour's bounds is outside of the active area, no need to create edges
*/
-/* given one or more paths,
+/* given one or more paths,
find the bounds of each contour, select the active contours
for each active contour, compute a set of edges
each edge corresponds to one or more lines and curves
@@ -303,7 +303,7 @@ void contourBounds(const SkPath& path, SkTDArray<SkRect>& boundsArray) {
bounds.set(pts[0].fX, pts[0].fY, pts[0].fX, pts[0].fY);
count = 0;
break;
- case SkPath::kLine_Verb:
+ case SkPath::kLine_Verb:
count = 1;
break;
case SkPath::kQuad_Verb:
@@ -611,7 +611,7 @@ public:
one, two, endPt1.fX < endPt2.fX ? "true" : "false");
#endif
return endPt1.fX < endPt2.fX;
- }
+ }
SkScalar dx1y2 = (startPt1.fX - endPt1.fX) * dy2;
SkScalar dx2y1 = (startPt2.fX - endPt2.fX) * dy1;
#if DEBUG_OUT_LESS_THAN
@@ -708,7 +708,7 @@ public:
for (index = 0; index < count; ++index) {
const OutEdge& edge = fEdges[index];
uint8_t verb = edge.fVerb;
- SkDebugf("%s %d edge=%d %s (%1.9g,%1.9g) (%1.9g,%1.9g)\n",
+ SkDebugf("%s %d edge=%d %s (%1.9g,%1.9g) (%1.9g,%1.9g)\n",
index == 0 ? __FUNCTION__ : " ",
index + 1, edge.fID, kLVerbStr[verb], edge.fPts[0].fX,
edge.fPts[0].fY, edge.fPts[verb].fX, edge.fPts[verb].fY);
@@ -754,7 +754,7 @@ public:
, fBottomIntercepts(0)
, fExplicit(false) {
}
-
+
Intercepts& operator=(const Intercepts& src) {
fTs = src.fTs;
fTopIntercepts = src.fTopIntercepts;
@@ -808,7 +808,7 @@ public:
unsigned char fTopIntercepts; // 0=init state 1=1 edge >1=multiple edges
unsigned char fBottomIntercepts;
bool fExplicit; // if set, suppress 0 and 1
-
+
};
struct HorizontalEdge {
@@ -842,7 +842,7 @@ struct InEdge {
// Avoid collapsing t values that are close to the same since
// we walk ts to describe consecutive intersections. Since a pair of ts can
// be nearly equal, any problems caused by this should be taken care
- // of later.
+ // of later.
int add(double* ts, size_t count, ptrdiff_t verbIndex) {
// FIXME: in the pathological case where there is a ton of intercepts, binary search?
bool foundIntercept = false;
@@ -885,7 +885,7 @@ struct InEdge {
fContainsIntercepts |= foundIntercept;
return insertedAt;
}
-
+
void addPartial(SkTArray<InEdge>& edges, int ptStart, int ptEnd,
int verbStart, int verbEnd) {
InEdge* edge = edges.push_back_n(1);
@@ -954,7 +954,7 @@ struct InEdge {
}
fContainsIntercepts = fIntersected = false;
}
-
+
void flip() {
size_t index;
size_t last = fPts.count() - 1;
@@ -966,7 +966,7 @@ struct InEdge {
SkTSwap<uint8_t>(fVerbs[index], fVerbs[last]);
}
}
-
+
void flipTs() {
SkASSERT(fIntercepts.count() == 1);
Intercepts& intercepts = fIntercepts[0];
@@ -1006,7 +1006,7 @@ struct InEdge {
++ptPtr;
}
}
-
+
// recompute bounds based on subrange of T values
void setSubBounds() {
SkASSERT(fIntercepts.count() == 1);
@@ -1078,7 +1078,7 @@ struct InEdge {
__FUNCTION__, lastSplit, firstSplit);
#endif
}
- addSplit(edges, pts, verb, intercepts,
+ addSplit(edges, pts, verb, intercepts,
firstSplit, tIndex, true);
#if DEBUG_SPLIT
SkDebugf("%s addSplit 2 tIndex=%d,%d flip\n",
@@ -1180,7 +1180,7 @@ class InEdgeBuilder {
public:
InEdgeBuilder(const SkPath& path, bool ignoreHorizontal, SkTArray<InEdge>& edges,
- SkTDArray<HorizontalEdge>& horizontalEdges)
+ SkTDArray<HorizontalEdge>& horizontalEdges)
: fPath(path)
, fCurrentEdge(NULL)
, fEdges(edges)
@@ -1332,7 +1332,7 @@ struct WorkEdge {
fPts += *fVerb++;
return fVerb != fEdge->fVerbs.end();
}
-
+
const SkPoint* lastPoints() const {
SkASSERT(fPts >= fEdge->fPts.begin() + lastVerb());
return &fPts[-lastVerb()];
@@ -1384,7 +1384,7 @@ public:
if (fVerb != SkPath::kLine_Verb ? noIntersect(rh) : rh.noIntersect(*this)) {
return abCompare(fAbove, fBelow, rh.fAbove, rh.fBelow);
}
- // use whichever of top/tangent tangent/bottom overlaps more
+ // use whichever of top/tangent tangent/bottom overlaps more
// with line top/bot
// assumes quad/cubic can already be upconverted to cubic/cubic
const SkPoint* line[2];
@@ -1405,7 +1405,7 @@ public:
// FIXME: code has been abandoned, incomplete....
return false;
}
-
+
bool abCompare(const SkPoint& a1, const SkPoint& a2, const SkPoint& b1,
const SkPoint& b2) const {
double topD = a1.fX - b1.fX;
@@ -1498,7 +1498,7 @@ public:
SkASSERT(!fExplicitTs);
fTIndex = fTs->count() + 1;
}
-
+
void calcAboveBelow(double tAbove, double tBelow) {
fVerb = fWorkEdge.verb();
switch (fVerb) {
@@ -1520,7 +1520,7 @@ public:
CubicSubDivide(fWorkEdge.fPts, tAbove, tBelow, cubic);
fAbove = cubic[0];
// FIXME: can't see how quad logic for how tangent is used
- // extends to cubic
+ // extends to cubic
fTangent = cubic[0] != cubic[1] ? cubic[1]
: cubic[0] != cubic[2] ? cubic[2] : cubic[3];
fBelow = cubic[3];
@@ -1574,7 +1574,7 @@ public:
bool done(SkScalar bottom) const {
return fDone || fYBottom >= bottom;
}
-
+
void fixBelow() {
if (fFixBelow) {
fTBelow = nextT();
@@ -1636,11 +1636,11 @@ public:
// SkPath::Verb lastVerb() const {
// return fDone ? fWorkEdge.lastVerb() : fWorkEdge.verb();
// }
-
+
const SkPoint* lastPoints() const {
return fDone ? fWorkEdge.lastPoints() : fWorkEdge.points();
}
-
+
bool noIntersect(const ActiveEdge& ) const {
// incomplete
return false;
@@ -1683,7 +1683,7 @@ public:
}
return false;
}
-
+
bool swapUnordered(const ActiveEdge* edge, SkScalar /* bottom */) const {
SkASSERT(fVerb != SkPath::kLine_Verb
|| edge->fVerb != SkPath::kLine_Verb);
@@ -1771,7 +1771,7 @@ public:
}
return IsCoincident(curveSample, lineEdge->fAbove, lineEdge->fBelow);
}
-
+
double nextT() const {
SkASSERT(fTIndex <= fTs->count() - fExplicitTs);
return t(fTIndex + 1);
@@ -1785,7 +1785,7 @@ public:
if (fExplicitTs) {
SkASSERT(tIndex < fTs->count());
return (*fTs)[tIndex];
- }
+ }
if (tIndex == 0) {
return 0;
}
@@ -1805,7 +1805,7 @@ private:
void extractAboveBelow(ActiveEdge& extracted) const {
SkPoint curve[4];
switch (fVerb) {
- case SkPath::kLine_Verb:
+ case SkPath::kLine_Verb:
extracted.fAbove = fAbove;
extracted.fTangent = fTangent;
return;
@@ -1854,10 +1854,10 @@ static void addToActive(SkTDArray<ActiveEdge>& activeEdges, const InEdge* edge)
// Find any intersections in the range of active edges. A pair of edges, on
// either side of another edge, may change the winding contribution for part of
-// the edge.
+// the edge.
// Keep horizontal edges just for
// the purpose of computing when edges change their winding contribution, since
-// this is essentially computing the horizontal intersection.
+// this is essentially computing the horizontal intersection.
static void addBottomT(InEdge** currentPtr, InEdge** lastPtr,
HorizontalEdge** horizontal) {
InEdge** testPtr = currentPtr - 1;
@@ -2134,7 +2134,7 @@ static SkScalar computeInterceptBottom(SkTDArray<ActiveEdge>& activeEdges,
return bottom;
}
-static SkScalar findBottom(InEdge** currentPtr,
+static SkScalar findBottom(InEdge** currentPtr,
InEdge** edgeListEnd, SkTDArray<ActiveEdge>* activeEdges, SkScalar y,
bool /*asFill*/, InEdge**& testPtr) {
InEdge* current = *currentPtr;
@@ -2154,7 +2154,7 @@ static SkScalar findBottom(InEdge** currentPtr,
if (testTop > y) {
bottom = testTop;
break;
- }
+ }
if (y < testBottom) {
if (bottom > testBottom) {
bottom = testBottom;
@@ -2208,7 +2208,7 @@ static void skipCoincidence(int lastWinding, int winding, int windingMask,
ActiveEdge* activePtr, ActiveEdge* firstCoincident) {
if (((lastWinding & windingMask) == 0) ^ (winding & windingMask) != 0) {
return;
- }
+ }
// FIXME: ? shouldn't this be if (lastWinding & windingMask) ?
if (lastWinding) {
#if DEBUG_ADJUST_COINCIDENT
@@ -2374,7 +2374,7 @@ static SkScalar adjustCoincident(SkTDArray<ActiveEdge*>& edgeList,
int priorWinding = winding;
winding += activePtr->fWorkEdge.winding();
nextPtr = edgeList[index];
- if (activePtr->fSkip && nextPtr->fSkip
+ if (activePtr->fSkip && nextPtr->fSkip
&& activePtr->fCoincident == nextPtr->fCoincident) {
if (!firstCoincident) {
firstCoincident = activePtr;
@@ -2441,7 +2441,7 @@ static SkScalar adjustCoincident(SkTDArray<ActiveEdge*>& edgeList,
}
// stitch edge and t range that satisfies operation
-static void stitchEdge(SkTDArray<ActiveEdge*>& edgeList, SkScalar
+static void stitchEdge(SkTDArray<ActiveEdge*>& edgeList, SkScalar
#if DEBUG_STITCH_EDGE
y
#endif
@@ -2487,10 +2487,10 @@ y
SkPath::Verb verb = activePtr->fVerb;
do {
nextT = activePtr->nextT();
- // FIXME: obtuse: want efficient way to say
+ // FIXME: obtuse: want efficient way to say
// !currentT && currentT != 1 || !nextT && nextT != 1
if (currentT * nextT != 0 || currentT + nextT != 1) {
- // OPTIMIZATION: if !inWinding, we only need
+ // OPTIMIZATION: if !inWinding, we only need
// clipped[1].fY
switch (verb) {
case SkPath::kLine_Verb:
@@ -2551,7 +2551,7 @@ y
}
currentT = nextT;
moreToDo = activePtr->advanceT();
- activePtr->fYBottom = clipped[verb].fY; // was activePtr->fCloseCall ? bottom :
+ activePtr->fYBottom = clipped[verb].fY; // was activePtr->fCloseCall ? bottom :
// clearing the fSkip/fCloseCall bit here means that trailing edges
// fall out of sync, if one edge is long and another is a series of short pieces
@@ -2660,7 +2660,7 @@ void simplify(const SkPath& path, bool asFill, SkPath& simple) {
// each contour will need to know whether it is CW or CCW, and then whether
// a ray from that contour hits any a contour that contains it. The ray can
// move to the left and then arbitrarily move up or down (as long as it never
- // moves to the right) to find a reference sibling contour or containing
+ // moves to the right) to find a reference sibling contour or containing
// contour. If the contour is part of an intersection, the companion contour
// that is part of the intersection can determine the containership.
if (builder.containsCurves()) {
diff --git a/experimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp b/experimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp
index befac71c7c..624ef3880b 100755
--- a/experimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp
+++ b/experimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp
@@ -81,7 +81,7 @@ void Simplify4x4QuadralateralsThreaded_Test(int& testsRun)
for (int a = 0; a < 16; ++a) {
for (int b = a ; b < 16; ++b) {
for (int c = b ; c < 16; ++c) {
- for (int d = c; d < 16; ++d) {
+ for (int d = c; d < 16; ++d) {
testsRun += dispatchTest4(testSimplify4x4QuadralateralsMain,
a, b, c, d);
}
diff --git a/experimental/Intersection/EdgeWalkerPolygons_Test.cpp b/experimental/Intersection/EdgeWalkerPolygons_Test.cpp
index 80ef5270ce..78269c4097 100644
--- a/experimental/Intersection/EdgeWalkerPolygons_Test.cpp
+++ b/experimental/Intersection/EdgeWalkerPolygons_Test.cpp
@@ -16,7 +16,7 @@ static void testSimplifyTriangle() {
path.lineTo(20,30);
path.close();
testSimplify(path, true, out, bitmap); // expect |\/|
- // |__|
+ // |__|
}
static void testSimplifyTriangle3() {
@@ -232,7 +232,7 @@ static void testSimplifyTriangle17() {
path.close();
testSimplify(path, true, out, bitmap);
}
-
+
static void testSimplifyTriangle18() {
SkPath path, out;
path.moveTo(0, 0);
@@ -315,7 +315,7 @@ static void testSimplifyDegenerateTriangle2() {
static void testSimplifyWindingParallelogram() {
SkPath path, out;
path.setFillType(SkPath::kWinding_FillType);
- path.moveTo(20,10); // parallelogram _
+ path.moveTo(20,10); // parallelogram _
path.lineTo(30,30); // \ \ .
path.lineTo(40,30); // \_\ .
path.lineTo(30,10);
@@ -326,13 +326,13 @@ static void testSimplifyWindingParallelogram() {
path.lineTo(30,10);
path.close();
testSimplify(path, true, out, bitmap); // expect _
- // / \ .
+ // / \ .
} // /___\ .
static void testSimplifyXorParallelogram() {
SkPath path, out;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.moveTo(20,10); // parallelogram _
+ path.moveTo(20,10); // parallelogram _
path.lineTo(30,30); // \ \ .
path.lineTo(40,30); // \_\ .
path.lineTo(30,10);
@@ -352,7 +352,7 @@ static void testSimplifyTriangle2() {
path.lineTo(10,30); // |_\ .
path.lineTo(20,30);
path.close();
- path.moveTo(10,10); // triangle _
+ path.moveTo(10,10); // triangle _
path.lineTo(20,10); // \ |
path.lineTo(20,30); // \|
path.close(); // _
diff --git a/experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp b/experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp
index 1f5af8ec6c..aa11a2fa40 100644
--- a/experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp
+++ b/experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp
@@ -81,7 +81,7 @@ void Simplify4x4QuadraticsThreaded_Test(int& testsRun)
for (int a = 0; a < 16; ++a) {
for (int b = a ; b < 16; ++b) {
for (int c = b ; c < 16; ++c) {
- for (int d = c; d < 16; ++d) {
+ for (int d = c; d < 16; ++d) {
testsRun += dispatchTest4(testSimplify4x4QuadraticsMain,
a, b, c, d);
}
diff --git a/experimental/Intersection/EdgeWalkerRectangles_Test.cpp b/experimental/Intersection/EdgeWalkerRectangles_Test.cpp
index a5448e31b6..f721aa9820 100644
--- a/experimental/Intersection/EdgeWalkerRectangles_Test.cpp
+++ b/experimental/Intersection/EdgeWalkerRectangles_Test.cpp
@@ -64,7 +64,7 @@ static void testSimplifyMulti() {
if (out != expected) {
SkDebugf("%s expected equal\n", __FUNCTION__);
}
-
+
path = out;
path.addRect(30, 10, 40, 20);
path.addRect(10, 30, 20, 40);
@@ -76,7 +76,7 @@ static void testSimplifyMulti() {
if (rect != SkRect::MakeLTRB(10, 10, 40, 40)) {
SkDebugf("%s expected union\n", __FUNCTION__);
}
-
+
path = out;
path.addRect(10, 10, 40, 40, SkPath::kCCW_Direction);
simplify(path, true, out);
@@ -205,7 +205,7 @@ static void testSimplifyDiagonal() {
}
}
if (boundsPtr != bounds) {
- SkASSERT((bounds[0] == rect1 || bounds[1] == rect1)
+ SkASSERT((bounds[0] == rect1 || bounds[1] == rect1)
&& (bounds[0] == rect2 || bounds[1] == rect2));
} else {
SkASSERT(segments == 8);
@@ -228,7 +228,7 @@ static void assertOneContour(const SkPath& out, bool edge, bool extend) {
case SkPath::kMove_Verb:
SkASSERT(count == 0);
break;
- case SkPath::kLine_Verb:
+ case SkPath::kLine_Verb:
SkASSERT(pts[0].fX == pts[1].fX || pts[0].fY == pts[1].fY);
++count;
break;
@@ -264,21 +264,21 @@ static void testSimplifyCoincident() {
path.addRect(rect2, static_cast<SkPath::Direction>(inDir));
simplify(path, true, out);
assertOneContour(out, edge, extend);
-
+
path.reset();
rect1 = SkRect::MakeLTRB(start[startIndex], 40, stop[stopIndex], 50);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
path.addRect(rect2, static_cast<SkPath::Direction>(inDir));
simplify(path, true, out);
assertOneContour(out, edge, extend);
-
+
path.reset();
rect1 = SkRect::MakeLTRB(0, start[startIndex], 10, stop[stopIndex]);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
path.addRect(rect2, static_cast<SkPath::Direction>(inDir));
simplify(path, true, out);
assertOneContour(out, edge, extend);
-
+
path.reset();
rect1 = SkRect::MakeLTRB(40, start[startIndex], 50, stop[stopIndex]);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
@@ -362,7 +362,7 @@ static void testSimplifyDegenerate() {
if (rect != rect2) {
SkDebugf("%s 1 expected union\n", __FUNCTION__);
}
-
+
path.reset();
rect1 = SkRect::MakeLTRB(start[startIndex], 40, stop[stopIndex], 40);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
@@ -374,7 +374,7 @@ static void testSimplifyDegenerate() {
if (rect != rect2) {
SkDebugf("%s 2 expected union\n", __FUNCTION__);
}
-
+
path.reset();
rect1 = SkRect::MakeLTRB(0, start[startIndex], 0, stop[stopIndex]);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
@@ -386,7 +386,7 @@ static void testSimplifyDegenerate() {
if (rect != rect2) {
SkDebugf("%s 3 expected union\n", __FUNCTION__);
}
-
+
path.reset();
rect1 = SkRect::MakeLTRB(40, start[startIndex], 40, stop[stopIndex]);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
@@ -430,10 +430,10 @@ static void (*simplifyTests[])() = {
testSimplifyCoincident,
testSimplifyCoincidentCW,
testSimplifyCoincidentCCW,
- testSimplifyCoincidentVertical,
+ testSimplifyCoincidentVertical,
testSimplifyCoincidentHorizontal,
- testSimplifyAddL,
- testSimplifyMulti,
+ testSimplifyAddL,
+ testSimplifyMulti,
};
static size_t simplifyTestsCount = sizeof(simplifyTests) / sizeof(simplifyTests[0]);
diff --git a/experimental/Intersection/EdgeWalker_Test.h b/experimental/Intersection/EdgeWalker_Test.h
index d0ae3a5dc2..2a7d5d1979 100644
--- a/experimental/Intersection/EdgeWalker_Test.h
+++ b/experimental/Intersection/EdgeWalker_Test.h
@@ -37,7 +37,7 @@ struct State4 {
int d; // sometimes 1 if abc_is_a_triangle
int testsRun;
char filename[256];
-
+
SkCanvas* canvas;
SkBitmap bitmap;
};
diff --git a/experimental/Intersection/IntersectionUtilities.cpp b/experimental/Intersection/IntersectionUtilities.cpp
index 63a5767866..7321fef49b 100644
--- a/experimental/Intersection/IntersectionUtilities.cpp
+++ b/experimental/Intersection/IntersectionUtilities.cpp
@@ -28,13 +28,13 @@
// to subtract another 52 from it.
exponent -= 1075;
- if (mantissa == 0)
+ if (mantissa == 0)
{
return "0";
}
/* Normalize */
- while((mantissa & 1) == 0)
+ while((mantissa & 1) == 0)
{ /* i.e., Mantissa is even */
mantissa >>= 1;
exponent++;
diff --git a/experimental/Intersection/IntersectionUtilities.h b/experimental/Intersection/IntersectionUtilities.h
index 3dfd3114a4..6ed7f96695 100644
--- a/experimental/Intersection/IntersectionUtilities.h
+++ b/experimental/Intersection/IntersectionUtilities.h
@@ -14,7 +14,7 @@ inline int sideBit(double x) {
/* Given the set [0, 1, 2, 3], and two of the four members, compute an XOR mask
that computes the other two. Note that:
-
+
one ^ two == 3 for (0, 3), (1, 2)
one ^ two < 3 for (0, 1), (0, 2), (1, 3), (2, 3)
3 - (one ^ two) is either 0, 1, or 2
diff --git a/experimental/Intersection/Intersection_Tests.cpp b/experimental/Intersection/Intersection_Tests.cpp
index bf28ccbd2e..100e32c9db 100644
--- a/experimental/Intersection/Intersection_Tests.cpp
+++ b/experimental/Intersection/Intersection_Tests.cpp
@@ -24,7 +24,7 @@ void Intersection_Tests() {
QuadraticBezierClip_Test();
QuadraticIntersection_Test();
SimplifyAddIntersectingTs_Test();
-
+
cubecode_test(1);
convert_testx();
// tests are in dependency / complexity order
diff --git a/experimental/Intersection/Intersections.h b/experimental/Intersection/Intersections.h
index 47c413ac7b..879b54e1f5 100644
--- a/experimental/Intersection/Intersections.h
+++ b/experimental/Intersection/Intersections.h
@@ -36,7 +36,7 @@ public:
void swap() {
fSwap ^= 1;
}
-
+
bool swapped() {
return fSwap;
}
diff --git a/experimental/Intersection/LineCubicIntersection.cpp b/experimental/Intersection/LineCubicIntersection.cpp
index aaee2a1d38..a210fb3603 100644
--- a/experimental/Intersection/LineCubicIntersection.cpp
+++ b/experimental/Intersection/LineCubicIntersection.cpp
@@ -19,12 +19,12 @@ Then using Mathematica, solve for the values of t where the cubic intersects the
line:
(in) Resultant[
- a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - x,
+ a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - x,
e*(1 - t)^3 + 3*f*(1 - t)^2*t + 3*g*(1 - t)*t^2 + h*t^3 - i*x - j, x]
(out) -e + j +
3 e t - 3 f t -
3 e t^2 + 6 f t^2 - 3 g t^2 +
- e t^3 - 3 f t^3 + 3 g t^3 - h t^3 +
+ e t^3 - 3 f t^3 + 3 g t^3 - h t^3 +
i ( a -
3 a t + 3 b t +
3 a t^2 - 6 b t^2 + 3 c t^2 -
@@ -33,14 +33,14 @@ line:
if i goes to infinity, we can rewrite the line in terms of x. Mathematica:
(in) Resultant[
- a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - i*y - j,
+ a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - i*y - j,
e*(1 - t)^3 + 3*f*(1 - t)^2*t + 3*g*(1 - t)*t^2 + h*t^3 - y, y]
- (out) a - j -
- 3 a t + 3 b t +
+ (out) a - j -
+ 3 a t + 3 b t +
3 a t^2 - 6 b t^2 + 3 c t^2 -
- a t^3 + 3 b t^3 - 3 c t^3 + d t^3 -
- i ( e -
- 3 e t + 3 f t +
+ a t^3 + 3 b t^3 - 3 c t^3 + d t^3 -
+ i ( e -
+ 3 e t + 3 f t +
3 e t^2 - 6 f t^2 + 3 g t^2 -
e t^3 + 3 f t^3 - 3 g t^3 + h t^3 )
@@ -58,13 +58,13 @@ The near-vertical case, in terms of: Ax^3 + Bx^2 + Cx + D == 0
B = 3*( ( a - 2*b + c ) - i*( e - 2*f + g ) )
C = 3*( (-a + b ) - i*(-e + f ) )
D = ( ( a ) - i*( e ) - j )
-
+
For horizontal lines:
(in) Resultant[
- a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - j,
+ a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - j,
e*(1 - t)^3 + 3*f*(1 - t)^2*t + 3*g*(1 - t)*t^2 + h*t^3 - y, y]
(out) e - j -
- 3 e t + 3 f t +
+ 3 e t + 3 f t +
3 e t^2 - 6 f t^2 + 3 g t^2 -
e t^3 + 3 f t^3 - 3 g t^3 + h t^3
So the cubic coefficients are:
diff --git a/experimental/Intersection/LineIntersection.cpp b/experimental/Intersection/LineIntersection.cpp
index 3efa240d83..6271edcefe 100644
--- a/experimental/Intersection/LineIntersection.cpp
+++ b/experimental/Intersection/LineIntersection.cpp
@@ -15,7 +15,7 @@ int intersect(const _Line& a, const _Line& b, double aRange[2], double bRange[2]
double ayLen = a[1].y - a[0].y;
double bxLen = b[1].x - b[0].x;
double byLen = b[1].y - b[0].y;
- /* Slopes match when denom goes to zero:
+ /* Slopes match when denom goes to zero:
axLen / ayLen == bxLen / byLen
(ayLen * byLen) * axLen / ayLen == (ayLen * byLen) * bxLen / byLen
byLen * axLen == ayLen * bxLen
@@ -309,11 +309,11 @@ int verticalIntersect(const _Line& line, double top, double bottom,
// from http://www.bryceboe.com/wordpress/wp-content/uploads/2006/10/intersect.py
// 4 subs, 2 muls, 1 cmp
static bool ccw(const _Point& A, const _Point& B, const _Point& C) {
- return (C.y - A.y) * (B.x - A.x) > (B.y - A.y) * (C.x - A.x);
+ return (C.y - A.y) * (B.x - A.x) > (B.y - A.y) * (C.x - A.x);
}
// 16 subs, 8 muls, 6 cmps
bool testIntersect(const _Line& a, const _Line& b) {
- return ccw(a[0], b[0], b[1]) != ccw(a[1], b[0], b[1])
+ return ccw(a[0], b[0], b[1]) != ccw(a[1], b[0], b[1])
&& ccw(a[0], a[1], b[0]) != ccw(a[0], a[1], b[1]);
}
diff --git a/experimental/Intersection/LineIntersection_Test.cpp b/experimental/Intersection/LineIntersection_Test.cpp
index c73c9b3f7c..935a168f06 100644
--- a/experimental/Intersection/LineIntersection_Test.cpp
+++ b/experimental/Intersection/LineIntersection_Test.cpp
@@ -9,7 +9,7 @@ const _Line tests[][2] = {
{{{0, 1}, {0, 1}}, {{0, 0}, {0, 2}}},
{{{0, 0}, {1, 0}}, {{0, 0}, {2, 0}}},
{{{1, 1}, {2, 2}}, {{0, 0}, {3, 3}}},
- {{{166.86950047022856, 112.69654129527828}, {166.86948801592692, 112.69655741235339}},
+ {{{166.86950047022856, 112.69654129527828}, {166.86948801592692, 112.69655741235339}},
{{166.86960700313026, 112.6965477747386}, {166.86925794355412, 112.69656471103423}}}
};
diff --git a/experimental/Intersection/LineParameterization.cpp b/experimental/Intersection/LineParameterization.cpp
index 8bf8acd8ff..83d973e6ac 100644
--- a/experimental/Intersection/LineParameterization.cpp
+++ b/experimental/Intersection/LineParameterization.cpp
@@ -8,7 +8,7 @@ bool implicit_matches(const _Line& one, const _Line& two) {
_Point oneD, twoD;
tangent(one, oneD);
tangent(two, twoD);
- /* See if the slopes match, i.e.
+ /* See if the slopes match, i.e.
dx1 / dy1 == dx2 / dy2
(dy1 * dy2) * dx1 / dy1 == (dy1 * dy2) * dx2 / dy2
dy2 * dx1 == dy1 * dx2
@@ -32,7 +32,7 @@ bool implicit_matches_ulps(const _Line& one, const _Line& two, int ulps) {
_Point oneD, twoD;
tangent(one, oneD);
tangent(two, twoD);
- /* See if the slopes match, i.e.
+ /* See if the slopes match, i.e.
dx1 / dy1 == dx2 / dy2
(dy1 * dy2) * dx1 / dy1 == (dy1 * dy2) * dx2 / dy2
dy2 * dx1 == dy1 * dx2
diff --git a/experimental/Intersection/LineParameters.h b/experimental/Intersection/LineParameters.h
index 202ba46c4c..582ca471b9 100644
--- a/experimental/Intersection/LineParameters.h
+++ b/experimental/Intersection/LineParameters.h
@@ -20,19 +20,19 @@ public:
b = pts[3].x - pts[0].x;
c = pts[0].x * pts[3].y - pts[3].x * pts[0].y;
}
-
+
void cubicEndPoints(const Cubic& pts, int s, int e) {
a = pts[s].y - pts[e].y;
b = pts[e].x - pts[s].x;
c = pts[s].x * pts[e].y - pts[e].x * pts[s].y;
}
-
+
void lineEndPoints(const _Line& pts) {
a = pts[0].y - pts[1].y;
b = pts[1].x - pts[0].x;
c = pts[0].x * pts[1].y - pts[1].x * pts[0].y;
}
-
+
void quadEndPoints(const Quadratic& pts) {
a = pts[0].y - pts[2].y;
b = pts[2].x - pts[0].x;
@@ -61,7 +61,7 @@ public:
c *= reciprocal;
return true;
}
-
+
void cubicDistanceY(const Cubic& pts, Cubic& distance) {
double oneThird = 1 / 3.0;
for (int index = 0; index < 4; ++index) {
@@ -83,16 +83,16 @@ public:
distance[index] = a * pts[index + 1].x + b * pts[index + 1].y + c;
}
}
-
+
void controlPtDistance(const Cubic& pts, int i, int j, double distance[2]) {
distance[0] = a * pts[i].x + b * pts[i].y + c;
distance[1] = a * pts[j].x + b * pts[j].y + c;
}
-
+
double controlPtDistance(const Quadratic& pts) {
return a * pts[1].x + b * pts[1].y + c;
}
-
+
double pointDistance(const _Point& pt) {
return a * pt.x + b * pt.y + c;
}
diff --git a/experimental/Intersection/LineParameteters_Test.cpp b/experimental/Intersection/LineParameteters_Test.cpp
index f806250bd1..92e8001c55 100644
--- a/experimental/Intersection/LineParameteters_Test.cpp
+++ b/experimental/Intersection/LineParameteters_Test.cpp
@@ -13,7 +13,7 @@ const Cubic tests[] = {
{{0, .002}, {1, 0}, {2, 0}, {3, 0}},
{{0, .0002}, {1, 0}, {2, 0}, {3, 0}},
{{0, .00002}, {1, 0}, {2, 0}, {3, 0}},
- {{0, PointEpsilon * 2}, {1, 0}, {2, 0}, {3, 0}},
+ {{0, PointEpsilon * 2}, {1, 0}, {2, 0}, {3, 0}},
};
const double answers[][2] = {
@@ -60,7 +60,7 @@ void LineParameter_Test() {
double normalizedDistance[2];
lineParameters.controlPtDistance(cubic, normalizedDistance);
for (inner = 0; inner < 2; ++inner) {
- if (approximately_equal(fabs(normalizedDistance[inner]),
+ if (approximately_equal(fabs(normalizedDistance[inner]),
answers[index][inner])) {
continue;
}
diff --git a/experimental/Intersection/LineQuadraticIntersection.cpp b/experimental/Intersection/LineQuadraticIntersection.cpp
index c3e6d23e52..f269b71d22 100644
--- a/experimental/Intersection/LineQuadraticIntersection.cpp
+++ b/experimental/Intersection/LineQuadraticIntersection.cpp
@@ -3,13 +3,13 @@
#include "LineUtilities.h"
#include "QuadraticUtilities.h"
-/*
+/*
Find the interection of a line and quadratic by solving for valid t values.
From http://stackoverflow.com/questions/1853637/how-to-find-the-mathematical-function-defining-a-bezier-curve
-"A Bezier curve is a parametric function. A quadratic Bezier curve (i.e. three
-control points) can be expressed as: F(t) = A(1 - t)^2 + B(1 - t)t + Ct^2 where
+"A Bezier curve is a parametric function. A quadratic Bezier curve (i.e. three
+control points) can be expressed as: F(t) = A(1 - t)^2 + B(1 - t)t + Ct^2 where
A, B and C are points and t goes from zero to one.
This will give you two equations:
@@ -17,7 +17,7 @@ This will give you two equations:
x = a(1 - t)^2 + b(1 - t)t + ct^2
y = d(1 - t)^2 + e(1 - t)t + ft^2
-If you add for instance the line equation (y = kx + m) to that, you'll end up
+If you add for instance the line equation (y = kx + m) to that, you'll end up
with three equations and three unknowns (x, y and t)."
Similar to above, the quadratic is represented as
@@ -29,24 +29,24 @@ and the line as
Using Mathematica, solve for the values of t where the quadratic intersects the
line:
- (in) t1 = Resultant[a*(1 - t)^2 + 2*b*(1 - t)*t + c*t^2 - x,
+ (in) t1 = Resultant[a*(1 - t)^2 + 2*b*(1 - t)*t + c*t^2 - x,
d*(1 - t)^2 + 2*e*(1 - t)*t + f*t^2 - g*x - h, x]
- (out) -d + h + 2 d t - 2 e t - d t^2 + 2 e t^2 - f t^2 +
+ (out) -d + h + 2 d t - 2 e t - d t^2 + 2 e t^2 - f t^2 +
g (a - 2 a t + 2 b t + a t^2 - 2 b t^2 + c t^2)
(in) Solve[t1 == 0, t]
(out) {
{t -> (-2 d + 2 e + 2 a g - 2 b g -
- Sqrt[(2 d - 2 e - 2 a g + 2 b g)^2 -
+ Sqrt[(2 d - 2 e - 2 a g + 2 b g)^2 -
4 (-d + 2 e - f + a g - 2 b g + c g) (-d + a g + h)]) /
(2 (-d + 2 e - f + a g - 2 b g + c g))
},
{t -> (-2 d + 2 e + 2 a g - 2 b g +
- Sqrt[(2 d - 2 e - 2 a g + 2 b g)^2 -
+ Sqrt[(2 d - 2 e - 2 a g + 2 b g)^2 -
4 (-d + 2 e - f + a g - 2 b g + c g) (-d + a g + h)]) /
(2 (-d + 2 e - f + a g - 2 b g + c g))
}
}
-
+
Using the results above (when the line tends towards horizontal)
A = (-(d - 2*e + f) + g*(a - 2*b + c) )
B = 2*( (d - e ) - g*(a - b ) )
@@ -57,19 +57,19 @@ If g goes to infinity, we can rewrite the line in terms of x.
And solve accordingly in Mathematica:
- (in) t2 = Resultant[a*(1 - t)^2 + 2*b*(1 - t)*t + c*t^2 - g'*y - h',
+ (in) t2 = Resultant[a*(1 - t)^2 + 2*b*(1 - t)*t + c*t^2 - g'*y - h',
d*(1 - t)^2 + 2*e*(1 - t)*t + f*t^2 - y, y]
- (out) a - h' - 2 a t + 2 b t + a t^2 - 2 b t^2 + c t^2 -
+ (out) a - h' - 2 a t + 2 b t + a t^2 - 2 b t^2 + c t^2 -
g' (d - 2 d t + 2 e t + d t^2 - 2 e t^2 + f t^2)
(in) Solve[t2 == 0, t]
(out) {
{t -> (2 a - 2 b - 2 d g' + 2 e g' -
- Sqrt[(-2 a + 2 b + 2 d g' - 2 e g')^2 -
+ Sqrt[(-2 a + 2 b + 2 d g' - 2 e g')^2 -
4 (a - 2 b + c - d g' + 2 e g' - f g') (a - d g' - h')]) /
(2 (a - 2 b + c - d g' + 2 e g' - f g'))
},
{t -> (2 a - 2 b - 2 d g' + 2 e g' +
- Sqrt[(-2 a + 2 b + 2 d g' - 2 e g')^2 -
+ Sqrt[(-2 a + 2 b + 2 d g' - 2 e g')^2 -
4 (a - 2 b + c - d g' + 2 e g' - f g') (a - d g' - h')])/
(2 (a - 2 b + c - d g' + 2 e g' - f g'))
}
@@ -80,7 +80,7 @@ Thus, if the slope of the line tends towards vertical, we use:
B = 2*(-(a - b ) + g'*(d - e ) )
C = ( (a ) - g'*(d ) - h' )
*/
-
+
class LineQuadraticIntersections : public Intersections {
public:
@@ -156,7 +156,7 @@ int verticalIntersect(double axisIntercept) {
}
protected:
-
+
double findLineT(double t) {
const double* qPtr;
const double* lPtr;
diff --git a/experimental/Intersection/LineQuadraticIntersection_Test.cpp b/experimental/Intersection/LineQuadraticIntersection_Test.cpp
index e641fdcb20..2bb8c6c364 100644
--- a/experimental/Intersection/LineQuadraticIntersection_Test.cpp
+++ b/experimental/Intersection/LineQuadraticIntersection_Test.cpp
@@ -15,7 +15,7 @@ struct lineQuad {
{{{1, 1}, {2, 1}, {0, 2}}, {{0, 0}, {1, 1}}, 1, {{1, 1} }},
{{{0, 0}, {1, 1}, {3, 1}}, {{0, 0}, {3, 1}}, 2, {{0, 0}, {3, 1}}},
{{{2, 0}, {1, 1}, {2, 2}}, {{0, 0}, {0, 2}}, 0 },
- {{{4, 0}, {0, 1}, {4, 2}}, {{3, 1}, {4, 1}}, 0, },
+ {{{4, 0}, {0, 1}, {4, 2}}, {{3, 1}, {4, 1}}, 0, },
{{{0, 0}, {0, 1}, {1, 1}}, {{0, 1}, {1, 0}}, 1, {{.25, .75} }},
};
@@ -100,7 +100,7 @@ void LineQuadraticIntersection_Test() {
}
}
-static void testLineIntersect(State4& state, const Quadratic& quad, const _Line& line,
+static void testLineIntersect(State4& state, const Quadratic& quad, const _Line& line,
const double x, const double y) {
char pathStr[1024];
bzero(pathStr, sizeof(pathStr));
@@ -109,7 +109,7 @@ static void testLineIntersect(State4& state, const Quadratic& quad, const _Line&
str += sprintf(str, " path.quadTo(%1.9g, %1.9g, %1.9g, %1.9g);\n", quad[1].x, quad[1].y, quad[2].x, quad[2].y);
str += sprintf(str, " path.moveTo(%1.9g, %1.9g);\n", line[0].x, line[0].y);
str += sprintf(str, " path.lineTo(%1.9g, %1.9g);\n", line[1].x, line[1].y);
-
+
Intersections intersections;
bool flipped = false;
int result = doIntersect(intersections, quad, line, flipped);
diff --git a/experimental/Intersection/LineUtilities.cpp b/experimental/Intersection/LineUtilities.cpp
index 8a1c0d7c62..32ea54d733 100644
--- a/experimental/Intersection/LineUtilities.cpp
+++ b/experimental/Intersection/LineUtilities.cpp
@@ -31,7 +31,7 @@ void sub_divide(const _Line& line, double t1, double t2, _Line& dst) {
dst[1].y = line[0].y - t2 * delta.y;
}
-// may have this below somewhere else already:
+// may have this below somewhere else already:
// copying here because I thought it was clever
// Copyright 2001, softSurfer (www.softsurfer.com)
@@ -86,15 +86,15 @@ void x_at(const _Point& p1, const _Point& p2, double top, double bottom,
int flags, double& minX, double& maxX) {
if (approximately_equal(p1.y, p2.y)) {
// It should be OK to bail early in this case. There's another edge
- // which shares this end point which can intersect without failing to
+ // which shares this end point which can intersect without failing to
// have a slope ... maybe
return;
}
-
+
// p2.x is always greater than p1.x -- the part of points (p1, p2) are
// moving from the start of the cubic towards its end.
// if p1.y < p2.y, minX can be affected
- // if p1.y > p2.y, maxX can be affected
+ // if p1.y > p2.y, maxX can be affected
double slope = (p2.x - p1.x) / (p2.y - p1.y);
int topFlags = flags & (kFindTopMin | kFindTopMax);
if (topFlags && (top <= p1.y && top >= p2.y
diff --git a/experimental/Intersection/QuadraticBezierClip.cpp b/experimental/Intersection/QuadraticBezierClip.cpp
index e27db7c7eb..ce6efad4c7 100644
--- a/experimental/Intersection/QuadraticBezierClip.cpp
+++ b/experimental/Intersection/QuadraticBezierClip.cpp
@@ -10,7 +10,7 @@ bool bezier_clip(const Quadratic& q1, const Quadratic& q2, double& minT, double&
maxT = 0;
// determine normalized implicit line equation for pt[0] to pt[3]
// of the form ax + by + c = 0, where a*a + b*b == 1
-
+
// find the implicit line equation parameters
LineParameters endLine;
endLine.quadEndPoints(q1);
@@ -20,18 +20,18 @@ bool bezier_clip(const Quadratic& q1, const Quadratic& q2, double& minT, double&
}
double distance = endLine.controlPtDistance(q1);
-
+
// find fat line
double top = 0;
double bottom = distance / 2; // http://students.cs.byu.edu/~tom/557/text/cic.pdf (7.6)
if (top > bottom) {
std::swap(top, bottom);
}
-
+
// compute intersecting candidate distance
Quadratic distance2y; // points with X of (0, 1/2, 1)
endLine.quadDistanceY(q2, distance2y);
-
+
int flags = 0;
if (approximately_lesser(distance2y[0].y, top)) {
flags |= kFindTopMin;
@@ -57,6 +57,6 @@ bool bezier_clip(const Quadratic& q1, const Quadratic& q2, double& minT, double&
}
x_at(distance2y[idx], distance2y[next], top, bottom, flags, minT, maxT);
idx = next;
- } while (idx);
+ } while (idx);
return minT < maxT; // returns false if distance shows no intersection
}
diff --git a/experimental/Intersection/QuadraticIntersection.cpp b/experimental/Intersection/QuadraticIntersection.cpp
index a8e87ef6ea..60672757c1 100644
--- a/experimental/Intersection/QuadraticIntersection.cpp
+++ b/experimental/Intersection/QuadraticIntersection.cpp
@@ -6,11 +6,11 @@
class QuadraticIntersections : public Intersections {
public:
-QuadraticIntersections(const Quadratic& q1, const Quadratic& q2, Intersections& i)
+QuadraticIntersections(const Quadratic& q1, const Quadratic& q2, Intersections& i)
: quad1(q1)
, quad2(q2)
, intersections(i)
- , depth(0)
+ , depth(0)
, splits(0) {
}
@@ -37,10 +37,10 @@ bool intersect() {
}
protected:
-
+
bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
Quadratic smaller, larger;
- // FIXME: carry last subdivide and reduceOrder result with quad
+ // FIXME: carry last subdivide and reduceOrder result with quad
sub_divide(quad1, minT1, maxT1, intersections.swapped() ? larger : smaller);
sub_divide(quad2, minT2, maxT2, intersections.swapped() ? smaller : larger);
Quadratic smallResult;
@@ -55,11 +55,11 @@ bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
return false;
}
if (intersections.swapped()) {
- smallT[0] = interp(minT2, maxT2, smallT[0]);
- largeT[0] = interp(minT1, maxT1, largeT[0]);
+ smallT[0] = interp(minT2, maxT2, smallT[0]);
+ largeT[0] = interp(minT1, maxT1, largeT[0]);
} else {
- smallT[0] = interp(minT1, maxT1, smallT[0]);
- largeT[0] = interp(minT2, maxT2, largeT[0]);
+ smallT[0] = interp(minT1, maxT1, smallT[0]);
+ largeT[0] = interp(minT2, maxT2, largeT[0]);
}
intersections.add(smallT[0], largeT[0]);
return true;
@@ -80,7 +80,7 @@ bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
}
return false;
}
-
+
int split;
if (intersections.swapped()) {
double newMinT1 = interp(minT1, maxT1, minT);
@@ -210,11 +210,11 @@ sqrt(x + iy) = sqrt((r + x) / 2) +/- i*sqrt((r - x) / 2)
where the sign of the imaginary part of the root is taken to be same as the sign
of the imaginary part of the original number, and
-
+
r = abs(x + iy) = sqrt(x^2 + y^2)
-is the absolute value or modulus of the original number. The real part of the
+is the absolute value or modulus of the original number. The real part of the
principal value is always non-negative.
-The other square root is simply –1 times the principal square root; in other
+The other square root is simply –1 times the principal square root; in other
words, the two square roots of a number sum to 0.
*/
diff --git a/experimental/Intersection/QuadraticParameterization.cpp b/experimental/Intersection/QuadraticParameterization.cpp
index fb45b17ebb..675b1976f6 100644
--- a/experimental/Intersection/QuadraticParameterization.cpp
+++ b/experimental/Intersection/QuadraticParameterization.cpp
@@ -3,7 +3,7 @@
/* from http://tom.cs.byu.edu/~tom/papers/cvgip84.pdf 4.1
*
- * This paper proves that Syvester's method can compute the implicit form of
+ * This paper proves that Syvester's method can compute the implicit form of
* the quadratic from the parameterized form.
*
* Given x = a*t*t + b*t + c (the parameterized form)
diff --git a/experimental/Intersection/QuadraticParameterization_Test.cpp b/experimental/Intersection/QuadraticParameterization_Test.cpp
index e355140b47..793b796d9e 100644
--- a/experimental/Intersection/QuadraticParameterization_Test.cpp
+++ b/experimental/Intersection/QuadraticParameterization_Test.cpp
@@ -27,7 +27,7 @@ void QuadraticCoincidence_Test() {
for (size_t two = 0; two < quadsCount; ++two) {
for (size_t inner = 0; inner < 3; inner += 2) {
if (!point_on_parameterized_curve(*quads[one], (*quads[two])[inner])) {
- printf("%s %zu [%zu,%zu] %zu parameterization failed\n",
+ printf("%s %zu [%zu,%zu] %zu parameterization failed\n",
__FUNCTION__, index, one, two, inner);
}
}
diff --git a/experimental/Intersection/QuadraticReduceOrder.cpp b/experimental/Intersection/QuadraticReduceOrder.cpp
index 7429f6edaf..5d614f1f79 100644
--- a/experimental/Intersection/QuadraticReduceOrder.cpp
+++ b/experimental/Intersection/QuadraticReduceOrder.cpp
@@ -118,7 +118,7 @@ bool isLinear(const Quadratic& quad, int startIndex, int endIndex) {
// reduce to a quadratic or smaller
// look for identical points
-// look for all four points in a line
+// look for all four points in a line
// note that three points in a line doesn't simplify a cubic
// look for approximation with single quadratic
// save approximation with multiple quadratics for later
diff --git a/experimental/Intersection/QuadraticSubDivide.cpp b/experimental/Intersection/QuadraticSubDivide.cpp
index 7c3164ec99..9aee1dfa1a 100644
--- a/experimental/Intersection/QuadraticSubDivide.cpp
+++ b/experimental/Intersection/QuadraticSubDivide.cpp
@@ -18,7 +18,7 @@ _12 = A/2 + B/2
12_ = B/2 + C/2
123 = A/4 + B/2 + C/4
= D
-
+
Group the known values on one side:
B = D*2 - A/2 - C/2
diff --git a/experimental/Intersection/QuadraticUtilities.cpp b/experimental/Intersection/QuadraticUtilities.cpp
index 88524ca9d7..d42f1e232b 100644
--- a/experimental/Intersection/QuadraticUtilities.cpp
+++ b/experimental/Intersection/QuadraticUtilities.cpp
@@ -11,7 +11,7 @@ and using the roots
t1 = Q / A
t2 = C / Q
-
+
*/
int quadraticRoots(double A, double B, double C, double t[2]) {
diff --git a/experimental/Intersection/Simplify.cpp b/experimental/Intersection/Simplify.cpp
index 9606589fe1..5a026c89a8 100644
--- a/experimental/Intersection/Simplify.cpp
+++ b/experimental/Intersection/Simplify.cpp
@@ -486,7 +486,7 @@ public:
}
return dx * rdy < rdx * dy;
}
-
+
double dx() const {
return fDx;
}
@@ -575,15 +575,15 @@ public:
}
SkASSERT(0); // FIXME: add cubic case
}
-
+
Segment* segment() const {
return const_cast<Segment*>(fSegment);
}
-
+
int sign() const {
return SkSign32(fStart - fEnd);
}
-
+
int start() const {
return fStart;
}
@@ -745,7 +745,7 @@ public:
int oIndex = span->fOtherIndex;
return other->activeAngleInner(oIndex, done, angles);
}
-
+
bool activeAngleInner(int index, int& done, SkTDArray<Angle>& angles) const {
int next = nextSpan(index, 1);
if (next > 0) {
@@ -828,7 +828,7 @@ public:
// fTs[tIndexStart - 1], fTs[tIndexStart], fTs[tIndex]
// if tIndexStart == 0, no prior span
// if nextT == 1, no following span
-
+
// advance the span with zero winding
// if the following span exists (not past the end, non-zero winding)
// connect the two edges
@@ -873,7 +873,7 @@ public:
}
}
}
-
+
void addCoinOutsides(const SkTDArray<double>& outsideTs, Segment& other,
double oEnd) {
// walk this to outsideTs[0]
@@ -910,7 +910,7 @@ public:
addTPair(tStart, other, oStart, false);
} while (tStart < 1 && oStart < 1 && oEnd - oStart >= FLT_EPSILON);
}
-
+
void addCubic(const SkPoint pts[4]) {
init(pts, SkPath::kCubic_Verb);
fBounds.setCubicBounds(pts);
@@ -976,7 +976,7 @@ public:
init(pts, SkPath::kQuad_Verb);
fBounds.setQuadBounds(pts);
}
-
+
// Defer all coincident edge processing until
// after normal intersections have been computed
@@ -1022,7 +1022,7 @@ public:
span->fWindValue = 1;
if ((span->fDone = newT == 1)) {
++fDoneSpans;
- }
+ }
return insertedAt;
}
@@ -1083,7 +1083,7 @@ public:
break;
}
oSpan = &other.fTs[--oIndex];
- }
+ }
test = span;
oTest = oSpan;
} while (test->fT < endT - FLT_EPSILON);
@@ -1197,7 +1197,7 @@ public:
other.addCoinOutsides(oOutsideTs, *this, endT);
}
}
-
+
// FIXME: this doesn't prevent the same span from being added twice
// fix in caller, assert here?
void addTPair(double t, Segment& other, double otherT, bool borrowWind) {
@@ -1226,7 +1226,7 @@ public:
matchWindingValue(insertedAt, t, borrowWind);
other.matchWindingValue(otherInsertedAt, otherT, borrowWind);
}
-
+
void addTwoAngles(int start, int end, SkTDArray<Angle>& angles) const {
// add edge leading into junction
if (fTs[SkMin32(end, start)].fWindValue > 0) {
@@ -1239,7 +1239,7 @@ public:
addAngle(angles, end, tIndex);
}
}
-
+
const Bounds& bounds() const {
return fBounds;
}
@@ -1292,7 +1292,7 @@ public:
SkASSERT(0); // incomplete
return false;
}
-
+
int computeSum(int startIndex, int endIndex) {
SkTDArray<Angle> angles;
addTwoAngles(startIndex, endIndex, angles);
@@ -1300,7 +1300,7 @@ public:
SkTDArray<Angle*> sorted;
sortAngles(angles, sorted);
#if DEBUG_SORT
- sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
+ sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
#endif
int angleCount = angles.count();
const Angle* angle;
@@ -1365,7 +1365,7 @@ public:
continue;
}
SkPoint edge[4];
- // OPTIMIZE: wrap this so that if start==0 end==fTCount-1 we can
+ // OPTIMIZE: wrap this so that if start==0 end==fTCount-1 we can
// work with the original data directly
double startT = fTs[start].fT;
double endT = fTs[end].fT;
@@ -1428,7 +1428,7 @@ public:
}
return false;
}
-
+
bool decrementSpan(Span* span) {
SkASSERT(span->fWindValue > 0);
if (--(span->fWindValue) == 0) {
@@ -1460,7 +1460,7 @@ public:
// reference an unused other
// for coincident, the last span on the other may be marked done
// (always?)
-
+
// if loop is exhausted, contour may be closed.
// FIXME: pass in close point so we can check for closure
@@ -1469,7 +1469,7 @@ public:
// segments, find the mate that continues the outside.
// note that if there are multiples, but no coincidence, we can limit
// choices to connections in the correct direction
-
+
// mark found segments as done
// start is the index of the beginning T of this edge
@@ -1539,7 +1539,7 @@ public:
// FIXME: found done logic probably fails if there are more than 4
// sorted angles. It should bias towards the first and last undone
// edges -- but not sure that it won't choose a middle (incorrect)
- // edge if one is undone
+ // edge if one is undone
bool foundDone = false;
bool foundDone2 = false;
// iterate through the angle, and compute everyone's winding
@@ -1651,7 +1651,7 @@ public:
#endif
return nextSegment;
}
-
+
Segment* findNextXor(int& nextStart, int& nextEnd) {
const int startIndex = nextStart;
const int endIndex = nextEnd;
@@ -1923,7 +1923,7 @@ public:
SkTDArray<Angle*> sorted;
sortAngles(angles, sorted);
#if DEBUG_SORT
- sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
+ sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
#endif
// skip edges that have already been processed
firstT = -1;
@@ -1936,7 +1936,7 @@ public:
} while (leftSegment->fTs[SkMin32(tIndex, endIndex)].fDone);
return leftSegment;
}
-
+
// FIXME: not crazy about this
// when the intersections are performed, the other index is into an
// incomplete array. as the array grows, the indices become incorrect
@@ -1959,7 +1959,7 @@ public:
}
}
}
-
+
// OPTIMIZATION: uses tail recursion. Unwise?
Span* innerChaseDone(int index, int step, int winding) {
int end = nextSpan(index, step);
@@ -1975,7 +1975,7 @@ public:
other->markDone(SkMin32(index, otherEnd), winding);
return last;
}
-
+
Span* innerChaseWinding(int index, int step, int winding) {
int end = nextSpan(index, step);
SkASSERT(end >= 0);
@@ -1995,7 +1995,7 @@ public:
other->markWinding(min, winding);
return last;
}
-
+
void init(const SkPoint pts[], SkPath::Verb verb) {
fPts = pts;
fVerb = verb;
@@ -2065,7 +2065,7 @@ public:
SkScalar leftMost(int start, int end) const {
return (*SegmentLeftMost[fVerb])(fPts, fTs[start].fT, fTs[end].fT);
}
-
+
// this span is excluded by the winding rule -- chase the ends
// as long as they are unambiguous to mark connections as done
// and give them the same winding value
@@ -2077,7 +2077,7 @@ public:
markDone(SkMin32(index, endIndex), winding);
return last;
}
-
+
Span* markAndChaseWinding(const Angle* angle, int winding) {
int index = angle->start();
int endIndex = angle->end();
@@ -2087,11 +2087,11 @@ public:
markWinding(min, winding);
return last;
}
-
+
// FIXME: this should also mark spans with equal (x,y)
// This may be called when the segment is already marked done. While this
// wastes time, it shouldn't do any more than spin through the T spans.
- // OPTIMIZATION: abort on first done found (assuming that this code is
+ // OPTIMIZATION: abort on first done found (assuming that this code is
// always called to mark segments done).
void markDone(int index, int winding) {
// SkASSERT(!done());
@@ -2105,7 +2105,7 @@ public:
markOneDone(__FUNCTION__, index, winding);
} while (++index < fTs.count() && fTs[index].fT - referenceT < FLT_EPSILON);
}
-
+
void markOneDone(const char* funName, int tIndex, int winding) {
Span* span = markOneWinding(funName, tIndex, winding);
if (!span) {
@@ -2114,7 +2114,7 @@ public:
span->fDone = true;
fDoneSpans++;
}
-
+
Span* markOneWinding(const char* funName, int tIndex, int winding) {
Span& span = fTs[tIndex];
if (span.fDone) {
@@ -2216,7 +2216,7 @@ public:
const Span& span(int tIndex) const {
return fTs[tIndex];
}
-
+
int spanSign(int startIndex, int endIndex) const {
int result = startIndex < endIndex ? -fTs[startIndex].fWindValue :
fTs[endIndex].fWindValue;
@@ -2235,7 +2235,7 @@ public:
double t(int tIndex) const {
return fTs[tIndex].fT;
}
-
+
static void TrackOutside(SkTDArray<double>& outsideTs, double end,
double start) {
int outCount = outsideTs.count();
@@ -2244,7 +2244,7 @@ public:
*outsideTs.append() = start;
}
}
-
+
void undoneSpan(int& start, int& end) {
size_t tCount = fTs.count();
size_t index;
@@ -2273,7 +2273,7 @@ public:
int windSum(int tIndex) const {
return fTs[tIndex].fWindSum;
}
-
+
int windSum(const Angle* angle) const {
int start = angle->start();
int end = angle->end();
@@ -2284,7 +2284,7 @@ public:
int windValue(int tIndex) const {
return fTs[tIndex].fWindValue;
}
-
+
int windValue(const Angle* angle) const {
int start = angle->start();
int end = angle->end();
@@ -2312,7 +2312,7 @@ public:
}
return span->fPt;
}
-
+
SkScalar yAtT(int index) const {
return yAtT(&fTs[index]);
}
@@ -2402,7 +2402,7 @@ public:
SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY);
}
const Span* span = &fTs[i];
- SkDebugf(") t=%1.9g (%1.9g,%1.9g)", fTs[i].fT,
+ SkDebugf(") t=%1.9g (%1.9g,%1.9g)", fTs[i].fT,
xAtT(span), yAtT(span));
const Segment* other = fTs[i].fOther;
SkDebugf(" other=%d otherT=%1.9g otherIndex=%d windSum=",
@@ -2562,7 +2562,7 @@ public:
fSegments.push_back().addLine(pts);
return fSegments.count();
}
-
+
void addOtherT(int segIndex, int tIndex, double otherT, int otherIndex) {
fSegments[segIndex].addOtherT(tIndex, otherT, otherIndex);
}
@@ -2581,7 +2581,7 @@ public:
const Bounds& bounds() const {
return fBounds;
}
-
+
void complete() {
setBounds();
fContainsIntercepts = false;
@@ -2591,7 +2591,7 @@ public:
fContainsIntercepts = true;
}
- const Segment* crossedSegment(const SkPoint& basePt, SkScalar& bestY,
+ const Segment* crossedSegment(const SkPoint& basePt, SkScalar& bestY,
int &tIndex, double& hitT) {
int segmentCount = fSegments.count();
const Segment* bestSegment = NULL;
@@ -2631,7 +2631,7 @@ public:
}
return bestSegment;
}
-
+
bool crosses(const Contour* crosser) const {
for (int index = 0; index < fCrosses.count(); ++index) {
if (fCrosses[index] == crosser) {
@@ -2715,14 +2715,14 @@ public:
#endif
}
}
-
+
const SkTArray<Segment>& segments() {
return fSegments;
}
-
+
// OPTIMIZATION: feel pretty uneasy about this. It seems like once again
// we need to sort and walk edges in y, but that on the surface opens the
- // same can of worms as before. But then, this is a rough sort based on
+ // same can of worms as before. But then, this is a rough sort based on
// segments' top, and not a true sort, so it could be ameniable to regular
// sorting instead of linear searching. Still feel like I'm missing something
Segment* topSegment(SkScalar& bestY) {
@@ -2905,13 +2905,13 @@ void walk() {
}
break;
case SkPath::kQuad_Verb:
-
+
reducedVerb = QuadReduceOrder(&pointsPtr[-1], fReducePts);
if (reducedVerb == 0) {
break; // skip degenerate points
}
if (reducedVerb == 1) {
- *fExtra.append() =
+ *fExtra.append() =
fCurrentContour->addLine(fReducePts.end() - 2);
break;
}
@@ -2995,7 +2995,7 @@ public:
kQuad_Segment = SkPath::kQuad_Verb,
kCubic_Segment = SkPath::kCubic_Verb,
};
-
+
void addCoincident(Work& other, const Intersections& ts, bool swap) {
fContour->addCoincident(fIndex, other.fContour, other.fIndex, ts, swap);
}
@@ -3026,7 +3026,7 @@ public:
const Bounds& bounds() const {
return fContour->segments()[fIndex].bounds();
}
-
+
const SkPoint* cubic() const {
return fCubic;
}
@@ -3036,7 +3036,7 @@ public:
fIndex = 0;
fLast = contour->segments().count();
}
-
+
bool isAdjacent(const Work& next) {
return fContour == next.fContour && fIndex + 1 == next.fIndex;
}
@@ -3431,13 +3431,13 @@ static int innerContourCheck(SkTDArray<Contour*>& contourList,
}
test->buildAngles(tIndex, angles);
SkTDArray<Angle*> sorted;
- // OPTIMIZATION: call a sort that, if base point is the leftmost,
+ // OPTIMIZATION: call a sort that, if base point is the leftmost,
// returns the first counterclockwise hour before 6 o'clock,
- // or if the base point is rightmost, returns the first clockwise
+ // or if the base point is rightmost, returns the first clockwise
// hour after 6 o'clock
sortAngles(angles, sorted);
#if DEBUG_SORT
- sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
+ sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
#endif
// walk the sorted angle fan to find the lowest angle
// above the base point. Currently, the first angle in the sorted array
@@ -3517,10 +3517,10 @@ static int innerContourCheck(SkTDArray<Contour*>& contourList,
// we're broken because we find a vertical span
return winding;
}
-
+
// OPTIMIZATION: not crazy about linear search here to find top active y.
// seems like we should break down and do the sort, or maybe sort each
-// contours' segments?
+// contours' segments?
// Once the segment array is built, there's no reason I can think of not to
// sort it in Y. hmmm
// FIXME: return the contour found to pass to inner contour check
@@ -3590,7 +3590,7 @@ static Segment* findChase(SkTDArray<Span*>& chase, int& tIndex, int& endIndex,
SkTDArray<Angle*> sorted;
sortAngles(angles, sorted);
#if DEBUG_SORT
- sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
+ sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
#endif
// find first angle, initialize winding to computed fWindSum
int firstIndex = -1;
@@ -3611,7 +3611,7 @@ static Segment* findChase(SkTDArray<Span*>& chase, int& tIndex, int& endIndex,
winding += spanWinding;
}
#if DEBUG_SORT
- segment->debugShowSort(__FUNCTION__, sorted, firstIndex, winding);
+ segment->debugShowSort(__FUNCTION__, sorted, firstIndex, winding);
#endif
// we care about first sign and whether wind sum indicates this
// edge is inside or outside. Maybe need to pass span winding
@@ -3679,7 +3679,7 @@ static bool windingIsActive(int winding, int spanWinding) {
// when winding should follow the intersection direction. If more than one edge
// is an option, choose first edge that continues the inside.
// since we start with leftmost top edge, we'll traverse through a
- // smaller angle counterclockwise to get to the next edge.
+ // smaller angle counterclockwise to get to the next edge.
static void bridgeWinding(SkTDArray<Contour*>& contourList, SkPath& simple) {
bool firstContour = true;
do {
@@ -3713,7 +3713,7 @@ static void bridgeWinding(SkTDArray<Contour*>& contourList, SkPath& simple) {
}
#if DEBUG_WINDING
SkDebugf("%s sumWinding=%d spanWinding=%d sign=%d inner=%d result=%d\n", __FUNCTION__,
- sumWinding, spanWinding, SkSign32(index - endIndex),
+ sumWinding, spanWinding, SkSign32(index - endIndex),
inner, contourWinding);
#endif
}
@@ -3730,7 +3730,7 @@ static void bridgeWinding(SkTDArray<Contour*>& contourList, SkPath& simple) {
// the initial winding should be correctly passed in so that if the
// inner contour is wound the same way, it never finds an accumulated
// winding of zero. Inside 'find next', we need to look for transitions
- // other than zero when resolving sorted angles.
+ // other than zero when resolving sorted angles.
bool active = windingIsActive(winding, spanWinding);
SkTDArray<Span*> chaseArray;
do {
@@ -3826,7 +3826,7 @@ static void bridgeXor(SkTDArray<Contour*>& contourList, SkPath& simple) {
#endif
simple.close();
}
- }
+ }
}
static void fixOtherTIndex(SkTDArray<Contour*>& contourList) {
diff --git a/experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp b/experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp
index f70d2f8916..ce85041f88 100644
--- a/experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp
+++ b/experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp
@@ -92,17 +92,17 @@ static void testPath(const SkPath& path, const SkPoint* pts1, SkPath::Verb c1Typ
// bool c2Intersected = c2.fSegments[0].intersected();
SkDebugf("%s %s (%1.9g,%1.9g %1.9g,%1.9g) %s %s (%1.9g,%1.9g %1.9g,%1.9g)\n",
__FUNCTION__, SimplifyAddIntersectingTsTest::kLVerbStr[c1Type],
- pts1[0].fX, pts1[0].fY,
+ pts1[0].fX, pts1[0].fY,
pts1[c1Type].fX, pts1[c1Type].fY,
c1Intersected ? "intersects" : "does not intersect",
SimplifyAddIntersectingTsTest::kLVerbStr[c2Type],
- pts2[0].fX, pts2[0].fY,
+ pts2[0].fX, pts2[0].fY,
pts2[c2Type].fX, pts2[c2Type].fY);
if (c1Intersected) {
c1.dump();
c2.dump();
}
-#endif
+#endif
}
static const size_t firstO = 6;
diff --git a/experimental/Intersection/SimplifyFindNext_Test.cpp b/experimental/Intersection/SimplifyFindNext_Test.cpp
index 7d33c11a6b..199ba1d6f0 100644
--- a/experimental/Intersection/SimplifyFindNext_Test.cpp
+++ b/experimental/Intersection/SimplifyFindNext_Test.cpp
@@ -4,9 +4,9 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#define DEBUG_TEST 1
-
+
#include "Simplify.h"
namespace SimplifyFindNextTest {
diff --git a/experimental/Intersection/SimplifyNew_Test.cpp b/experimental/Intersection/SimplifyNew_Test.cpp
index 8d6bb509c9..c862c27e1f 100644
--- a/experimental/Intersection/SimplifyNew_Test.cpp
+++ b/experimental/Intersection/SimplifyNew_Test.cpp
@@ -505,7 +505,7 @@ static void testLine18x() {
static void testLine19() {
SkPath path;
path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
- path.addRect(12, 16, 21, 21, (SkPath::Direction) 0);
+ path.addRect(12, 16, 21, 21, (SkPath::Direction) 0);
testSimplifyx(path);
}
diff --git a/experimental/Intersection/SimplifyRect4x4_Test.cpp b/experimental/Intersection/SimplifyRect4x4_Test.cpp
index 3768da988d..cdd43dd346 100644
--- a/experimental/Intersection/SimplifyRect4x4_Test.cpp
+++ b/experimental/Intersection/SimplifyRect4x4_Test.cpp
@@ -52,14 +52,14 @@ static void* testSimplify4x4RectsMain(void* data)
break;
case 2:
l = aXAlign * 12;
- r = l + 30;
+ r = l + 30;
t = 0; b = 60;
aYAlign = 5;
break;
case 3:
l = 0; r = 60;
t = aYAlign * 12;
- b = l + 30;
+ b = l + 30;
aXAlign = 5;
break;
}
@@ -74,20 +74,20 @@ static void* testSimplify4x4RectsMain(void* data)
switch (bShape) {
case 1: // square
l = bXAlign * 10;
- r = l + 20;
+ r = l + 20;
t = bYAlign * 10;
- b = l + 20;
+ b = l + 20;
break;
case 2:
l = bXAlign * 10;
- r = l + 20;
+ r = l + 20;
t = 10; b = 40;
bYAlign = 5;
break;
case 3:
l = 10; r = 40;
t = bYAlign * 10;
- b = l + 20;
+ b = l + 20;
bXAlign = 5;
break;
}
@@ -102,20 +102,20 @@ static void* testSimplify4x4RectsMain(void* data)
switch (cShape) {
case 1: // square
l = cXAlign * 6;
- r = l + 12;
+ r = l + 12;
t = cYAlign * 6;
- b = l + 12;
+ b = l + 12;
break;
case 2:
l = cXAlign * 6;
- r = l + 12;
+ r = l + 12;
t = 20; b = 30;
cYAlign = 5;
break;
case 3:
l = 20; r = 30;
t = cYAlign * 6;
- b = l + 20;
+ b = l + 20;
cXAlign = 5;
break;
}
@@ -130,20 +130,20 @@ static void* testSimplify4x4RectsMain(void* data)
switch (dShape) {
case 1: // square
l = dXAlign * 4;
- r = l + 9;
+ r = l + 9;
t = dYAlign * 4;
- b = l + 9;
+ b = l + 9;
break;
case 2:
l = dXAlign * 6;
- r = l + 9;
+ r = l + 9;
t = 32; b = 36;
dYAlign = 5;
break;
case 3:
l = 32; r = 36;
t = dYAlign * 6;
- b = l + 9;
+ b = l + 9;
dXAlign = 5;
break;
}
@@ -186,7 +186,7 @@ void Simplify4x4RectsThreaded_Test(int& testsRun)
for (int a = 0; a < 8; ++a) { // outermost
for (int b = a ; b < 8; ++b) {
for (int c = b ; c < 8; ++c) {
- for (int d = c; d < 8; ++d) {
+ for (int d = c; d < 8; ++d) {
testsRun += dispatchTest4(testSimplify4x4RectsMain, a, b, c, d);
}
if (!gRunTestsInOneThread) SkDebugf(".");
diff --git a/experimental/Intersection/SkAntiEdge.cpp b/experimental/Intersection/SkAntiEdge.cpp
index 7e225884bb..5aa134c926 100644
--- a/experimental/Intersection/SkAntiEdge.cpp
+++ b/experimental/Intersection/SkAntiEdge.cpp
@@ -41,7 +41,7 @@ bool SkAntiEdge::setLine(const SkPoint& p0, const SkPoint& p1) {
fLastY = SkScalarToFixed(p1.fY);
if (fFirstY == fLastY) {
return false;
- }
+ }
fFirstX = SkScalarToFixed(p0.fX);
fLastX = SkScalarToFixed(p1.fX);
if (fFirstY > fLastY) {
@@ -190,7 +190,7 @@ uint16_t SkAntiEdge::advanceX(SkFixed left) {
SkFixed yDiff = wy - fY;
SkAssertResult(yDiff >= 0);
SkAssertResult(yDiff <= SK_Fixed1);
- int xCoverage = xDiff >> 1; // throw away 1 bit so multiply
+ int xCoverage = xDiff >> 1; // throw away 1 bit so multiply
int yCoverage = yDiff >> 1; // stays in range
int triangle = xCoverage * yCoverage >> 15;
coverage = partial - 1 - triangle;
@@ -271,7 +271,7 @@ uint16_t SkAntiEdge::advanceFlippedX(SkFixed left) {
SkFixed yDiff = fY - wy;
SkAssertResult(yDiff >= 0);
SkAssertResult(yDiff <= SK_Fixed1);
- int xCoverage = xDiff >> 1; // throw away 1 bit so multiply
+ int xCoverage = xDiff >> 1; // throw away 1 bit so multiply
int yCoverage = yDiff >> 1; // stays in range
int triangle = xCoverage * yCoverage >> 15;
coverage = partial - 1 - triangle;
@@ -384,7 +384,7 @@ extern "C" {
valuea = edgea->fFirstX;
valueb = edgeb->fFirstX;
}
-
+
if (valuea == valueb) {
valuea = edgea->fDX;
valueb = edgeb->fDX;
@@ -666,7 +666,7 @@ void SkAntiEdgeBuilder::walk(uint8_t* result, int rowBytes, int height) {
}
uint8_t old = *resultPtr;
uint8_t pix = coverage_to_8(coverage);
- uint8_t blend = old > pix ? old : pix;
+ uint8_t blend = old > pix ? old : pix;
*resultPtr++ = blend;
++x;
} while (!finished);
diff --git a/experimental/Networking/SampleNetPipeReader.cpp b/experimental/Networking/SampleNetPipeReader.cpp
index f58d5c2164..4332cbd287 100644
--- a/experimental/Networking/SampleNetPipeReader.cpp
+++ b/experimental/Networking/SampleNetPipeReader.cpp
@@ -14,7 +14,7 @@
* received all the data transmitted and attempt to reproduce the drawing calls.
* This reader will only keep the latest batch of data. In order to keep up with
* the server, which may be producing data at a much higher rate than the reader
- * is consuming, the reader will attempt multiple reads and only render the
+ * is consuming, the reader will attempt multiple reads and only render the
* latest frame. this behavior can be adjusted by changing MAX_READS_PER_FRAME
* or disabled by setting fSync to false
*/
@@ -23,11 +23,11 @@
class NetPipeReaderView : public SampleView {
public:
- NetPipeReaderView() {
+ NetPipeReaderView() {
fSocket = NULL;
fSync = true;
}
-
+
~NetPipeReaderView() {
if (fSocket) {
delete fSocket;
@@ -36,23 +36,23 @@ public:
}
virtual void requestMenu(SkOSMenu* menu) {
menu->setTitle("Net Pipe Reader");
- menu->appendTextField("Server IP", "Server IP", this->getSinkID(),
+ menu->appendTextField("Server IP", "Server IP", this->getSinkID(),
"IP address");
menu->appendSwitch("Sync", "Sync", this->getSinkID(), fSync);
}
-
+
protected:
static void readData(int cid, const void* data, size_t size,
SkSocket::DataType type, void* context) {
NetPipeReaderView* view = (NetPipeReaderView*)context;
view->onRead(data, size);
}
-
+
void onRead(const void* data, size_t size) {
if (size > 0)
fDataArray.append(size, (const char*)data);
}
-
+
bool onQuery(SkEvent* evt) {
if (SampleCode::TitleQ(*evt)) {
SampleCode::TitleR(evt, "Net Pipe Reader");
@@ -76,7 +76,7 @@ protected:
return true;
return this->INHERITED::onEvent(evt);
}
-
+
void onDrawContent(SkCanvas* canvas) {
if (NULL == fSocket)
return;
@@ -85,7 +85,7 @@ protected:
int dataToRemove = fDataArray.count();
if (fSync) {
int numreads = 0;
- while (fSocket->readPacket(readData, this) > 0 &&
+ while (fSocket->readPacket(readData, this) > 0 &&
numreads < MAX_READS_PER_FRAME) {
// at this point, new data has been read and stored, discard
// old data since it's not needed anymore
@@ -95,18 +95,18 @@ protected:
++numreads;
}
// clean up if max reads reached
- if (numreads == MAX_READS_PER_FRAME &&
+ if (numreads == MAX_READS_PER_FRAME &&
fDataArray.count() > dataToRemove)
fDataArray.remove(0, dataToRemove);
}
else {
- if (fSocket->readPacket(readData, this) > 0)
+ if (fSocket->readPacket(readData, this) > 0)
fDataArray.remove(0, dataToRemove);
}
}
else
fSocket->connectToServer();
-
+
SkGPipeReader reader(canvas);
size_t bytesRead;
SkGPipeReader::Status fStatus = reader.playback(fDataArray.begin(),
diff --git a/experimental/Networking/SkSockets.cpp b/experimental/Networking/SkSockets.cpp
index 7b7d6fcff7..db9da09d4d 100644
--- a/experimental/Networking/SkSockets.cpp
+++ b/experimental/Networking/SkSockets.cpp
@@ -33,7 +33,7 @@ int SkSocket::createSocket() {
return -1;
}
int reuse = 1;
-
+
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(int)) < 0) {
SkDebugf("error: %s\n", strerror(errno));
return -1;
@@ -49,10 +49,10 @@ int SkSocket::createSocket() {
void SkSocket::closeSocket(int sockfd) {
if (!fReady)
return;
-
+
close(sockfd);
//SkDebugf("Closed fd:%d\n", sockfd);
-
+
if (FD_ISSET(sockfd, &fMasterSet)) {
FD_CLR(sockfd, &fMasterSet);
if (sockfd >= fMaxfd) {
@@ -60,7 +60,7 @@ void SkSocket::closeSocket(int sockfd) {
fMaxfd -= 1;
}
}
- if (0 == fMaxfd)
+ if (0 == fMaxfd)
fConnected = false;
}
@@ -70,7 +70,7 @@ void SkSocket::onFailedConnection(int sockfd) {
void SkSocket::setNonBlocking(int sockfd) {
int flags = fcntl(sockfd, F_GETFL);
- fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
+ fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
}
void SkSocket::addToMasterSet(int sockfd) {
@@ -79,9 +79,9 @@ void SkSocket::addToMasterSet(int sockfd) {
fMaxfd = sockfd;
}
-int SkSocket::readPacket(void (*onRead)(int, const void*, size_t, DataType,
+int SkSocket::readPacket(void (*onRead)(int, const void*, size_t, DataType,
void*), void* context) {
- if (!fConnected || !fReady || NULL == onRead || NULL == context
+ if (!fConnected || !fReady || NULL == onRead || NULL == context
|| fReadSuspended)
return -1;
@@ -91,7 +91,7 @@ int SkSocket::readPacket(void (*onRead)(int, const void*, size_t, DataType,
for (int i = 0; i <= fMaxfd; ++i) {
if (!FD_ISSET (i, &fMasterSet))
continue;
-
+
memset(packet, 0, PACKET_SIZE);
SkDynamicMemoryWStream stream;
int attempts = 0;
@@ -155,13 +155,13 @@ int SkSocket::readPacket(void (*onRead)(int, const void*, size_t, DataType,
this->onFailedConnection(i);
continue;
}
-
+
if (bytesReadInTransfer > 0) {
SkData* data = stream.copyToData();
SkASSERT(data->size() == bytesReadInTransfer);
onRead(i, data->data(), data->size(), h.type, context);
data->unref();
-
+
totalBytesRead += bytesReadInTransfer;
}
}
@@ -312,7 +312,7 @@ int SkTCPServer::disconnectAll() {
SkTCPClient::SkTCPClient(const char* hostname, int port) {
//Add fSockfd since the client will be using it to read/write
this->addToMasterSet(fSockfd);
-
+
hostent* server = gethostbyname(hostname);
if (server) {
fServerAddr.sin_family = AF_INET;
diff --git a/experimental/Networking/SkSockets.h b/experimental/Networking/SkSockets.h
index a72f67d3a9..8d85446ecc 100644
--- a/experimental/Networking/SkSockets.h
+++ b/experimental/Networking/SkSockets.h
@@ -32,14 +32,14 @@ public:
kIncomplete_state,
kDone_state
};
-
+
enum DataType {
kPipeAppend_type,
kPipeReplace_type,
kString_type,
kInt_type
};
-
+
bool isConnected() { return fConnected; }
/**
* Write data to the socket. Data is a pointer to the beginning of the data
@@ -51,12 +51,12 @@ public:
* was an error during the transfer, in which case the method returns -1.
* For blocking sockets, write will block indefinitely if the socket at the
* other end of the connection doesn't receive any data.
- * NOTE: This method guarantees that all of the data will be sent unless
- * there was an error, so it may block temporarily when the write buffer is
+ * NOTE: This method guarantees that all of the data will be sent unless
+ * there was an error, so it may block temporarily when the write buffer is
* full
*/
int writePacket(void* data, size_t size, DataType type = kPipeAppend_type);
-
+
/**
* Read a logical packet from socket. The data read will be stored
* sequentially in the dataArray. This method will keep running until all
@@ -66,16 +66,16 @@ public:
* nonblocking sockets, read will return 0 if there's nothing to read. For
* blocking sockets, read will block indefinitely if the socket doesn't
* receive any data.
- * NOTE: This method guarantees that all the data in a logical packet will
+ * NOTE: This method guarantees that all the data in a logical packet will
* be read so it may block temporarily if it's waiting for parts of a
* packet
*/
- int readPacket(void (*onRead)(int cid, const void* data, size_t size,
+ int readPacket(void (*onRead)(int cid, const void* data, size_t size,
DataType type, void*), void* context);
/**
* Suspend network transfers until resume() is called. Leaves all
- * connections in tact.
+ * connections in tact.
*/
void suspendAll() { fReadSuspended = fWriteSuspended = true; }
/**
@@ -101,7 +101,7 @@ protected:
* Create a socket and return its file descriptor. Returns -1 on failure
*/
int createSocket();
-
+
/**
* Close the socket specified by the socket file descriptor argument. Will
* update fMaxfd and working set properly
@@ -119,7 +119,7 @@ protected:
* Set the socket specified by the socket file descriptor as nonblocking
*/
void setNonBlocking(int sockfd);
-
+
/**
* Add the socket specified by the socket file descriptor to the master
* file descriptor set, which is used to in the select() to detect new data
@@ -134,10 +134,10 @@ protected:
int fMaxfd;
int fPort;
int fSockfd;
-
- /**
+
+ /**
* fMasterSet contains all the file descriptors to be used for read/write.
- * For clients, this only contains the client socket. For servers, this
+ * For clients, this only contains the client socket. For servers, this
* contains all the file descriptors associated with established connections
* to clients
*/
@@ -156,7 +156,7 @@ public:
/**
* Accept any incoming connections to the server, will accept 1 connection
- * at a time. Returns -1 on error. For blocking sockets, this method will
+ * at a time. Returns -1 on error. For blocking sockets, this method will
* block until a client calls connectToServer()
*/
int acceptConnections();
@@ -179,15 +179,15 @@ public:
SkTCPClient(const char* hostname, int port = DEFAULT_PORT);
/**
- * Connect to server. Returns -1 on error or failure. Call this to connect
- * or reconnect to the server. For blocking sockets, this method will block
+ * Connect to server. Returns -1 on error or failure. Call this to connect
+ * or reconnect to the server. For blocking sockets, this method will block
* until the connection is accepted by the server.
*/
int connectToServer();
protected:
/**
- * Client needs to recreate the socket when a connection is broken because
- * connect can only be called successfully once.
+ * Client needs to recreate the socket when a connection is broken because
+ * connect can only be called successfully once.
*/
virtual void onFailedConnection(int sockfd);
private:
diff --git a/experimental/SkSetPoly3To3.cpp b/experimental/SkSetPoly3To3.cpp
index d27e7b1179..cf94eb5f54 100644
--- a/experimental/SkSetPoly3To3.cpp
+++ b/experimental/SkSetPoly3To3.cpp
@@ -33,9 +33,9 @@ static SkScalar dot(SkScalar ax, SkScalar ay, SkScalar bx, SkScalar by) {
bool SkSetPoly3To3(SkMatrix* matrix, const SkPoint src[3], const SkPoint dst[3]) {
const SkPoint& srcAve = src[0];
const SkPoint& dstAve = dst[0];
-
+
SkScalar srcOP[4], dstOP[4];
-
+
computeOuterProduct(srcOP, src, srcAve, src, srcAve);
computeOuterProduct(dstOP, src, srcAve, dst, dstAve);
@@ -45,11 +45,11 @@ bool SkSetPoly3To3(SkMatrix* matrix, const SkPoint src[3], const SkPoint dst[3])
if (SkScalarNearlyZero(det)) {
return false;
}
-
+
SkScalar invDet = SkScalarInvert(det);
-
+
// now compute invDet * [srcOP]T * [dstOP]
-
+
// scale and transpose
const SkScalar srcOP0 = SkScalarMul( srcOP[3], invDet);
const SkScalar srcOP1 = SkScalarMul(-srcOP[1], invDet);
diff --git a/experimental/SkSetPoly3To3_A.cpp b/experimental/SkSetPoly3To3_A.cpp
index 3825073416..c85814568c 100644
--- a/experimental/SkSetPoly3To3_A.cpp
+++ b/experimental/SkSetPoly3To3_A.cpp
@@ -65,9 +65,9 @@ static SkScalar dot(SkScalar ax, SkScalar ay, SkScalar bx, SkScalar by) {
bool SkSetPoly3To3_A(SkMatrix* matrix, const SkPoint src[3], const SkPoint dst[3]) {
const SkPoint& srcAve = src[0];
const SkPoint& dstAve = dst[0];
-
+
SkScalar srcOP[4], dstOP[4];
-
+
computeOuterProduct(srcOP, src, srcAve, src, srcAve);
computeOuterProduct(dstOP, src, srcAve, dst, dstAve);
@@ -75,17 +75,17 @@ bool SkSetPoly3To3_A(SkMatrix* matrix, const SkPoint src[3], const SkPoint dst[3
SkDScalar_setMul(srcOP[1], srcOP[2]);
SkDScalar M[4];
-
+
const SkScalar srcOP0 = srcOP[3];
const SkScalar srcOP1 = -srcOP[1];
const SkScalar srcOP2 = -srcOP[2];
const SkScalar srcOP3 = srcOP[0];
-
+
M[0] = ddot(srcOP0, srcOP1, dstOP[0], dstOP[2]);
M[1] = ddot(srcOP2, srcOP3, dstOP[0], dstOP[2]);
M[2] = ddot(srcOP0, srcOP1, dstOP[1], dstOP[3]);
M[3] = ddot(srcOP2, srcOP3, dstOP[1], dstOP[3]);
-
+
matrix->reset();
matrix->setScaleX(divide(M[0], det));
matrix->setSkewX( divide(M[1], det));
diff --git a/experimental/SkSetPoly3To3_D.cpp b/experimental/SkSetPoly3To3_D.cpp
index 630f578774..283b4e5144 100644
--- a/experimental/SkSetPoly3To3_D.cpp
+++ b/experimental/SkSetPoly3To3_D.cpp
@@ -28,7 +28,7 @@ static void computeOuterProduct(SkMatrix* matrix,
const SkPoint pts1[3], const SkPoint& ave1) {
SkDScalar tmp[4];
sk_bzero(tmp, sizeof(tmp));
-
+
for (int i = 0; i < 3; i++) {
SkScalar x0 = pts0[i].fX - ave0.fX;
SkScalar y0 = pts0[i].fY - ave0.fY;
@@ -54,9 +54,9 @@ static SkScalar dot(SkScalar ax, SkScalar ay, SkScalar bx, SkScalar by) {
bool SkSetPoly3To3_D(SkMatrix* matrix, const SkPoint src[3], const SkPoint dst[3]) {
const SkPoint& srcAve = src[0];
const SkPoint& dstAve = dst[0];
-
+
SkMatrix srcOP, dstOP;
-
+
computeOuterProduct(&srcOP, src, srcAve, src, srcAve);
if (!srcOP.invert(&srcOP)) {
diff --git a/experimental/iOSSampleApp/Shared/SkOptionListController.h b/experimental/iOSSampleApp/Shared/SkOptionListController.h
index 480579af1f..87c044bfe2 100644
--- a/experimental/iOSSampleApp/Shared/SkOptionListController.h
+++ b/experimental/iOSSampleApp/Shared/SkOptionListController.h
@@ -1,6 +1,6 @@
#import <UIKit/UIKit.h>
-@interface SkOptionListController : UITableViewController {
+@interface SkOptionListController : UITableViewController {
NSMutableArray* fOptions;
NSInteger fSelectedIndex;
UITableViewCell* fSelectedCell;
diff --git a/experimental/iOSSampleApp/SkSampleUIView.h b/experimental/iOSSampleApp/SkSampleUIView.h
index 49bdc7da28..6797706636 100644
--- a/experimental/iOSSampleApp/SkSampleUIView.h
+++ b/experimental/iOSSampleApp/SkSampleUIView.h
@@ -15,7 +15,7 @@ struct FPSState;
@interface SkSampleUIView : SkUIView {
BOOL fRedrawRequestPending;
-
+
struct {
EAGLContext* fContext;
GLuint fRenderbuffer;
@@ -24,11 +24,11 @@ struct FPSState;
GLint fWidth;
GLint fHeight;
} fGL;
-
+
NSString* fTitle;
CALayer* fRasterLayer;
CAEAGLLayer* fGLLayer;
-
+
FPSState* fFPSState;
SkiOSDeviceManager* fDevManager;
}