Flutter Engine
The Flutter Engine
|
#include <GrTriangulator.h>
Public Member Functions | |
Edge (Vertex *top, Vertex *bottom, int winding, EdgeType type) | |
double | dist (const SkPoint &p) const |
bool | isRightOf (const Vertex &v) const |
bool | isLeftOf (const Vertex &v) const |
void | recompute () |
void | insertAbove (Vertex *, const Comparator &) |
void | insertBelow (Vertex *, const Comparator &) |
void | disconnect () |
bool | intersect (const Edge &other, SkPoint *p, uint8_t *alpha=nullptr) const |
Public Attributes | |
int | fWinding |
Vertex * | fTop |
Vertex * | fBottom |
EdgeType | fType |
Edge * | fLeft |
Edge * | fRight |
Edge * | fPrevEdgeAbove |
Edge * | fNextEdgeAbove |
Edge * | fPrevEdgeBelow |
Edge * | fNextEdgeBelow |
Poly * | fLeftPoly |
Poly * | fRightPoly |
Edge * | fLeftPolyPrev |
Edge * | fLeftPolyNext |
Edge * | fRightPolyPrev |
Edge * | fRightPolyNext |
bool | fUsedInLeftPoly |
bool | fUsedInRightPoly |
Line | fLine |
An Edge joins a top Vertex to a bottom Vertex. Edge ordering for the list of "edges above" and "edge below" a vertex as well as for the active edge list is handled by isLeftOf()/isRightOf(). Note that an Edge will give occasionally dist() != 0 for its own endpoints (because floating point). For speed, that case is only tested by the callers that require it (e.g., rewind_if_necessary()). Edges also handle checking for intersection with other edges. Currently, this converts the edges to the parametric form, in order to avoid doing a division until an intersection has been confirmed. This is slightly slower in the "found" case, but a lot faster in the "not found" case.
The coefficients of the line equation stored in double precision to avoid catastrophic cancellation in the isLeftOf() and isRightOf() checks. Using doubles ensures that the result is correct in float, since it's a polynomial of degree 2. The intersect() function, being degree 5, is still subject to catastrophic cancellation. We deal with that by assuming its output may be incorrect, and adjusting the mesh topology to match (see comment at the top of this file).
Definition at line 406 of file GrTriangulator.h.
void GrTriangulator::Edge::disconnect | ( | ) |
Definition at line 740 of file GrTriangulator.cpp.
|
inline |
Definition at line 448 of file GrTriangulator.h.
void GrTriangulator::Edge::insertAbove | ( | Vertex * | v, |
const Comparator & | c | ||
) |
Definition at line 688 of file GrTriangulator.cpp.
void GrTriangulator::Edge::insertBelow | ( | Vertex * | v, |
const Comparator & | c | ||
) |
Definition at line 706 of file GrTriangulator.cpp.
bool GrTriangulator::Edge::intersect | ( | const Edge & | other, |
SkPoint * | p, | ||
uint8_t * | alpha = nullptr |
||
) | const |
Definition at line 265 of file GrTriangulator.cpp.
|
inline |
Definition at line 455 of file GrTriangulator.h.
|
inline |
Definition at line 454 of file GrTriangulator.h.
|
inline |
Definition at line 456 of file GrTriangulator.h.
Vertex* GrTriangulator::Edge::fBottom |
Definition at line 430 of file GrTriangulator.h.
Edge* GrTriangulator::Edge::fLeft |
Definition at line 432 of file GrTriangulator.h.
Poly* GrTriangulator::Edge::fLeftPoly |
Definition at line 438 of file GrTriangulator.h.
Edge* GrTriangulator::Edge::fLeftPolyNext |
Definition at line 441 of file GrTriangulator.h.
Edge* GrTriangulator::Edge::fLeftPolyPrev |
Definition at line 440 of file GrTriangulator.h.
Line GrTriangulator::Edge::fLine |
Definition at line 446 of file GrTriangulator.h.
Edge* GrTriangulator::Edge::fNextEdgeAbove |
Definition at line 435 of file GrTriangulator.h.
Edge* GrTriangulator::Edge::fNextEdgeBelow |
Definition at line 437 of file GrTriangulator.h.
Edge* GrTriangulator::Edge::fPrevEdgeAbove |
Definition at line 434 of file GrTriangulator.h.
Edge* GrTriangulator::Edge::fPrevEdgeBelow |
Definition at line 436 of file GrTriangulator.h.
Edge* GrTriangulator::Edge::fRight |
Definition at line 433 of file GrTriangulator.h.
Poly* GrTriangulator::Edge::fRightPoly |
Definition at line 439 of file GrTriangulator.h.
Edge* GrTriangulator::Edge::fRightPolyNext |
Definition at line 443 of file GrTriangulator.h.
Edge* GrTriangulator::Edge::fRightPolyPrev |
Definition at line 442 of file GrTriangulator.h.
Vertex* GrTriangulator::Edge::fTop |
Definition at line 429 of file GrTriangulator.h.
EdgeType GrTriangulator::Edge::fType |
Definition at line 431 of file GrTriangulator.h.
bool GrTriangulator::Edge::fUsedInLeftPoly |
Definition at line 444 of file GrTriangulator.h.
bool GrTriangulator::Edge::fUsedInRightPoly |
Definition at line 445 of file GrTriangulator.h.
int GrTriangulator::Edge::fWinding |
Definition at line 428 of file GrTriangulator.h.