I'm writing an iPhone application where I'd like the user to be able to push a button and be able to rotate / stretch a rectangle with regards to the red point in the picture below:
As you can see I'd like to be able to rotate around the red dot (or half way down the y axis) and would also be able to stretch the rectangle with it still being anchored to the red point (doesn't move).
I should mention that in iPhone, that anchor point is initially set to the center of the object.
I struggle badly with transformations, but was able to figure out the rotation:
self.rotateView.transform = CGAffineTransformTranslate(self.rotateView.transform, self.rotateView.bounds.size.width / 2, 0); self.rotateView.transform = CGAffineTransformRotate(self.rotateView.transform, M_PI / 180); self.rotateView.transform = CGAffineTransformTranslate(self.rotateView.transform, self.rotateView.bounds.size.width / 2, 0);
How to scale something is obvious, what I'm having trouble with is correctly translating the object before and after I scale it, and then doing all of this within the context of the rotation so that they both can work out when applied together.
Anyone might be able to point me in the right direction on how to approach this?