1

I am drawing single line by

CAShapeLayer *lineShape = nil;
CGMutablePathRef linePath = nil;
linePath = CGPathCreateMutable();
lineShape = [CAShapeLayer layer];

lineShape.lineWidth = 1.0f;
lineShape.lineCap = kCALineJoinMiter;
lineShape.strokeColor = [[UIColor redColor] CGColor];


CGPathMoveToPoint(linePath, NULL, x, y);
CGPathAddLineToPoint(linePath, NULL, toX, toY);

lineShape.path = linePath;
CGPathRelease(linePath);

[myView.layer addSublayer:lineShape];

i want to draw a parallel line to this line . Any idea or calculation?

or is there any code for getting touch point of this particular line . actually i can get touch point when i touch between two lines and from CGPathContainsPoint method i can get touch point between two lines , hence i want to create two parallel lines here.

PJR
  • 13,052
  • 13
  • 64
  • 104

1 Answers1

0

Line geometry

enter image description here

enter image description here

b - shift. and you need convert coordinates

Volodymyr B.
  • 3,369
  • 2
  • 30
  • 48