3d imaging: defining an ellipsoid based on 3 given ellipses which are parallel to the Cartesian planes
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
t开发者_如何学运维he 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
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
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
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
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
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.
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.
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.
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..
精彩评论