Jump to content
Sign in to follow this  
Guest Patrick_Waugh

Finding the zero mark on a rotating card

Recommended Posts

Guest Patrick_Waugh

Given a rotating SPRITE, I have been forced to deduce the zero point on the card experimentally. Originally, I had hoped that there zero point is the 3 o'clock position like needles, however this turned out to not be true.I'm betting there is a more direct method given the card's module var value and scale of rotation.For example, if I have a card using the KOHLSMAN_CARD_HG var which reports 29.92 as a starting value, and am using a scale of 60, how would I calculate the angle where to put that mark on the card?I suspected that I would take fmod(kohlsman * 60), but this doesn't seem to be correct either.

Share this post


Link to post
Share on other sites
Guest jimcooper1

Patrick,Why are you using SPRITE for a Kohlsman setting??The Kohlsman value is really a NEEDLE, ie it rotates...surely there is no need to translate it either vertically or horizontally.Can't you use a NEEDLE then place a STATIC image above it with a transparent mask for the Kohlsman to show through?RegardsJim

Share this post


Link to post
Share on other sites
Guest jimcooper1

Patrick If you do go for a SPRITE. Put your 29.92 in the 3 o'clock position.You will need to check on your BITMAP what angle there is between 29.92 and 29.93.. Lets say its 5 degrees. In your callback function you need to check the Kohlsman value. Lets say it 29.96..that means you have to rotate your card -20 degrees (2092-2096)*5 = -20So your callback function will return the value -20 and the card will rotate 20 degrees anti-clockwiseRegardsJim

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

I don't rotate the card, I let the sim do that. The point is to find the zero position the sim is using.However, I figured it out... my original thought was correct.You take 29.92, multiply by your scaling factor, and then mod by 360. ( 29.92 * 60 ) mod 360 = 355.2Now, subtract 360 once more: 355.2 - 360 = -4.8 degsAnd so the zero point is 4.8 CCW from the 3 o'clock position given this scaling and var.

Share this post


Link to post
Share on other sites

Being a simple fool, I've always used a "needle element" to represent the rotating card... thus...return KOHLSMAN_SETTING_HGvar.var_value.n ; in my needle's callback is sufficient for my needs, when used with the non-linearity table:NONLINEARITY ALT_KohlsmanCard[] = {{{246,46}, 29.4, 0},{{280,69}, 29.5, 0},{{307,160}, 29.6, 0},{{324,146}, 29.7, 0},{{332,175}, 29.8, 0},{{329,216}, 29.9, 0},{{315,154}, 30.0, 0},{{293,188}, 30.1, 0},{{262,314}, 30.2, 0},{{226,332}, 30.3, 0},{{185,339}, 30.4, 0},{{145,335}, 30.5, 0},};


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest jimcooper1

>Being a simple fool...Bill, thats 2 lies in only 4 words...and you a man of the cloth..tut tut!JimPS: assuming that your Kohlsman readings are evenly spaced you could simplify your non-linearity table to first and last valueNONLINEARITY ALT_KohlsmanCard[] = {{{246,46}, 29.4, 0},{{145,335}, 30.5, 0},};

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

Haha. There I go again using a jack hammer. =)That is too funny. Great idea to use the needle macro since it doesn't move in x or y, makes more sense. For my tiny brain, it should have been called MAKE_ROTATE =)

Share this post


Link to post
Share on other sites
Guest jimcooper1

>Great idea to use the needle macro since>it doesn't move in x or y, makes more sense. Yeah! not a bad idea from someone who (apparently) has never got an altimeter to work!!

Share this post


Link to post
Share on other sites

>>Being a simple fool...>>Bill, thats 2 lies in only 4 words...and you a man of the>cloth..tut tut!>>Jim>>PS: assuming that your Kohlsman readings are evenly spaced>you could simplify your non-linearity table to first and last>value>>NONLINEARITY ALT_KohlsmanCard[] = {>{{246,46}, 29.4, 0},>{{145,335}, 30.5, 0},>};Really? Since I am indeed a "fool," and am likewise "simple," that leaves only "Being" and "a" as the questionable words......since I'm (apparently) not dead, I'm fairly confident in my state of "Being(ness)." I suppose it might be argued that since "me, myself and I" are an imperfect trinity, the "a" might be incorrect might be construed as ontologically a lie, although gramatically it is entire proper! :)Yes, the non-linearity table could be simplified...


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

>Haha. There I go again using a jack hammer. =)>>That is too funny. Great idea to use the needle macro since>it doesn't move in x or y, makes more sense. For my tiny>brain, it should have been called MAKE_ROTATE =)Feel free to edit your fsgauges.h to whatever makes you happiest! ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

Actually, there is a reason that I used a SPRITE too... I am using a mask to allow me to do some other things. =)

Share this post


Link to post
Share on other sites

>Actually, there is a reason that I used a SPRITE too... I am>using a mask to allow me to do some other things. =)>Actually, for reasons unrelated to any visual effect, there is an excellent reason for using a SPRITE with its mask:...in the VC, elements such as a compass dial tend to "deform" when the corners of the square bitmap are rotated outside the bounds of the background image.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

Bill,Thanks for this tip. I had just finished the VOR2 using the NEEDLE vs. the SPRITE as an exercise, and to reduce the number of bitmaps.I did so after also noticing that MS's gauge must use NEEDLE due to the lack of a mask in their .dll.Now, before converting the ADF to NEEDLE (if I ever get around to that anyway), I'll check them both out in the VC to make sure they look ok, and use the SPRITE if this effect is noticable.

Share this post


Link to post
Share on other sites

>I did so after also noticing that MS's gauge must use NEEDLE>due to the lack of a mask in their .dll.Which gauge set? The two VORs in the c172 gauge set both have masks for the compass card:VOR2#7026.....compass card#7027.....compass card mask#7526.....compass card hi res#7527.....compass card mask hi resVOR1#7037.....compass ring#7038.....compass ring mask#7537.....compass ring hi res#7538.....compass ring mask hi res...and of course the "night time versions" of both lo res and hi res graphics as well... ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

The B206 gauge set. =)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...