Calculating angle of circle to produce given ellipse

In summary, the conversation discusses a problem with calculating the angular tilt of a circle in a perspective view to produce a given ellipse. The eccentricity and position of the ellipse on screen are known, but the angle between the camera and the circle's normal is needed. The speaker has tried to solve the problem using trigonometry, but found it imprecise and affected by inaccuracies. They then mention a previous solution offered to them, but it does not work with the ellipse. They propose a new approach involving finding the actual points on the ellipse that represent the diameter of the circle. They are seeking assistance in finding a solution to their problem.
  • #1
HKragh
12
0
I know I should keeps this short, but I need to explain it a little. So, please have patience with me :)

Given a standard ellipse, and its eccentricity and position on screen, is there some clever way of calculating how much a regular circle needs to be tilted in (angles) in a perspective view to produce said ellipse? Obviously the tilt is related to the position on screen, as the very act of moving a circle around, will change the ellipse. So it's not so much a tilt in world space I need to calculate, as it is the angle between a ray going from the center of the circle to the camera, and the normal of the circle (I'm not sure if the normal of a circle is the right term when speaking of a 2D object, but think of the cap of a cylinder instead, then you know what I mean by the normal from the center of the cap).

I have tried for a long time now, by using a purely trigonomical approach, but even though my results aren't way off, they aren't precise either. And the closer to camera the circle is, the less precise my method is. It's surele because my approach considers the view orthogonal ;)

I have the angular separation of the two maximum distances (on the semi-major axis, or more plainly, the total width of the ellipse), calculated from the cameras field of view, and the screen separation of said points, and the center position of the ellipse on screen, which my intuition tells me I need, in order to calculate this. I also have the perspective transformation matrix of the camera. I just can't find the right approach. The ellipse are in no way alligned with the view axis, it can be rotated.

This thread, which I posted some weeks ago, gave me a great solution to a related problem, but this was before I had the ellipse. And even though the math I was offered back then in theory would be what I need to solve this with the ellipse, it is WAY too affected by even the smallest inaccuracies of the center direction. It only works on perfect data. This is why I came up with this elliptic approach instead, where the ratio between the semi major/-minor axis should be A LOT less affected by inaccuracies, and the calculated angle should be more precise, even when data is noisy.

Sorry for the long story. Please, if anybody can push me onwards, I would be grateful! And if not, I'm sure it's for a good reason ;)
 
Physics news on Phys.org
  • #2
Hi,

I find it hard to answer your question as I found the geometry of your problem is not explained clearly. You spoke about "perspective transformation matrix of the camera". Is your problem related in any way to camera calibration with dot array calibration pattern?
 
  • #3
mnb96 said:
Hi,

I find it hard to answer your question as I found the geometry of your problem is not explained clearly. You spoke about "perspective transformation matrix of the camera". Is your problem related in any way to camera calibration with dot array calibration pattern?

It all goes on in a game engine, so the camera has perspective transformation matrix defined. And no, this is not for calibrating, this is just as explained ;)

1) I have an ellipse.
2) This ellipse has a major and minor semi axis. The max points of these two axis are defined. The axis rotation on screen is also defined.
3) The world angle from the camera through each of these points are defined

I need to find a method of calculating the angular tilt of a circle, which would produce such an ellipse on that exact location on screen.

But..Hold on with trying to answer me, I may have found a solution myself. Or at least a work around.
 
  • #4
Drawing a picture should help you. If the plane of the circle makes angle [itex]\theta[/itex] with the screen on which you are projecting, you have a line of length 2r (representing the circle of radius r) forming the hypotenuse of a right triangle with angle [itex]\theta[/itex] and base leg, the projection, of length [itex]2r cos(\theta)[/itex]. That is, a circle with radius r, [itex]x^2+ y^2= r^2[/itex], at angle [itex]\theta[/itex] projects to an ellipse with major semi-axis of length r and minor semiaxis of length [itex]r cos(\theta)[/itex]. Its equation would be [itex]x^2/r^2+ y^2/(r^2 cos^2(\theta))= 1[/itex].
 
  • #5
