4

for a 3d imaging software i am coding:

I need to define an ellipsoid E, which can have any radii, centers and rotations in space alt text

the user interface allows the user to control 3 ellipses, which are "slices" of the ellipsoid (red,green,blue in the image) ,and are parallel (by definition) to the main Cartesian planes (x-y, y-z. x-z)

these 3 ellipses are part of, and define, the whole ellipsoid alt text

each slice can be dragged, resized or rotated in space and each slice is fully defined: it's center's 3d position in space, it's 2 radiuses, it's distance from the axis planes.

each change should, obviously, affect the parameters of the ellipsoid E, and the other 2 derived ellipses.

i need the equation to re-calculate ellipsoid E based on the changes made to a slice

(The preferred type of equation for the ellipsoid should make it easy to derive the X-Y ellipse cuts (variable z))

any ideas? thanx in advance Saar

Saariko
  • 502
  • 6
  • 21
  • I guess you may think again this phrase _each change should, obviously, affect the parameters of the ellipsoid E, and the other 2 derived ellipses_ So ... What is fixed? – Dr. belisarius Nov 25 '10 at 12:47
  • i didn't understand your comment – Saariko Nov 25 '10 at 19:13
  • @belisarius the relationship between the 3 ellipses and the ellipsoid is fixed. this equation (=relationship) is what i am trying to figure out! – Saariko Nov 25 '10 at 23:01
  • 1
    The trouble is that although the ellipsoid determines the ellipses, the x-plane ellipse does not uniquely determine the ellipsoid. So if you change the x-plane ellipse, you must pick something else that is to remain constant in order to determine the new ellipsoid uniquely. – Beta Nov 25 '10 at 23:24
  • @Beta yep. That was the intention of my previous question. – Dr. belisarius Nov 25 '10 at 23:38
  • An arbitrary ellipse in a plane has 5 degrees of freedom. To allow arbitrary placement of 3 of them would require 15 DOF. A general 3d quadric (which includes all ellipsoids) has 9 degrees of freedom, so there is no general solution. If you add constraints - like they are all centred at 0,0 - then perhaps something can be done. – phkahler Nov 28 '10 at 02:46
  • ok, let me rephrase that from another angle. the ellipsoid starts out idle as a BALL (the 2 radiuses of each ellipse are the same) and is placed at the crossing of the Cartesian planes (center at 0,0,0). in this beginning state. the 3 slices are equal-sized CIRCLES, each on one of the 3 planes. The user of my software now has the option to choose any circle and change it: resize it, move it and, of course, STRECH it to an ellipse (at which point the "ball" turns into the ellipsoid). can u calculate the ellipsoid parameters based on this change? – Saariko Nov 28 '10 at 15:46
  • You indicate that it may start as a sphere centred at the origin. In this case, it is impossible to translate any of the planar circles independently of the others. Try to visualize that and see how the resulting ellipsoid can not meet the constraints. For this reason, it seems fair to assume that translating any ellipse means translating all 3 of them in the same direction so that they all maintain a common center in 3-space. This still doesn't provide all the needed constraints, but it helps. – phkahler Nov 29 '10 at 02:30
  • i never said changing a slice should be independent of the other two. on the contrary, i wanted to know their changed values as well. translating the location is easy: all the other move in the same direction in the same amount. please tell me what happens to the other 2 when i stretch one circle into an ellipse (it's 2 radiuses aren't the same anymore). isn't my question clear? – Saariko Nov 29 '10 at 07:03
  • @Saariko, I have a couple of questions to clarify your question. 1. you assume that the ellipses always remain parallel to their respective plains, even if the ellipsoid is rotated, i.e. the ellipse moves off the axis through its center, correct? 2. starting with the sphere, if we move one of the circles parallel to its central axis, how do you expect the sphere and the ellipse your moving to change in shape? 3. from what I'm reading, you do not wish the center of the ellipsoid to move, only the ellipses' centers, correct? – rcollyer Dec 02 '10 at 21:13
  • rcollyer and others thanks a lot. – Saariko Dec 05 '10 at 16:07

3 Answers3

2

I think the key to this problem is to rewrite the initial ellipse equation in matrix form: xTAx, where x = {x,y,z} and A is positive definite. Taking

Ellipsoid matrix.

we can update A via a similarity transform. So that, the updated matrix is then A' = UTAU where U is an orthogonal matrix and UT is its transpose. Then A' is used to update the other views.

Starting with the rotation matrices about the three axes

Rotation Matrices about the three axes.

we can see quite clearly that a rotation about the axes will effect 8 terms in A. Since, A is symmetric this is reduced to only changing 5 out of 6 terms. Scaling/stretching is also very easily done.

We start by assuming that the stretch is along the x-axis (or any appropriate axis), so that S is a diagonal matrix with a diagonal {sqrt( s ), 1, 1}, where s is the amount of stretch applied. Then scaling matrix is rotated into the correct direction of application, i.e. RTheta S RThetaT, where Theta is the angle between the positive x-axis and the stretch direction in a clockwise fashion. Note the reverse order of the rotations here, as RThetaT can be thought of as rotating the coordinates so that S stretches the x-axis and RTheta rotates them back. For example, if the x-y plane is rescaled along x = y by a factor of s, then

