Page 2 of 3

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 8:51 am
by kanthoney
another_commander wrote:
@phkb: I am at work and can't test, but I am almost convinced that the solution here is to adjust the drawing of the V so that its x-axis coordinates (or y-axis if viewing port/starboard) get multiplied by the FOV fraction representation.

Can you please try this? Inside HeadUpDisplay.m, find the drawScannerGrid function. At the top there are these two lines:

Code: Select all

GLfloat w2 = 0.250 * siz.width;
GLfloat h2 = 0.250 * siz.height;
Change them to

Code: Select all

GLfloat w2 = [[UNIVERSE gameView] fov:YES] * siz.width / 2.0;
GLfloat h2 = [[UNIVERSE gameView] fov:YES] * siz.height / 2.0;
Does this fix it for you? If yes, we can push it to trunk.
I think that would cause the ends of the V not to join up with the oval. We might have to break out the trig on this one.

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 8:55 am
by another_commander
kanthoney wrote:
I think that would cause the ends of the V not to join up with the oval. We might have to break out the trig on this one.
Correct, but the ends don't join up in the standard 57 degrees either. I don't think it's such a big deal to require trigonometry intervention, but wouldn't mind it seeing with V-ends joining nicely either.

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 9:36 am
by Day
Is the oval a mathematical ellipse, or just a scaled circle ?

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 12:22 pm
by kanthoney
Sorted in commit 1989319.

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 12:51 pm
by Disembodied
This is pretty amazing, really: something has been queried, misunderstood, carefully explained to the hard of thinking, considered by more agile minds, discussed, and sorted, all within 48 hours.

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 12:56 pm
by another_commander
kanthoney wrote:
Sorted in commit 1989319.
Nice, but not quite there yet. It malfunctions for aspect ratios less than 4:3. I sketched up this during lunch break (but it doesn't try to make the V fit nicely on the oval):

Code: Select all

MyOpenGLView* gameView = [UNIVERSE gameView];
GLfloat aspect = [gameView viewSize].width / [gameView viewSize].height;
GLfloat fieldOfView = [gameView fov:YES];
GLfloat const criticalAspect = 4.0 / 3.0;
// make sure that the scanner "V" takes FOV into account
GLfloat w2 = fieldOfView / 2.0 * siz.width;
GLfloat h2 = fieldOfView / 2.0 * siz.height;

if (aspect < criticalAspect)
{
	w2 *= aspect / criticalAspect;
	h2 *= aspect / criticalAspect;
}
@Disembodied: We value quick and effective customer service. ;-)

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 1:03 pm
by Cody
another_commander wrote:
We value quick and effective customer service.
<chortles> Indeed we do!

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 1:19 pm
by Smivs
If only we had any quick and effective customers...

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 1:20 pm
by Cody
<sniggers>

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 1:34 pm
by kanthoney
I knew you'd find something wrong with it :evil:

I think we just need to multiply tanfov by 4/(3*aspect) if aspect < 4:3, but I'm back at work so can't test until later.

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 1:43 pm
by Diziet Sma
Disembodied wrote:
This is pretty amazing, really: something has been queried, misunderstood, carefully explained to the hard of thinking, considered by more agile minds, discussed, and sorted, all within 48 hours.
The really funny thing is, this is such a typical event with Oolite that we sometimes almost take it for granted.

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 2:37 pm
by Disembodied
Smivs wrote:
If only we had any quick and effective customers...
:lol:

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 4:20 pm
by kanthoney
New commit: bdfd8cd.

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 6:34 pm
by another_commander
Image

Re: Field of view and the scanner "V"

Posted: Mon Jul 27, 2015 10:36 pm
by phkb
Alright! That's amazing guys! Thanks for your persistence and dedication!

Edit: Not to mention awesome maths skillz!