PDA

View Full Version : need help from you math wizards


gutted
10-29-08, 08:46 PM
i need some math help.

basically im going to rewrite the speed calc program i made some time ago.
http://files.filefront.com/SH4+Speed+Calcexe/;9641405;/fileinfo.html


new feature one is to grab the names & lengths of ships automatically from your game files so that they will always be up to date instead of hard wired into the program like before.

feature 2 is going to be AOB determination using the tick marks in the scope.

basically, you'll be able to get his AOB by entering his range and the number of tick marks from center to bow. but the math is throwing me off.

i know how to get his "apparent" length. but how to comapre that with his real length to get an AOB is giving me the prob.


apparent length = SIN(a) * range

where 'a' = number of ticks across from tail to nose * degree of each tick
(degrees per tick for given zoom levels will be configurable incase you dont run stock stuff and also to make it SH3 GWX friendly).

'a' would naturally be times 2 behind the scenes for center to bow input.

here's example im figuring from in a test mission:

real length = 78.5m
apparent length at 886m = 48.7m

real AOB using map contacts enabled = 34 starboard

how to translate the difference in lengths to that AOB with a formula?

i know its probably something stupid easy.. but im having a mental fart right now.

in some targeting manual i saw (cant remember which one), the author took the ratio of mast height to length and the ratio of vertical to horizontal ticks to get a percentage the apparent ratio is to the real ratio and used it in some scale he provided to get the AOB.. but what formula would that scale be based on?

i can do the same thing (without the use of the mast heights) and getting the percentage of the real length that the apparent length is... and using that in the scale he provided. i just dont know the math involved in that final conversion to AOB.

help meh. i wont sleep till i know it. im that obsessive. lol.


[edit] i plan to put a little 4-way widget so that the AOB direction gets determined correctly by letting you flip around a picture of a ship so that it is facing left or right and is either pointing to or from you.

SteamWake
10-29-08, 08:50 PM
Wow... hope you get this worked out... sounds sweet. :rock:

gutted
10-29-08, 09:05 PM
what i really want to do is to create a whiz wheel for this.


as seen in that uber u-boat periscope mod for GWX; which was half ported to u-boat addon in SH4. my main motivation for this is that i like the idea of it.. but it's just too obtrusive and hard to read the small tick marks he put in the scope (maybe im just getting old). it also completely removes the use of your stadimeter in SH3. gah! i prefer the stock scopes and tick marks. plus my method would remove the need of wasting time having to first align his vertical ticks to his mast height because you'll be using the stadimeter to get his range before hand.

basically you'd rotate a range ring on the wheel to line up with the ships real length.. then look at the tick scale ring on the inside to get his AOB.

but, i have no experience in making those kinds of wheels yet.. so i will start simple with a calculator. i know how the wheel would function..i just dont know how to determine the progressively growing distances between ticks around a radius accurately enough to make it useable. i'm guessing those guys use CAD programs maybe?

gutted
10-29-08, 10:05 PM
think i may have figured it out for my test case

appaarent 48.7m length is 62% of the real 78.5m

since im trying to find the AOB FROM 90 (ship real length is at 90) instead of TO 90 (as i was doing before) i need to take the opposite of 62%

100 - 62 = 38%

38% of 90 = 34 AOB

the exact value i measured in the nav map with the contacts turned on.

weeee!

i knew it was something stupid i was overlooking. i was going in the wrong direction !!#$

now i just need to test the math in a few more cases to make sure its right.. then to cut the math down to it's simplest formula. then put in some special cases for when the ship is pointing away from you instead of towards you so it adds it to 90 instead of subtracts and im golden.

gutted
10-29-08, 11:27 PM
after some testing.. using the ratio of real length to mast height vs. apparent length to mast height yields far more consistent results.

after checking a ship stationary in front of me at direct 90 AOB. the number of ticks he should have been in length was off.

i was doing my tests in SH3 GWX, because thats what i've been playing lately... and a supposed 140.5m ship was off in length by almost 3 ticks (1.5 in both diections) on the scope.

i checked and re-checked. and even worked backwards. his 140.5m length at that range should have been 6 ticks from center to bow. but he was showing as 7.5 ticks in the scope.

maybe this was just an issue for that ship or this mod.. i dunno.

but when i calculated the ratio of real mast height to real length... then calculated the ratio of apparent mast height to apparent length. i got a near 90AOB calculation off by +- 2 degrees.

