Draw arrow on line

Posted by Pete on Stack Overflow See other posts from Stack Overflow or by Pete
Published on 2010-03-26T09:08:32Z Indexed on 2010/03/26 9:13 UTC
Read the original article Hit count: 180

Filed under:
|
|
|

Hi,

I have this code:

            CGPoint arrowMiddle = CGPointMake((arrowOne.x + arrowTo.x)/2, (arrowOne.y + arrowTo.y)/2);

            CGPoint arrowLeft = CGPointMake(arrowMiddle.x-40, arrowMiddle.y);
            CGPoint arrowRight = CGPointMake(arrowMiddle.x, arrowMiddle.y + 40);

            [arrowPath addLineToScreenPoint:arrowLeft];
            [arrowPath addLineToScreenPoint:arrowMiddle];
            [arrowPath addLineToScreenPoint:arrowRight];
            [[mapContents overlay] addSublayer:arrowPath];
            [arrowPath release];

with this output: http://yfrog.com/edschermafbeelding2010032p

What have i to add to get the left and right the at same degree of the line + 30°.

If someone has the algorithm of drawing an arrow on a line, pleas give it. It doesn't matter what programming language it is...

Thanks

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about iphone-sdk