hey :

i am working on simple engineering application but i have some problem

i want to draw X-Y axis Then put any point on it .

Then i want to translate this point ∆x=5 , ∆y=12

After that i want to rotate it by angle (∂) degree

then i want to reflect it around X-axis

can any one help me ?

4
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by Ancient Dragon

That may sound simple, but it isn't. Drawing objects such as lines, elipses etc can be very complicated depending on the operating system and compiler.

That may sound simple, but it isn't. Drawing objects such as lines, elipses etc can be very complicated depending on the operating system and compiler.

So Can You help me to do that ?

Well this is the C++ forum. I'm sure you can do all of that in C++, though I have no idea how so I'm of no help if you go the C++ route. However, Java has the Swing library, which has a lot of these function written for you if you want to go that route.

You can do it through C++ (what can't you do in C++???)

There's many different ways, e.g. use graphics functions in window classes such as Qt, etc. or if using windows use the GDI WIN32 APIs directly onto the screen/window/memory bitmap/etc.

If you use Qt or some other windows classes, the code should be portable across platforms.

For the windows GDI method, check out the following functions:
GetDC, MoveToEx, LineTo, and related functions.

As for the rest of your question, translation dx = 5, dy = 12 - isn't that just adding these values to the original coordinates?

rotation by angle (assuming (0,0) is rotation origin) - you can use matrix multiplication, or simple trigonometry: e.g.
convert (x,y)-->(mag, ang)
ang += rotation_angle
convert(mag,ang)-->(x,y)

Reflecting about x axis - just make y coordinate negative

OK, so most of that was not c++ specific...

So Can You help me to do that ?

No, sorry, its outside my expertise.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.