-
Notifications
You must be signed in to change notification settings - Fork 344
Open
Description
@ericveach Do you remember what you had in mind with
This could be optimized to be at least 5x faster by pruning the set of possible closest vertex/edge pairs using the faces and (u,v) ranges of both cells.
?
Lines 508 to 526 in a538e02
| // Otherwise, the minimum distance always occurs between a vertex of one | |
| // cell and an edge of the other cell (including the edge endpoints). This | |
| // represents a total of 32 possible (vertex, edge) pairs. | |
| // | |
| // TODO(ericv): This could be optimized to be at least 5x faster by pruning | |
| // the set of possible closest vertex/edge pairs using the faces and (u,v) | |
| // ranges of both cells. | |
| S2Point va[4], vb[4]; | |
| for (int i = 0; i < 4; ++i) { | |
| va[i] = GetVertex(i); | |
| vb[i] = target.GetVertex(i); | |
| } | |
| S1ChordAngle min_dist = S1ChordAngle::Infinity(); | |
| for (int i = 0; i < 4; ++i) { | |
| for (int j = 0; j < 4; ++j) { | |
| S2::UpdateMinDistance(va[i], vb[j], vb[(j + 1) & 3], &min_dist); | |
| S2::UpdateMinDistance(vb[i], va[j], va[(j + 1) & 3], &min_dist); | |
| } | |
| } |
Metadata
Metadata
Assignees
Labels
No labels