Field of view and the scanner "V"

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

User avatar
kanthoney
Commodore
Commodore
Posts: 281
Joined: Thu Nov 07, 2013 10:21 pm

Re: Field of view and the scanner "V"

Post 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.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Re: Field of view and the scanner "V"

Post 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.
User avatar
Day
---- E L I T E ----
---- E L I T E ----
Posts: 545
Joined: Tue Mar 03, 2015 11:35 am
Location: Paris

Re: Field of view and the scanner "V"

Post by Day »

Is the oval a mathematical ellipse, or just a scaled circle ?
User avatar
kanthoney
Commodore
Commodore
Posts: 281
Joined: Thu Nov 07, 2013 10:21 pm

Re: Field of view and the scanner "V"

Post by kanthoney »

Sorted in commit 1989319.
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Re: Field of view and the scanner "V"

Post 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.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Re: Field of view and the scanner "V"

Post 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. ;-)
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Field of view and the scanner "V"

Post by Cody »

another_commander wrote:
We value quick and effective customer service.
<chortles> Indeed we do!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Field of view and the scanner "V"

Post by Smivs »

If only we had any quick and effective customers...
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Field of view and the scanner "V"

Post by Cody »

<sniggers>
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
kanthoney
Commodore
Commodore
Posts: 281
Joined: Thu Nov 07, 2013 10:21 pm

Re: Field of view and the scanner "V"

Post 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.
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Field of view and the scanner "V"

Post 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.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Re: Field of view and the scanner "V"

Post by Disembodied »

Smivs wrote:
If only we had any quick and effective customers...
:lol:
User avatar
kanthoney
Commodore
Commodore
Posts: 281
Joined: Thu Nov 07, 2013 10:21 pm

Re: Field of view and the scanner "V"

Post by kanthoney »

New commit: bdfd8cd.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Re: Field of view and the scanner "V"

Post by another_commander »

Image
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Field of view and the scanner "V"

Post by phkb »

Alright! That's amazing guys! Thanks for your persistence and dedication!

Edit: Not to mention awesome maths skillz!
Post Reply