scaling matrix

S is applied to A in the same way as the rotations, and, again, it is straightforward to see that all but the zz terms are directly affected by the scaling operation.

rcollyer
  • 10,475
  • 4
  • 48
  • 75
1

Here you have an example of an intractable situation:

One true allipsoid and an sphere whose intersections with the three coordinate planes are points. In this example, you are not able to decide which quadric you should map.

alt text

alt text

The equations for these surfaces are:

 (-1 + x)^2 + (-1 + y)^2 + (-1 + z)^2 == 1  

and

1/8 (12 + 3 x^2 + 3 y^2 - 2 y (2 + z) - 2 x (2 + y + z) + z (-4 + 3 z)) == 1

So, as your solutions are not uniquely defined, you can't reconstruct your ellipsoid based on the three intersections. I think other answers to your question do not account for translations.

Dr. belisarius
  • 60,527
  • 15
  • 115
  • 190
  • @belisarius, forgive me, but I don't see where the problem went from working with three mutually perpendicular planar slices of an ellipsoid to the intersection of the ellipsoid with a sphere. I understand where the idea for the sphere came from, in that the ellipsoid is initially a sphere, but how we get to it intersecting the ellipsoid is not clear. – rcollyer Dec 06 '10 at 21:03
  • @rcollyer The problem is not the intersection of the sphere and ellipsoid. The problem is that both intersect the three planes in the same points, so based in just the intersections you can't know which of those surfaces you should render in 3D – Dr. belisarius Dec 06 '10 at 21:14
  • @belisarius, ah, I see. If the intersections are reduced to their limits, i.e. points, then there is no way to establish the actual ellipsoid. I think this problem will occur if any of the intersections become points, or no longer intersect with the ellipsoid. Thanks. – rcollyer Dec 06 '10 at 21:19
  • @rcollyer Is there a formal prove that if the intersections are not points or nulls then the ellipsoid is unique? – Dr. belisarius Dec 07 '10 at 12:43
  • @belisarius, I think if some conditions are met, then yes the equation of the ellipsoid can be constructed from the equations of the ellipses. I believe that two of the principle axes of the ellipsoid must lie in the plane where an ellipse is embedded, otherwise the relationship is ambiguous. However, if the ellipsoid is crafted from a known initial condition, like a sphere, then I think the ambiguity can be avoided. But, that requires an answer to my questions posted to the OP, above. – rcollyer Dec 07 '10 at 13:42
  • @belisarius, not enough room. The general equation for an ellipsoid is xTAx + v.x, where v is a translation vector. I believe that if you know the coefficients of each ellipse, then you can use them to construct the general equation for the ellipsoid. Upon further reflection, I think that as long as the three planes are linearly independent, as defined by their normals being such, then the ellipsoid can be reconstructed. It'd be easier with mutually orthogonal planes, but most things are. – rcollyer Dec 07 '10 at 13:46
  • @rcollyer I think the same, since each ellipse has 5 DOFs and the ellipsoid has only 9 ... so then again the system is much overspecified and the relationship between the ellipses and the ellipsoid should not be too hard ... which returns me to my original post and since all the three ellipses should change simultaneously when you modify one of them, also to my original question to this poster _each change should, obviously, affect the parameters of the ellipsoid E, and the other 2 derived ellipses So ... What is fixed?_ – Dr. belisarius Dec 07 '10 at 14:20
  • @belisarius, you may be miscounting. Yes, each ellipse has 5 DOFs, but several of them are shared by the other ellipses. For instance, the xy ellipse shares Ayy and vy with the yz ellipse, so that only 3 new terms are added by including the second ellipse. Furthermore, the xz ellipse's only unique term is Axz, once the other ellipses are accounted for. So, the system is not overspecified. – rcollyer Dec 07 '10 at 14:41
  • @belisarius, maybe I misunderstood. Are you asking that if we are given 3 general ellipses what constraints must be imposed on them to be able to generate an ellipsoid from them? – rcollyer Dec 07 '10 at 14:53
  • once again - you start with a perfect sphere, pick any of the circles and "stretch" it: the sphere turns into an ellipsoid and the 2 other "circles", WHICH REMAIN ON THE AXIS PLANES - THEY ARE SLICES, now become two ellipsoids because of the stretch. what are these 2 ellipsoids? what is fixed is that the 3 ellipsoids are always on the three planes, forget about moving the entire ellipsoid for now – Saariko Dec 22 '10 at 16:26
  • @Saariko I think you may find this useful http://mathforum.org/library/drmath/view/51781.html – Dr. belisarius Dec 26 '10 at 09:00
0

If, at a given instance, the 3 Ellipses represent "Cartesian" cuts of E, a single modification of any of (pan, zoom, rotate) of any of them redefines a unique ellipsoid. Luckily there is one mouse (or single recognized Keystroke) or one mind for this matter..

abuia
  • 1