Members

16

100 Neutral

• Rank
Member
1. ## Vector field for magnetic di-poles

[quote name='Emergent' timestamp='1316375936' post='4863118'] Nevertheless, I think all the basic ideas are here. [/quote] Oh my... you are my HERO!! Thanks a lot Emmy! Will try out and let you know ..
2. ## Vector field for magnetic di-poles

[quote name='Advaita' timestamp='1301196648' post='4790870'] [quote name='Emergent' timestamp='1300747795' post='4788853'] Good luck! [/quote] Thank you Emergent for all the details! I am seeing improvement myself. So far have been able to come up with a very simple vector field like the one attached. You are really cool!! Thanks. I will let you know if I am stuck somewhere. [attachment=1723:simple_vector_field.PNG] [/quote] Hi Emergent, Hope you are doing good!! [list=1][*]I have modeled a pseudo magnetic field in OpenGL, which looks similar to this [img]http://i.stack.imgur.com/la9Pt.jpg[/img][*]The vectors are discretely calculated by retrieving appropriate values from a data base which has the Bx, By values of a magnet (modeled in FEMM).[*]Now the question is how can I calculate the force of magnet A on magnet B and vice versa?? (Appreciate if some idea on Torque also is given)..[/list] I have got all the values like, cross section of the magnets, the separation b/w the magnets, the angle difference between the two magnets, (Bx, By) at any point etc. Google dint help me. So, posting here and [i]SO[/i]..
3. ## Force between two magnets when 'B' between them is know

[font="Trebuchet MS"][i][b]some basic physics question on magnetism[/b][/i][/font] [font="Trebuchet MS"]I need to compute the vector force F1 between magnet A and magnet B (both similar) at a point on a line joining their center of masses. Basically, at this point I have B1 (a 2D vector).[/font] [u][font="Trebuchet MS"]I just need to convert this B1 to F1 using some formula/method (in an openGL simulation). [/font][/u] [font="Trebuchet MS"]Assume m1, m2 as magnetic moments, r as the distance vector between the two center of masses[/font] [font="Trebuchet MS"]Can someone put some thought to this?[/font] [font="Trebuchet MS"]Regards, asm [/font]
4. ## Need a sample program to interpolate

[font="Trebuchet MS"]Hi guys, I have a bunch of points in 2D, through which I need to draw a smooth line (through all the points). Can you suggest of any existing tutorials which will help me understand the algorithms (like splines, b-splines, cubic splines etc) and sample code to understand them better? Regards.. [/font][font="Trebuchet MS"]Thanks, Aditya [/font]
5. ## Problem with GLUT coordinates of x and y

[quote name='Advaita' timestamp='1301202669' post='4790884'] [font="Trebuchet MS"] Hi, I have written a simple code to get the mouse coordinates, but the one I get are completely different - may be the window coordinates - instead of the glut coordinates. I have defined a plane and its center is (0,0). How can I get the mouse coordinates wrt this center? I do.. [/font][list=1][*]glutMotionFunc(mouseMove); in the main(), and[*]mouse_x = x; mouse_y = y; in the mouseMove(int x, int y) function.[/list]Now if I want to get the coordinates wrt the center of the plane, what should be done? Any specific APIs for that? Advise required.. [i][u]Sample Output for understanding of the problem:[/u][/i] [font="Trebuchet MS"][attachment=1727:paint_edited_vector.PNG][/font] [/quote] [font="Trebuchet MS"]Okay could come up with a manual solution myself.. [font="Arial"] height = height of the window. width = width " [/font] [b]Observation: [/b] Everything below the windows title bar and right to its left edge is in +ve coordinates. [b]Steps:[/b] Let x, y be the actual mouse coordinates. [/font][list=1][*][font="Trebuchet MS"]new_mapped_x = x - width/2;[/font][*][font="Trebuchet MS"]new_mapped_y = height/2 - y;[/font][/list][font="Trebuchet MS"]This solved my problem. But is there any direct API which I can use?[/font]
6. ## Problem with GLUT coordinates of x and y

