Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
OffsetEdge Struct Reference

Public Member Functions

void init (uint16_t start=0, uint16_t end=0)
 
bool checkIntersection (const OffsetEdge *that, SkPoint *p, SkScalar *s, SkScalar *t)
 
SkScalar computeCrossingDistance (const OffsetEdge *that)
 

Public Attributes

OffsetEdgefPrev
 
OffsetEdgefNext
 
OffsetSegment fOffset
 
SkPoint fIntersection
 
SkScalar fTValue
 
uint16_t fIndex
 
uint16_t fEnd
 

Detailed Description

Definition at line 252 of file SkPolyUtils.cpp.

Member Function Documentation

◆ checkIntersection()

bool OffsetEdge::checkIntersection ( const OffsetEdge that,
SkPoint p,
SkScalar s,
SkScalar t 
)
inline

Definition at line 269 of file SkPolyUtils.cpp.

270 {
271 if (this->fEnd == that->fIndex) {
272 SkPoint p1 = this->fOffset.fP0 + this->fOffset.fV;
274 *p = p1;
275 *s = SK_Scalar1;
276 *t = 0;
277 return true;
278 }
279 }
280
281 return compute_intersection(this->fOffset, that->fOffset, p, s, t);
282 }
static bool compute_intersection(const OffsetSegment &s0, const OffsetSegment &s1, SkPoint *p, SkScalar *s, SkScalar *t)
#define SK_Scalar1
Definition: SkScalar.h:18
static bool EqualsWithinTolerance(const SkPoint &p1, const SkPoint &p2)
Definition: SkPointPriv.h:54
struct MyStruct s
uint16_t fEnd
uint16_t fIndex
OffsetSegment fOffset

◆ computeCrossingDistance()

SkScalar OffsetEdge::computeCrossingDistance ( const OffsetEdge that)
inline

Definition at line 287 of file SkPolyUtils.cpp.

287 {
288 const OffsetSegment& s0 = this->fOffset;
289 const OffsetSegment& s1 = that->fOffset;
290 const SkVector& v0 = s0.fV;
291 const SkVector& v1 = s1.fV;
292
293 SkScalar denom = v0.cross(v1);
295 // segments are parallel
296 return SK_ScalarMax;
297 }
298
299 SkVector w = s1.fP0 - s0.fP0;
300 SkScalar localS = w.cross(v1) / denom;
301 if (localS < 0) {
302 localS = -localS;
303 } else {
304 localS -= SK_Scalar1;
305 }
306
307 localS *= SkScalarAbs(localS);
308 localS *= v0.dot(v0);
309
310 return localS;
311 }
constexpr SkScalar kCrossTolerance
Definition: SkPolyUtils.cpp:41
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
Definition: SkScalar.h:101
#define SK_ScalarMax
Definition: SkScalar.h:24
#define SkScalarAbs(x)
Definition: SkScalar.h:39
float SkScalar
Definition: extension.cpp:12
SkScalar w
float dot(const SkVector &vec) const
Definition: SkPoint_impl.h:554
float cross(const SkVector &vec) const
Definition: SkPoint_impl.h:545

◆ init()

void OffsetEdge::init ( uint16_t  start = 0,
uint16_t  end = 0 
)
inline

Definition at line 261 of file SkPolyUtils.cpp.

261 {
264 fIndex = start;
265 fEnd = end;
266 }
#define SK_ScalarMin
Definition: SkScalar.h:25
glong glong end
SkPoint fIntersection
SkScalar fTValue

Member Data Documentation

◆ fEnd

uint16_t OffsetEdge::fEnd

Definition at line 259 of file SkPolyUtils.cpp.

◆ fIndex

uint16_t OffsetEdge::fIndex

Definition at line 258 of file SkPolyUtils.cpp.

◆ fIntersection

SkPoint OffsetEdge::fIntersection

Definition at line 256 of file SkPolyUtils.cpp.

◆ fNext

OffsetEdge* OffsetEdge::fNext

Definition at line 254 of file SkPolyUtils.cpp.

◆ fOffset

OffsetSegment OffsetEdge::fOffset

Definition at line 255 of file SkPolyUtils.cpp.

◆ fPrev

OffsetEdge* OffsetEdge::fPrev

Definition at line 253 of file SkPolyUtils.cpp.

◆ fTValue

SkScalar OffsetEdge::fTValue

Definition at line 257 of file SkPolyUtils.cpp.


The documentation for this struct was generated from the following file: