angeldarkholme

09-16-2005, 02:27 PM

Hi everybody...

Im new on all this and Im having troubles...

I want to do a program with a triangle controled by the user....Its supposed that it can rotate and move at any point in the window.

The triangle can only be moved forward to the direction pointed by one vertex....for example

/\ <----this one

/ \

/ \

/______\Now.....

At this time I can rotate the triangle in his own center, but I cant make it move to the direction pointed by that vertex....How can I do that??

I have 2 ideas...

The first one:

I think I can make a lot of "if" instructions and ask for the "angle" so that, I could make a diferent glTranslate instruction for every angle...but I think that should be very ineficient...

The second one..

I think I can use the Math.h sin and cos functions to make the triangle move but I have been trying this and the triangle only does it well in some angles...

How can I correct this??

Is there another way to do it?

Your help will be very apreciated...

Im new on all this and Im having troubles...

I want to do a program with a triangle controled by the user....Its supposed that it can rotate and move at any point in the window.

The triangle can only be moved forward to the direction pointed by one vertex....for example

/\ <----this one

/ \

/ \

/______\Now.....

At this time I can rotate the triangle in his own center, but I cant make it move to the direction pointed by that vertex....How can I do that??

I have 2 ideas...

The first one:

I think I can make a lot of "if" instructions and ask for the "angle" so that, I could make a diferent glTranslate instruction for every angle...but I think that should be very ineficient...

The second one..

I think I can use the Math.h sin and cos functions to make the triangle move but I have been trying this and the triangle only does it well in some angles...

How can I correct this??

Is there another way to do it?

Your help will be very apreciated...