FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Function "Rotate90", how do do it guys?





GDG
Hey everyone,

I am taking a grade 11 computer science course in high school and I need a bit of help seeing as my exam is tomorrow lol. My teacher gave us some questions from exam, pretty nice and cool guy if you aks me!

Well one question was to define the functions of a class he already made. K here is the class:
Code:

class point
{
private:
          double x, y;

public:
         point();
         double getx();
         double gety();
         void set (double Xval, double Yval);
         void move(double moveX, moveY);
         void rotate90();
};


Now my question is how would I define the function : VOID ROTATE90();. It is supposed to move a point or the co-ordinates to a new location in a 90 degree angle. If you do nto understand ask em to explain better!!!!
Shin
I'd be surprise that you can turn a POINT, and what's the point? Smile
GDG
Shin wrote:
I'd be surprise that you can turn a POINT, and what's the point? Smile



Excuse me are you a coder at all lol. If you noticed I made my own class which means it is my own type. Point is another term for the co-ordinates x and y. So I am asking how would I move them to exactly where they would be if in a real graph if I moved them to a point 90 degrees form their original point.
Nyizsa
I think you need a reference point to use as the center of the rotation, and a direction (+90 or -90). Assuming that this is P(0,0), and you rotate the positive way, your function will be as simple as:
Code:
x=-y;
y=x;

I hope it helped!
Related topics
Hey guys!!
Visitor ip PHP (E107)
Three Guys And The Witch *Mature Readers Only*
2 Canadian Guys
PHP Mail Function
C++ TUTORIAL : INTRODUCTION TO C++
Booting time
Guys what does this mean?
Hi guys!
PHP function(); &file=""?
Korean man 'overdoses' on gaming
Posting Guidelines / Guidelines to Make Quality Posts
Frankfurt Motor Show, 2005
signatures i made
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.