1) I have a polygon shape that I want to rotate arount its own axis.
Everything works fine when the shape is located at point (0,0). But when I
place the shape somewhere else on the canvas (using SetX()/SetY()) the
centre point changes everytime I do a rotation (when I click on the shape).
I've tried using the CalculatePolygonCentre and UpdateOriginalPoints methods
(although I don't hava a clue why and when to use them). This doesn't work
either!
Am I doing something wrong or is this a bug in the Rotation method?
2) When I try to print out the polygon points using GetPoints, python
crashes!
Code is attached. Cheers.
Thomas
BTW: Tried to do this on a RectangleShape but as nothing happened, I assumed
this shape doesn't support rotation. Please tell me if I'm wrong!
1) I have a polygon shape that I want to rotate arount its own axis.
Everything works fine when the shape is located at point (0,0). But when I
place the shape somewhere else on the canvas (using SetX()/SetY()) the
centre point changes everytime I do a rotation (when I click on the shape).
I've tried using the CalculatePolygonCentre and UpdateOriginalPoints methods
(although I don't hava a clue why and when to use them). This doesn't work
either!
Am I doing something wrong or is this a bug in the Rotation method?
Could be. Do you see anything wrong here?
// Rotate about the given axis by the given amount in radians
void wxPolygonShape::Rotate(double x, double y, double theta)
{
double actualTheta = theta-m_rotation;
> Am I doing something wrong or is this a bug in the Rotation method?
>
Could be. Do you see anything wrong here?
<code>
Instead of using the shapes centre points as input I used 0 (zero). That
solved the problem.
I don't know if I misunderstand the doc or if it's wrong.
The way I understood it was that it was possible to have a point somewhere
else on the canvas, and the polygon would rotate around it (almost like a
clock). This doesn't work. The shape moves more and more to the right while
rotating.
There might be an error in the CalculatePolygonCentre() method!?!
Anyway, I'll just make a hack to make it work the way I need it.
> BTW: Tried to do this on a RectangleShape but as nothing happened, I
assumed
> this shape doesn't support rotation. Please tell me if I'm wrong!
Correct. Rotate is a method of wxPolygonShape.
Wouldn't it be better to have the documentation for this method only under
wxPolygonShape? It's very confusing the way it is now. It shouldn't be
necessary to try the rectangle to find out you have to use polygon insted
(and then make a rectangle out of the polgon shape).