[font="Trebuchet MS"] Hi, I have written a simple code to get the mouse coordinates, but the one I get are completely different - may be the window coordinates - instead of the glut coordinates. I have defined a plane and its center is (0,0). How can I get the mouse coordinates wrt this center? I do.. [/font][list=1][*]glutMotionFunc(mouseMove); in the main(), and[*]mouse_x = x; mouse_y = y; in the mouseMove(int x, int y) function.[/list]Now if I want to get the coordinates wrt the center of the plane, what should be done? Any specific APIs for that? Advise required.. [i][u]Sample Output for understanding of the problem:[/u][/i] [font="Trebuchet MS"][attachment=1727:paint_edited_vector.PNG][/font]
7. ## Vector field for magnetic di-poles

[quote name='Emergent' timestamp='1300747795' post='4788853'] Ok, let's start simple then. My advice: 1.) Install [url="http://www.microsoft.com/express/Downloads/#2010-Visual-CPP"]Visual C++ Express.[/url] 2.) Follow [url="http://www.lighthouse3d.com/opengl/glut/"]this tutorial[/url] . It will walk you through setting up a window and doing simple drawing using OpenGL. 3.) Write a function to draw a vector field that you have stored in an array. Forget the fancy stuff; just draw a bunch of arrows. Test it on a simple vector field, e.g. u=-y, v=x. 4.) Write a function to generate the magnetic field corresponding to a single, infinite wire perpendicular to the plane. It is, B = (mu_0 I) /(2 pi ||r||^2) J r where 'r' is the 2d displacement vector from the point where the wire intersects the plane, I is the current, mu_0 is the [url="http://en.wikipedia.org/wiki/Vacuum_permeability"]magnetic permeability constant[/url], and J = [0 1; -1 0] is a 90-degree rotation matrix. Test it using the function you produced in part #3. 5.) Write a function to generate the magnetic field due to a solenoid. To do this, just add up many of the fields that you figured out in part #4. [url="http://en.wikipedia.org/wiki/File:VFPt_Solenoid_correct2.svg"]This image[/url] shows you how. You are approximating your bar magnet by a solenoid, so this produces the field due to a single bar magnet. 6.) Write a function to generate the magnetic field due to a number of bar magnets. To do this, add up a number of the fields you got in part #5. Ultimately, you're going to need to figure out C++, the basics of the OpenGL API, and a little bit of physics, to pull this off. If you need more resources... For the physics, my suggestion is to get a simple -- say, high-school- or college-freshman -level -- textbook. For C++, the tutorials [url="http://www.cprogramming.com/tutorial.html"]here[/url] are a good place to start. For OpenGL, you might also want to check out the tutorials [url="http://nehe.gamedev.net/"]here[/url]. Still, don't let this scare you; walk through the steps I listed, and you should be able to do this. And by the time you get to #6, you should be comfortable enough with what you're doing to direct yourself. Good luck! [/quote] Thank you Emergent for all the details! I am seeing improvement myself. So far have been able to come up with a very simple vector field like the one attached. You are really cool!! Thanks. I will let you know if I am stuck somewhere. [attachment=1723:simple_vector_field.PNG]
8. ## Vector field for magnetic di-poles

Is someone there to guide!!? OR ATLEAST POINT ME TO SOME GOOD TUTORIAL ON SIMULATING DYNAMICS. Whatever you know might turn out helpful to me.
9. ## Vector field for magnetic di-poles

