Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SkTCoincident Class Reference

#include <SkPathOpsTSect.h>

Public Member Functions

 SkTCoincident ()
 
void debugInit ()
 
char dumpIsCoincidentStr () const
 
void dump () const
 
bool isMatch () const
 
void init ()
 
void markCoincident ()
 
const SkDPointperpPt () const
 
double perpT () const
 
void setPerp (const SkTCurve &c1, double t, const SkDPoint &cPt, const SkTCurve &)
 

Detailed Description

Definition at line 37 of file SkPathOpsTSect.h.

Constructor & Destructor Documentation

◆ SkTCoincident()

SkTCoincident::SkTCoincident ( )
inline

Definition at line 39 of file SkPathOpsTSect.h.

39 {
40 this->init();
41 }

Member Function Documentation

◆ debugInit()

void SkTCoincident::debugInit ( )
inline

Definition at line 43 of file SkPathOpsTSect.h.

43 {
44#ifdef SK_DEBUG
45 this->fPerpPt.fX = this->fPerpPt.fY = SK_ScalarNaN;
46 this->fPerpT = SK_ScalarNaN;
47 this->fMatch = 0xFF;
48#endif
49 }
#define SK_ScalarNaN
Definition SkScalar.h:28

◆ dump()

void SkTCoincident::dump ( ) const

Definition at line 1190 of file PathOpsDebug.cpp.

1190 {
1191 SkDebugf("t=%1.9g pt=(%1.9g,%1.9g)%s\n", fPerpT, fPerpPt.fX, fPerpPt.fY,
1192 fMatch ? " match" : "");
1193}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1

◆ dumpIsCoincidentStr()

char SkTCoincident::dumpIsCoincidentStr ( ) const

Definition at line 1183 of file PathOpsDebug.cpp.

1183 {
1184 if (!!fMatch != fMatch) {
1185 return '?';
1186 }
1187 return fMatch ? '*' : 0;
1188}

◆ init()

void SkTCoincident::init ( )
inline

Definition at line 59 of file SkPathOpsTSect.h.

59 {
60 fPerpT = -1;
61 fMatch = false;
62 fPerpPt.fX = fPerpPt.fY = SK_ScalarNaN;
63 }

◆ isMatch()

bool SkTCoincident::isMatch ( ) const
inline

Definition at line 54 of file SkPathOpsTSect.h.

54 {
55 SkASSERT(!!fMatch == fMatch);
56 return SkToBool(fMatch);
57 }
#define SkASSERT(cond)
Definition SkAssert.h:116
static constexpr bool SkToBool(const T &x)
Definition SkTo.h:35

◆ markCoincident()

void SkTCoincident::markCoincident ( )
inline

Definition at line 65 of file SkPathOpsTSect.h.

65 {
66 if (!fMatch) {
67 fPerpT = -1;
68 }
69 fMatch = true;
70 }

◆ perpPt()

const SkDPoint & SkTCoincident::perpPt ( ) const
inline

Definition at line 72 of file SkPathOpsTSect.h.

72 {
73 return fPerpPt;
74 }

◆ perpT()

double SkTCoincident::perpT ( ) const
inline

Definition at line 76 of file SkPathOpsTSect.h.

76 {
77 return fPerpT;
78 }

◆ setPerp()

void SkTCoincident::setPerp ( const SkTCurve c1,
double  t,
const SkDPoint cPt,
const SkTCurve c2 
)

Definition at line 28 of file SkPathOpsTSect.cpp.

29 {
30 SkDVector dxdy = c1.dxdyAtT(t);
31 SkDLine perp = {{ cPt, {cPt.fX + dxdy.fY, cPt.fY - dxdy.fX} }};
32 SkIntersections i SkDEBUGCODE((c1.globalState()));
33 int used = i.intersectRay(c2, perp);
34 // only keep closest
35 if (used == 0 || used == 3) {
36 this->init();
37 return;
38 }
39 fPerpT = i[0][0];
40 fPerpPt = i.pt(0);
41 SkASSERT(used <= 2);
42 if (used == 2) {
43 double distSq = (fPerpPt - cPt).lengthSquared();
44 double dist2Sq = (i.pt(1) - cPt).lengthSquared();
45 if (dist2Sq < distSq) {
46 fPerpT = i[0][1];
47 fPerpPt = i.pt(1);
48 }
49 }
50#if DEBUG_T_SECT
51 SkDebugf("setPerp t=%1.9g cPt=(%1.9g,%1.9g) %s oppT=%1.9g fPerpPt=(%1.9g,%1.9g)\n",
52 t, cPt.fX, cPt.fY,
53 cPt.approximatelyEqual(fPerpPt) ? "==" : "!=", fPerpT, fPerpPt.fX, fPerpPt.fY);
54#endif
55 fMatch = cPt.approximatelyEqual(fPerpPt);
56#if DEBUG_T_SECT
57 if (fMatch) {
58 SkDebugf("%s", ""); // allow setting breakpoint
59 }
60#endif
61}
#define SkDEBUGCODE(...)
Definition SkDebug.h:23
virtual SkDVector dxdyAtT(double t) const =0
bool approximatelyEqual(const SkDPoint &a) const

The documentation for this class was generated from the following files: