What is the Equation of the Ellipse in 3D for Magnetic Field Visualization?

In summary, the conversation discusses the process of defining an ellipse in a 3D space that joins two pipes at the origin. The solution involves constructing a rotation matrix from the pipe coordinate system to the global coordinate system. The rotation matrix is defined by using the dot product between the unit vectors of the two systems. The conversation also addresses the issue of defining the axes of the ellipse and suggests using the cross product of the two vectors that define the orientation of the pipes. The end result of the conversation is the successful creation of a 3D magnetic field visualization tool.
  • #1
Klaws
7
0
Hi,

I'm writing a visualization tool for magnetic fields in DirectX. I am currently building a model for 3D curves which will be used to describe field lines. The curves will be built as staight pipes joining several points. The lighting and shading will then take care of smoothing things.

Now back to maths. I have two direction vectors describing the direction of two pipes. They join at the origin. Now the part that joins the two pipes needs to be an ellipse at an angle that bisects the two vectors. Knowing the radius of the pipes (equal radius) and the two vectors, is it possible to come up with the equation of the ellipse in 3D? thank you and sorry if this is not so clear.
 
Mathematics news on Phys.org
  • #2
Define a rotation matrix from your pipe coordinate system to your global coordinate system.

The 3X3 rotation matrix is given by
Axx,Axy,Axz
Ayx,Ayy,Ayz
Azx,Azy,Azz

with elements
A_xy=x'.y, etc. (x'.y is the dot product between x' and y)
where x,y,z are unit vectors in your global coordinate system, and x',y',z' are unit vectors in your pipe coordinate system.

Then define the ellipse in your global coordinate system and use the rotation matrix to transform the ellipse into your pipe coordinate system.
 
  • #3
The problem is defining the ellipse in global coordinates. What I was doing to test the pipe building part was defining the ellipse joining two pipes as a circle with radius 1 at the origin with x=0(on yz plane). Now I'd like to 'upgrade' this to an ellipse that joins the pipes.

Thank you for the replies.
Claudio
 
  • #4
OK, I'm not sure I understand.

If the pipes were laid completely flat and oriented along convenient x-y directions then you wouldn't have a problem with defining the ellipse right?
 
  • #5
Yes that is my problem. Defining the ellipses when the pipes lie on the XY plane. What I want is the equation of the ellipse derived from the two pipes (vectors) and their radius.

Thanks again,

Claudio
 
  • #6
Klaws said:
Yes that is my problem. Defining the ellipses when the pipes lie on the XY plane. What I want is the equation of the ellipse derived from the two pipes (vectors) and their radius.

Thanks again,

Claudio

OK, so you want to define an ellipse which touches the ends of two vectors in the x-y plane. I suppose that the pipes are not in general at 90 degrees to each other?
 
  • #7
I have 2 unit vectors in the xy plane. I am constructing a pipe around each of these vectors. What I want is the ellipse that is formed at the origin(in 3D) when the two pipes meet. If the pipes are at 90 degrees the ellipse will be at 45 degrees. In general, the pipes are at obtuse angles but not necessarily.
 
  • #8
Sorry, maybe I'm being dense here.

I'm still not sure what this pipe is.

There are two axes for the ellipse, at right angles to each other. How do these two axes depend on the direction of the two vectors?
 
  • #9
No problem at all, after all, you're trying to help me out :)

I'm attaching a picture of two pipes. Their vectors are <0,1,0> and <1,1,0>. The ellipse should be the one joining the pipes at the origin. The axes of the ellipse should the normal of the two vectors and their angle bisector.

Thanks for the patience ;)

Claudio
 

Attachments

  • Pipes.jpg
    Pipes.jpg
    3.5 KB · Views: 646
Last edited:
  • #10
christianjb said:
Define a rotation matrix from your pipe coordinate system to your global coordinate system.

The 3X3 rotation matrix is given by
Axx,Axy,Axz
Ayx,Ayy,Ayz
Azx,Azy,Azz