[font="Trebuchet MS"][size="2"]Thanks Emergent for the ideas, but I am afraid, again all these sound very new to me unfortunately. I pity myself for neglecting physics and graphics in my school. Nevertheless, I have to complete my project I am working on ASAP as I am running out of time pretty quickly. Unavoidably, I have wasted a week searching for a [u]prototype app[/u] that nearly suites my requirement but in vain. I go very anxious these days. At this point, Can I ask you to involve in some hardcore "OpenGL, GLUT + Physics + Math" discussions with me!!? You might have to adjust with me for a week(or two) probably. Consider this as my humble request. Thanks. So, let me start with a questionnaire of all my little knowings.. [/size][/font][list][*][font="Trebuchet MS"][size="2"]I understand that C/C++ is the logic behind the scene and OpenGL is the front end for my visualization. Am I write? Which one is it good to work on - C or C++? Specifically, VC(Win32) or VC++(MFC)? Somewhere I've read that MFC is not so good!!?? In that case, developing a gaming app in simple C - with out OOPS - isn't going to be too hard? [/size][/font][*][font="Trebuchet MS"][size="2"]Is there any specific design (pattern) we need to abide when developing a good graphics application for such interactions? Basically, my C++ classes and the graphics objects have to communicate and do the needful in a very reliable way!? Just a thought. [/size][/font][*][font="Trebuchet MS"][size="2"]The approach in my mind (pls correct wherever required.) [/size][/font][list=1][*][font="Trebuchet MS"][size="2"]In a 3D, create an XY plane(say 500 x 500) which can be rotated and viewed from any angle using mouse.[/size][/font][*][font="Trebuchet MS"][size="2"]Create an object "Bar Magnet1 (cuboid with N and S)" and place it on the above plane, say at origin - center of the screen.[/size][/font][*][font="Trebuchet MS"][size="2"]Now this magnet has got some properties like B, H, magnetic moment etc etc. (I need some help here on which properties really play an important role).[/size][/font][*][font="Trebuchet MS"][size="2"]Calculate the field intensity using differential equations. Which algorithm to be considered? Okay, but what about the direction of the field - this is important as to show attraction or repulsion. How can we get the direction? This is just the angle wrt an imaginary line in the 2D plane, right?[/size][/font][*][font="Trebuchet MS"][size="2"]Now this field reduces with distance. To visualize this in the 3D picture, which is better to go for? Arrow plot or LIC and how to achieve that? [/size][/font][/list][*][font="Trebuchet MS"][size="2"]Right now [i]gamedev [/i]is the ONLY hope to complete my project on time - atleast to get some idea on what to do. If you could point to relevant demos/tuts and help me connect the dots, that would be real help.[/size][/font][/list][font="Trebuchet MS"][size="2"]Thanks for all your help!![/size][/font]
10. ## Web Game: Magnet Billiards

[quote name='JBourrie' timestamp='1214831853' post='499687'] Just thought I'd share this with the GameDev crowd. It took about six hours total, and turned out surprisingly well for a game that was completely improvised (when I started coding I had no idea where I was headed with it). Unfortunately there is no AI, so it's a multiplayer-only game. Theres a good deal of strategy to it, so I encourage you to try it out with a friend! Have fun! [url="http://www.insertcoinarcade.com/Magnet_Billiards/applet/"]Magnet Billiards[/url] [/quote] Could not access your game. Did you write it using OpenGL?
11. ## Vector field for magnetic di-poles

[color="#2f4f4f"]Unicron, can you give me some ideas on continuing.. [/color][list=1][*][color="#2f4f4f"]My vector field idea is derived from [url="https://phet.colorado.edu/sims/faraday/faraday_en.jnlp"]here[/url]. Run this and you see a vector per grid.[/color][*][color="#2f4f4f"]If my plane has such a grid and respective vectors, I will control them to behave as I say.[/color][/list][color="#2f4f4f"]Give me some ideas for the above implementation. Let me also know your opinions. [/color]
12. ## Vector field for magnetic di-poles

