From 9e71f7db3c487633d2ec170369d0ecc5f61280cf Mon Sep 17 00:00:00 2001 From: randomguy3 Date: Wed, 18 Jan 2012 11:37:17 +0000 Subject: Fix nomenclature - the arrow head is at the target, the tail is at the source git-svn-id: https://tikzit.svn.sourceforge.net/svnroot/tikzit/trunk@395 7c02a99a-9b00-45e3-bf44-6f3dd7fddb64 --- tikzit/src/common/Edge.m | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'tikzit/src/common/Edge.m') diff --git a/tikzit/src/common/Edge.m b/tikzit/src/common/Edge.m index d95d528..9e983d5 100644 --- a/tikzit/src/common/Edge.m +++ b/tikzit/src/common/Edge.m @@ -93,10 +93,10 @@ NSPoint intersect; [curve updateControls]; if (lineSegmentIntersectsBezier (rayStart, rayEnd, - [shapeTrans toScreen:curve->head], + [shapeTrans toScreen:curve->tail], [shapeTrans toScreen:curve->cp1], [shapeTrans toScreen:curve->cp2], - [shapeTrans toScreen:curve->tail], + [shapeTrans toScreen:curve->head], &intersect)) { // we just keep shortening the line rayStart = intersect; @@ -108,10 +108,10 @@ } - (NSPoint) _findTanFor:(NSPoint)pt usingSpanFrom:(float)t1 to:(float)t2 { - float dx = bezierInterpolate(t2, head.x, cp1.x, cp2.x, tail.x) - - bezierInterpolate(t1, head.x, cp1.x, cp2.x, tail.x); - float dy = bezierInterpolate(t2, head.y, cp1.y, cp2.y, tail.y) - - bezierInterpolate(t1, head.y, cp1.y, cp2.y, tail.y); + float dx = bezierInterpolate(t2, tail.x, cp1.x, cp2.x, head.x) - + bezierInterpolate(t1, tail.x, cp1.x, cp2.x, head.x); + float dy = bezierInterpolate(t2, tail.y, cp1.y, cp2.y, head.y) - + bezierInterpolate(t1, tail.y, cp1.y, cp2.y, head.y); // normalise float len = sqrt(dx*dx+dy*dy); @@ -151,8 +151,8 @@ angleTarg = (float)inAngle * (M_PI / 180.0f); } - head = [self _findContactPointOn:source at:angleSrc]; - tail = [self _findContactPointOn:target at:angleTarg]; + tail = [self _findContactPointOn:source at:angleSrc]; + head = [self _findContactPointOn:target at:angleTarg]; // give a default distance for self-loops float cdist = (dx==0.0f && dy==0.0f) ? weight : sqrt(dx*dx + dy*dy) * weight; @@ -163,11 +163,11 @@ cp2 = NSMakePoint(targ.x + (cdist * cos(angleTarg)), targ.y + (cdist * sin(angleTarg))); - mid = bezierInterpolateFull (0.5f, head, cp1, cp2, tail); + mid = bezierInterpolateFull (0.5f, tail, cp1, cp2, head); midTan = [self _findTanFor:mid usingSpanFrom:0.4f to:0.6f]; - headTan = [self _findTanFor:head usingSpanFrom:0.0f to:0.1f]; - tailTan = [self _findTanFor:tail usingSpanFrom:1.0f to:0.9f]; + tailTan = [self _findTanFor:tail usingSpanFrom:0.0f to:0.1f]; + headTan = [self _findTanFor:head usingSpanFrom:1.0f to:0.9f]; } dirty = NO; } -- cgit v1.2.3