with elements
A_xy=x'.y, etc. (x'.y is the dot product between x' and y)
where x,y,z are unit vectors in your global coordinate system, and x',y',z' are unit vectors in your pipe coordinate system.

Then define the ellipse in your global coordinate system and use the rotation matrix to transform the ellipse into your pipe coordinate system.


I managed to work around the ellipse issue in the xy-plane. I am now trying to use this matrix to rotate the axes. The problem is that I only have the unit vector for x' and not for y' and z'. Is there a way to define a rotation using only this vector and x,y,z? This should be possible because visually it's just like grabbing the x-axis and and positioning it at x'. The other 2 axes should 'follow'.

Thank you,

Claudio
 
  • #11
Klaws said:
The problem is that I only have the unit vector for x' and not for y' and z'. Is there a way to define a rotation using only this vector and x,y,z? This should be possible because visually it's just like grabbing the x-axis and and positioning it at x'. The other 2 axes should 'follow'.

Things don't work that way in 3D. There are many (uncountably many) rotations that take x to x', but only two will have the correct x'y' plane. (The y' unit vectors of the two solutions differ by sign.)

Fortunately, you do have a way to define all three axes. The two pipes define a plane. I assume you have vectors that define the orientation of these two pipes. The cross product of these two vectors is normal to each pipe. This forms the basis for one of your unit vectors (z'). You already have x'. y' is just the cross product of z' with x'.
 
  • #12
Thanks DH,

I had arrived at that solution after working my way through vectors with the help of 3 pens (my DIY axes). I was just implementing it the wrong way.

My assumption that the axes should 'follow' was obviously wrong. I was still thinking 2D.

I'm starting to like this 3D stuff :)

I'm attaching my first 3D magnetic field. :) It's just built up using ellipses with no physical equations whatsoever. Suggestions as to how it could be more realistic are welcome. The tool is aimed at high school students learning A Level physics.

Thanks for your precious help,

Claudio
 

Attachments

  • Magnet.jpg
    Magnet.jpg
    72.7 KB · Views: 758

1. What is the equation of an ellipse in 3D?

The general equation of an ellipse in 3D is represented as (x/a)^2 + (y/b)^2 + (z/c)^2 = 1, where a, b, and c are the lengths of the semi-major, semi-minor, and semi-z axes, respectively.

2. How is the equation of an ellipse in 3D different from that in 2D?

The equation of an ellipse in 3D includes an additional term for the z-axis, making it a three-dimensional shape instead of a two-dimensional one. This allows for more complex ellipses with varying lengths in all three dimensions.

3. Can the equation of an ellipse in 3D be simplified?

Yes, the equation of an ellipse in 3D can be simplified by dividing both sides of the equation by a constant value to make the coefficient of 1 on the right side. This results in a more compact and manageable equation.

4. How can the equation of an ellipse in 3D be used in real-world applications?

The equation of an ellipse in 3D can be used in various fields such as engineering, physics, and astronomy. It can be used to model the orbits of planets, satellites, and other celestial bodies, as well as to design and analyze three-dimensional shapes and structures.

5. Is the equation of an ellipse in 3D always symmetrical?

No, the equation of an ellipse in 3D can represent both symmetrical and asymmetrical shapes depending on the values of a, b, and c. If all three values are equal, the ellipse will be symmetrical, but if they are different, the ellipse will be asymmetrical.

Similar threads

Replies
3
Views
1K
Replies
4
Views
1K
Replies
6
Views
859
Replies
1
Views
773
  • Special and General Relativity
Replies
29
Views
1K
  • Electromagnetism
Replies
1
Views
893
  • Electromagnetism
Replies
5
Views
950
Replies
6
Views
739
  • STEM Educators and Teaching
Replies
15
Views
3K
  • Introductory Physics Homework Help
Replies
1
Views
333
Back
Top