Login Register






Drawing block diagram filter_list
Author
Message
RE: Help C++ #2
No. We won't do stuff for you. We're not here to do other people's homework because they're too lazy to do it themselves.

What we can do here is help you understand how to do it yourself.

It's pretty simple, you have the function there right away, how to calculate an y value. You probably want to draw an linear 2D graph which has two axes - X and Y.

Basically the equation you provided allow you to calculate the y value. So what do you need to do is create a bitmap (or where-ever you want to render this) and a function which will receive the parameters, including the x parameter and return the y.

Then sweep from left to right (or even the other way, doesn't really matter that much) from x = 0 to x = XMAX, where XMAX is the horizontal resolution of the diagram. You might also multiply the X value by some constant to adjust the horizontal size of the graph.

Once you have the Y value for corresponding X position, use it to draw a pixel on that location.

So for every vertical column of pixels, which has a known X coordinate, you calculate the Y coordinate and draw a colored pixel there (or a line from the previous point, so the graph is smooth).
I love creativity and creating, I love science and rational thought, I am an open atheist and avid self-learner.

Reply





Messages In This Thread
Drawing block diagram - by AdnnAnn1 - 11-25-2012, 05:03 PM