Thanks for the answer! I just did some pictures to visualize a problem with your solution. Unless I misunderstand.

The semi-major axis, or the vectors pointing towards them, doesn't represent the diameter of the circle. If I calculate at what distance I have a circle radius between one of the max points on the semi major axis, and the center of the ellipse, I will calculate a distance too short, because the angle is a little too wide. As the circle rotates aways from you, the semi major axis, if projected onto the circle in world space, will lie between the two tangent points of the circle (or ellipse) as seen from above, which intersects the camera. And as I don't know the distance to the camera, I can't calculate those two points. And I can't calculate the distance without them either. Or maybe I can. I'm simply not skilled enough ;)

TopDownEllipse.jpg


SideViewEllipse.jpg


My next approach is to drop the semi major axis max points all together, and instead find the actual points on the ellipse, which represents the diameter of the circle. This should be fairly easy. I know the circle center on screen. I know the center of the ellipse. The distance between those two could be used as my y-value, and then the x-value should be calculated. That would give me two points on the ellipse, which, if I shoot vectors at them, and measure the angle, could give me the distance to the circle center. When that is done, I'll look into your solution! It looks valid from then on.

EDIT: The pics doesn't show up as pictures, even though they're wrapped in IMG tags. Last time I used those tags, it worked fine. I have no clue as to why this doesn't work. Sorry. Here they are as attachments as well.
 

Attachments

  • TopDownEllipse.jpg
    TopDownEllipse.jpg
    33.3 KB · Views: 1,668
  • SideViewEllipse.jpg
    SideViewEllipse.jpg
    22.6 KB · Views: 1,388
Last edited:
  • #7
Hi,

I have a problem which is quite similar: if you take a picture of a circle with a known radius, depending on the angle of view, the circle will become an ellipse on the picture. The semi-major axis of this ellipse will have the same length as the radius of the original circle. How do you prove it without making the orthographic projection assumption only valid at infinite distance between the camera and the circle (as made in the link above)?

Cheers.
 

Related to Calculating angle of circle to produce given ellipse

1. How do I calculate the angle of a circle to produce a given ellipse?

To calculate the angle of a circle to produce a given ellipse, you will need to use the formula: angle = inverse tangent (semi-minor axis/semi-major axis). This will give you the angle in radians. Make sure to convert to degrees if needed.

2. What is the difference between a circle and an ellipse?

A circle is a shape with a constant radius, where all points on the circumference are equidistant from the center. An ellipse, on the other hand, has two different radii, known as the semi-major axis and semi-minor axis. The sum of these two radii is constant for all points on the ellipse.

3. Why is it important to calculate the angle of a circle for a given ellipse?

Calculating the angle of a circle for a given ellipse allows us to plot the ellipse accurately on a graph. It also helps us understand the relationship between the two shapes and how they are related geometrically.

4. Can the angle of a circle be negative?

No, the angle of a circle cannot be negative. It is always measured in a counterclockwise direction from the positive x-axis. If the result from the calculation is negative, make sure to add 2π radians (or 360 degrees) to get the positive angle.

5. What other methods can be used to calculate the angle of a circle for a given ellipse?

Other methods that can be used to calculate the angle of a circle for a given ellipse include using trigonometric ratios, such as sine, cosine, and tangent, as well as using the eccentricity of the ellipse. These methods may be more complex but can provide more accurate results for more complicated ellipses.

Similar threads

Replies
1
Views
2K
  • Precalculus Mathematics Homework Help
Replies
11
Views
2K
Replies
2
Views
2K
  • Precalculus Mathematics Homework Help
Replies
2
Views
2K
  • Calculus and Beyond Homework Help
Replies
8
Views
2K
  • Introductory Physics Homework Help
Replies
3
Views
407
Replies
6
Views
2K
  • DIY Projects
Replies
6
Views
3K
Back
Top