Monday, July 20, 2009

Moving on to more complex charge geometries

Now that PhysViz is successfully visualizing electric fields and particle traces for the simplest of charge geometries, the sphere, it is time to get a bit more complicated. In preparation for upcoming charge geo's; I decided that instead of going through the mathematical gymnastics and writing of countless mathematical helper functions for specific geometries, it would be best build in a cordinate superposition function set into the program in order to allow each charge geometry to effect the space around it as if it were square on the x-axis of its own coord-system.

The effort seems to be straight forward, the only differences that must be accounted for in translating between two superimposed coordinate systems should be displacement (cartesian) and delta_theta / delta_phi (spherical). I have made a first crack at writing these functions, displacement is easy, the sphereical change in angles is giving me a little trouble however. I am attempting to accomplish the angle calculations in the following manner:

delta_theta = arccos(dot_product(xy_normal_1, xy_normal_2))
delta_phi = arccos(dot_product(xz_normal_1, xz_normal_2))

where the postfixes 1 and 2 represent the two different coord systems.
Also keep in mind that this is the computer graphics coord system, where if sketched on a piece of paper y points straigt up, x points to the right and z points off the paper.

The system is producing some funny results right now, any ideas on some mathematical errors that I may be making?

No comments: