- #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 ;)
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 ;)