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

  • Context: Graduate 
  • Thread starter Thread starter Klaws
  • Start date Start date
  • Tags Tags
    3d Ellipse
Click For Summary

Discussion Overview

The discussion revolves around the mathematical modeling of ellipses in 3D for visualizing magnetic field lines in a DirectX application. Participants explore how to define the equation of an ellipse that connects two pipes represented by direction vectors at the origin, considering their orientation and radius.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant seeks to define an ellipse that bisects the angle between two direction vectors at the origin, given their equal radius.
  • Another participant suggests using a rotation matrix to transform the ellipse from a global coordinate system to a pipe coordinate system.
  • A participant mentions testing the ellipse definition by starting with a circle in the yz plane and aims to extend this to an ellipse connecting the two pipes.
  • There is a discussion about the orientation of the pipes and how it affects the definition of the ellipse, particularly when the pipes are not at right angles.
  • One participant describes the need for the axes of the ellipse to be aligned with the normal of the two vectors and their angle bisector.
  • A later reply discusses the challenge of defining a rotation in 3D using only one unit vector and emphasizes the necessity of defining all three axes based on the two pipes.
  • Another participant reflects on their misunderstanding of how axes should be defined in 3D and acknowledges a shift in their understanding of the topic.

Areas of Agreement / Disagreement

Participants express varying levels of understanding regarding the definition of the ellipse and the necessary mathematical constructs, indicating that multiple competing views remain on how to approach the problem. The discussion does not reach a consensus on a definitive method for defining the ellipse in 3D.

Contextual Notes

Participants mention the need for a clear definition of the ellipse in global coordinates and the implications of the orientation of the pipes, which introduces complexity in the mathematical modeling. There are unresolved aspects regarding the implementation of the rotation matrix and the definition of the axes in 3D space.

Who May Find This Useful

This discussion may be useful for developers and researchers working on 3D visualizations in physics, particularly those interested in magnetic field modeling and geometric representations in computer graphics.

Klaws
Messages
7
Reaction score
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.
 
Physics news on Phys.org
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.
 
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
 
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?
 
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
 
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?
 
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.
 
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?
 
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: 711
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: 837

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 42 ·
2
Replies
42
Views
8K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 44 ·
2
Replies
44
Views
25K