[quote name='Emergent' timestamp='1300377543' post='4787060'] If you're only interested in divergence-free flows like magnetic fields, why not construct streamfunctions and use marching squares to draw the level sets? This will give you nice global properties; e.g., integration error will never cause field lines to cross, etc. [/quote] [color="#2f4f4f"]Hmm.. Looks like this sounds too techy to me! Can you explain to me in detail on stream functions, marching squares, level sets etc. Any good material online? Pls refer my above post for my actual requirement in case you wanted more details. Thanks. [/color]
13. ## Vector field for magnetic di-poles

Thank you Unicron!! That was very informative!! [quote name='_Unicron_' timestamp='1300366216' post='4786974'] I'm confused to what you actually want. LIC is a visualization technique. Do you want to create a simulation that constructs the vector field? Or have you got already got the vector field data and want to perform LIC to visualize it? Or both? [/quote] [color="#2f4f4f"]Let me start from the beginning. [/color][list=1][*][color="#2f4f4f"]My requirement is to build a simple simulation of magnetic field lines between two or three bar magnets in OpenGL.[/color][*][color="#2f4f4f"]Also, if the magnets are too close to each other, based on their alignment, they should.. [/color][list][*][color="#2f4f4f"]attract, or[/color][*][color="#2f4f4f"]repel, and/or [/color][*][color="#2f4f4f"]turn i.e. show some torque on its axis. [/color][/list][*][color="#2f4f4f"]As a first step, I am searching for some implementation which has a plane (say xy-plane) with grid lines and each grid having an associated vector. These vectors will be later used when a magnet is placed on the plane to show the direction of the field and its intensity. It is here I came to know about LIC.[/color][/list][color="#2f4f4f"]Now, I would like to understand more about LIC from an already existing tutorial (if one exists). So, in essence, "I was asking how to create a simulation that constructs the vector field using the LIC technique". [b]Question[/b] From what you say, LIC is used only after we have a vector field in hand?? [/color] [quote name='_Unicron_' timestamp='1300366216' post='4786974'] If this isn't helpful let me know and I will dig out my C++/OpenGL implementation of LIC for you. It's not a stand alone library but you can have the class source to see how I did it. It's also not the best implementation, as it was a quick hack, but the results looked good and it ran at a reasonable rate. [/quote] [color="#2f4f4f"]Yes. Please do share your sample program. I will run it and see if it can be helpful.[/color] [quote name='_Unicron_' timestamp='1300366216' post='4786974'] Does it have to be LIC? You could try something [url="http://www.win.tue.nl/%7Evanwijk/ibfv/"]IBFV[/url] (theres some example code on there too), which gives similar results but should be faster. [/quote] [color="#2f4f4f"] Not specifically. Just trying different options. I am very new to graphics programming. So, do not know which is good or bad. Trying everything I come across. IBFV is good. I tried it on my system and it performs well.[/color]
14. ## Vector field for magnetic di-poles

I need to simulate two magnets, their fields and some kinematics if they are in close vicinity to each other. Could someone point me to an example of this kind? Similar question at [url="http://www.gamedev.net/topic/597850-vector-field-for-magnetic-di-poles/"]http://www.gamedev.net/topic/597850-vector-field-for-magnetic-di-poles/[/url] Thanks, Aditya
15. ## Vector field for magnetic di-poles

Hi, Just registered and writing my first post in GameDev!! [b]Problem Statement [/b]I wanted to simulate the magnetic field lines (vectors, i.e, direction and intensity) in [color="#ff8c00"][i]OpenGL [/i][/color]using the [color="#ff8c00"][i]Line Integral Convolution[/i][/color] technique. Something like this "[url="http://www.mare.ee/indrek/ephi/"]http://www.mare.ee/indrek/ephi/[/url]". [b]Questions[/b] [list=1][*]Is LIC a library? If yes, where can I find one for VC++ 2010 ultimate?[*]An example/tutorial explaining the usage in 2D and 3D(if possible).[/list] If I seem to sound naive and abstract in my talking please forgive me and provide me necessary pointers to start with! Thanks, Aditya