Skip to content

Commit

Permalink
Previously over-simplified point finding code. Have to split the path…
Browse files Browse the repository at this point in the history
… to ensure the found point is exactly on the path.
  • Loading branch information
sprang committed Oct 26, 2013
1 parent 913f92c commit 0a20b54
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Inkpad-Core/Model/WDBezierSegment.m
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ BOOL WDBezierSegmentFindPointOnSegment_R(WDBezierSegment seg, CGPoint testPoint,
float t = WDClamp(0.0f, 1.0f, n/d);

if (nearestPoint) {
CGPoint delta = WDSubtractPoints(seg.b_, seg.a_);
*nearestPoint = WDAddPoints(seg.a_, WDMultiplyPointScalar(delta, t));
// make sure the found point is on the path and not just near it
*nearestPoint = WDBezierSegmentSplitAtT(seg, NULL, NULL, t);
}
if (split) {
*split += (t * depth);
Expand Down

0 comments on commit 0a20b54

Please sign in to comment.