getting points of Bezier Curve after moving that particular object
I have a curve which is drawn by using Bezier curve. Now i am moving this particular object and placing it in another location. How can i get the new points for the curve of that object.
- (void)drawRect:(CGRect)rect
{
[myPath moveToPoint:CGPointMake(100, 100)];
[myPath addLineToPoint:CGPointMake(100, 400)];
[myPath addLineToPoint:CGPointMake(400, 400)];
[myPath addLineToPoint:CGPointMake(400, 100)];
[myPath addLineToPoint:CGPointMake(100, 100)];
[myPath closePath];
[[UIColor redColor] setStroke];
[myPath strokeWithBlendMode:kCGBlendModeNormal alpha:1.开发者_运维百科0];
[self setNeedsDisplay];
}
This is my code to draw the rectangle. Now by using touches i am moving the rectangle, after moving how can i get the new points of the rectangle.In this particular case i am using a rectangle but there may be a polygon of indefinite points, in that case how can i get those points.
For a simple linear transformation you only need to apply dx
and dy
to each control point of your curve (aka add your change in x and y to all the points you defined for the curve).
精彩评论