Ok, swell. I've corrected the original equation, added some fine-tuning control over it, and animated it to boot. Not a bad little proggie, actually.
Oh, and thanks again to all the math geeks who helped me out.
- cheers.
This is a discussion on ...simple sine wave? within the C++ Programming forums, part of the General Programming Boards category; Ok, swell. I've corrected the original equation, added some fine-tuning control over it, and animated it to boot. Not a ...
Ok, swell. I've corrected the original equation, added some fine-tuning control over it, and animated it to boot. Not a bad little proggie, actually.
Oh, and thanks again to all the math geeks who helped me out.
- cheers.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
I never thought I'd get to show this proggie off, but this is an appropriate place. I did it when we were talking about electro magnetic radiation in chemistry.
oh and sebastanti your program just closes when I go to run it so I have no clue what you actually did in your program
here is a second version i just made. I'll give 20 bucks to anyone who can look at it for 20 mins without barfing.
Interesting. But what is it? It sort of looks like one of those hippie "trip" movies you're supposed to watch on LSD.
So, did anyone else have trouble running my program?
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
>> here is a second version i just made. I'll give 20 bucks to anyone who can look at it for 20 mins without barfing. <<
I'm a bit disappointed. I could do 20 minutes...er--I mean did 20 minutes where's my money
[edit]
Btw, you program looks much nicer Sabastiani.
[/edit]
Last edited by master5001; 12-13-2002 at 02:52 AM.
yeah your program looks pretty cool, it took me forever to figure out how to change the things in the textbox lol
would mine be better if you could change the amplitutde, wavelength, frequency, sleeptime, etc in my prog?
I have a question, what exactly is the 'res' and what did you use sebastiani (windows GDI?) for the waves.
I actually watched the your animation for some time. Interesting patterns. And sure, it'd be cool if you could tinker with the settings. So what did you use to code it in and what are the algo's based on?
I used straight Win32, no DX or anything, but luckily I could make use of a C++ library I've been working on, which was rewarding.
'Rez' is just the relative resolution, or how often the calculation is performed, with 1 (pixel) being the highest resolution. Interesting effect when you set rez, amp, and freq to the same values, too.
I really suck at math and that's what I appreciate about the program, is that I do enjoy tangible applications of mathematical principles...anyway, I would like it to eventually parse equations and add some other features too. Let me know if you have any suggestions.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
just win32api and opengl.So what did you use to code it in and what are the algo's based on?
The equations used in both our apps are almost exactly the same, except with mine they are all hard coded into the program. Color (which is randomly assigned each frame creating seizure causing flashing),and length of the spiral are also hard coded into the program. The biggest difference between the apps is that in mine both the horizontal and vertical movement is controlled by sine waves as a function of time, and it moves over the z axis causing the spiral effects (this should be familiar to people who have played quake II/III because the railgun uses a similar spiral except I think the amplitude decreases as z increases). Yours is better because you can actually interact with it, mine is just like a screensaver.
ohhhhh boy there are so many cool things you can draw with equations. Here's something I did using inverse power models, i.eapplications of mathematical principles...anyway, I would like it to eventually parse equations and add some other features too. Let me know if you have any suggestions.
y = 'size' / x^power
i.e in this attached proggie it's
25/time^2; for the first
and 50/time^2 for the second
the second is farther away and they are both connected by lines in my program
if you have a ti83 graph the following :
y1 = 5 /x
y2= -5 / x
y3 = 1 / x
y4 = -1/x
y5 = 5 / x^2
y6 = -5 / x^2
that should give you a good idea
and also my math teacher was explaning how to use the polarity mode on the ti 83 to produce spirals, ill find more about that next school week
here is that prog that demonstrates inverse powermodel usage, again everything is hard coded into the program, however you can use the following keys to move around
left arrow, right arrow, up arrow, down arrow
if the view gets too screwed up press r to reset the view
here is that file
EDIT: I changed the equation to y = size / time instead of raising it to any power (it looks better this way). so now im not sure what you call it (model of inverse variation?) but it's no longer an inverse power model because I'm not raising anything to any powers.
yeah...
Last edited by Shadow12345; 12-14-2002 at 02:47 PM.
Ok, thanks. I'll post a parsing version sometime next week that will allow equations like these. Also, a grid might be nice, and I need to save settings in the next version too. I wonder how hard z-order implementation would be? I'll look into it.
Thanks for all of the input.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
>ohhhhh boy there are so many cool things you can draw with
>equations.
I totally agree. Just take a look at fractals. For example, the Mandelbrot set:
http://www.olympus.net/personal/dewey/mandelbrot.html
Cool site. Have you heard of the 'archimedes spiral' or something like that? You draw it by setting your ti 83 to radian mode, then instead of 'func' set it to 'pol' which means polarity. Then you do the sine/cosines of theta (I think that's what it is) and it creates spirals that seem to somewhat resemble those fractals. I might be describing that process a little inaccurately, but chances are if you're in or passed college you've already done it and know what I really mean I'm dumb!Originally posted by Shiro
[B
I totally agree. Just take a look at fractals. For example, the Mandelbrot set:
http://www.olympus.net/personal/dewey/mandelbrot.html [/B]