i think there is a bug in the calculation of B field.

the animated gif (click on the thumbnail to view) shows 2 different reading of B for the same position from the North pole.

horizontal B = 16.9
vertical B = 2.68
same direction from North pole, something is wrong, can help me? i read the code but no idea how to fix it :)

i attached my remix in case need, i am slowly add in

[b][color=blue]oh!!! i did it!!
fixed the bug in the calculation of B field.[/color][/b]
[quote author=Fu-Kwun Hwang link=topic=1582.msg5984#msg5984 date=1271774452]
What I did was make a transformation:
x'=x \cos\theta+ y\sin\theta
y'=-x\sin\theta+ y\cos\theta
for all the coordinates (magnet, compass, field)
[code]   double dx=x-(dipoles[i][0]*cs+dipoles[i][1]*sc)-(xMagnet*cs+yMagnet*sc);//FKH
   double dy=y-(-dipoles[i][0]*sc +dipoles[i][1]*cs)-(-xMagnet*sc+yMagnet*cs);//FKH[/code]

not to worry. hurray!!