his real mast/length was a ratio of 3.38
his apparent mast/length ratio of 3.33

apparent is 98% of real in this case. which comes to an error of about 1.8 degrees of AOB.

note i was actually just ever so slightly off to one side of the target due to not being able to place myself exactly 90 AOB in the mission editor.

so i think when i do get around to making this utility i will grab the mast height also when i grab the lengths of the ship from the game files.. and do the calculations that way. which means you'll have to input ticks high and ticks long from center.

not even sure i'd use this that much because i usually just do two plots on the map and figure out his AOB that way..but it would be nice to crosscheck.

IronPerch
10-30-08, 04:40 AM
new feature one is to grab the names & lengths of ships automatically from your game files

A bit out of the actual topic, but can you point me those files with ship lengths? I'd like to add the length information to my recognition manual.

Nisgeis
10-30-08, 05:02 AM
The percentage doesn't quite work, e.g. An AoB of 30 degrees on a target 1000 feet in length will give an apparent length of 500 feet. 500/1000 = 50%, 90*50% = 45 degrees.

If you know both the apparent length and the actual length, the following maths applies:

Opposite Side = Hypotenuse * Sin(angle),

Therefore:

Sin(Angle) = Opposite Side / Hypotenuse

Hypotenuse is the Actual Length, Opposite Side is the Apparent Length, so:

Sin(Angle) = Apparent Length / Actual Length,

Therefore:

Angle = Inv Sin(Apparent Length / Actual Length)



So, for your example of 48.7m apparent length and real length of 78.5m:

inv sin(48.7/78.5) = 38.34 degrees.

And for the 1000 feet target appearing to be 500 feet:

inv sin (500/1000) = 30 degrees.



To get the angular target length directly, the following formula applies:

Angular Length = (Target length in feet/100) * (2000 / Range in Yards)

Therefore, if you know the range is 4000 yards, a target of 1000 feet long if at an AoB of 90 (to get the largest angular length, equivalent to the actual length) then the length is:

(1000/100) * (2000/4000) =
10 * 0.5 = 5 degrees

So a target at a range of 4,000 yards that is 1,000 feet in length if broadside on will fill 5 degrees worth of markings. This value can then be compared against the observed angular length, by counting ticks and then both the values can be taken and plugged into the previous formula.

So, for example, your 1,000 foot long ship at 4,000 yards appears to be 2.5 degree wide, then the formula for AoB is:

Angle = Inv Sin(Apparent Length / Actual Length)

So,

Inv Sin(2.5 / 5) = 30 degrees.

Hope that helps.

Hitman
10-30-08, 08:10 AM
what i really want to do is to create a whiz wheel for this.


as seen in that uber u-boat periscope mod for GWX; which was half ported to u-boat addon in SH4. my main motivation for this is that i like the idea of it.. but it's just too obtrusive and hard to read the small tick marks he put in the scope (maybe im just getting old). it also completely removes the use of your stadimeter in SH3. gah! i prefer the stock scopes and tick marks. plus my method would remove the need of wasting time having to first align his vertical ticks to his mast height because you'll be using the stadimeter to get his range before hand.

basically you'd rotate a range ring on the wheel to line up with the ships real length.. then look at the tick scale ring on the inside to get his AOB.

but, i have no experience in making those kinds of wheels yet.. so i will start simple with a calculator. i know how the wheel would function..i just dont know how to determine the progressively growing distances between ticks around a radius accurately enough to make it useable. i'm guessing those guys use CAD programs maybe?


Doh :doh: why didn't you say that before in the SH3 forum? I had already replied telling you what I do! :88)

What you want has already been done:

http://www.subsim.com/radioroom/showthread.php?t=116542 (http://www.subsim.com/radioroom/showthread.php?t=116542&highlight=aspect+ratio)

gutted
10-30-08, 03:40 PM
thanks nisgeis. i kept having the feeling i was still off after i quit playing with it last night. and it seems i was.


and hitman, yeah i wish i had come across that earlier. now i can quit playing with this lol. instead i'll just use the wheel you made.. and then mod in the aspect ratios into my rec manual to keep from having to do it everytime.

still nice to know the math involved though. cheers to both of you.

Webster
10-31-08, 03:34 PM
new feature one is to grab the names & lengths of ships automatically from your game files

A bit out of the actual topic, but can you point me those files with ship lengths? I'd like to add the length information to my recognition manual.

check the cgf file inside each ships folder, im pretty sure its there you find ship length.