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 ?

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.


http://java.sun.com/docs/books/tutorial/uiswing/index.html
http://java.sun.com/docs/books/tutorial/2d/overview/primitives.html
http://java.sun.com/j2se/1.3/docs/api/java/awt/Graphics.html

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.