PDA

View Full Version : XML Backup Attitude Scale Ratio



N66FC Raptor
04-26-2006, 10:36 PM
Hello everyone,
I need help with determining the Precise <Scale Y=" "/> ratio in the default Lear 45 Backup Attitude gauge. The entire code for this XML gauge can be viewed at http://www.kgz.shawbiz.ca/tutorials/xml/examples/xml00001.html but the area I'm have trouble with is as follows:

&lt;Shift&gt;
&lt;Value Minimum=&quot;-90&quot; <Scale YMaximum=&quot;90&quot;&gt;(A:Attitude indicator pitch degrees, degrees) /-/&lt;/Value&gt;
&lt;Scale Y=&quot;4&quot;/&gt;
&lt;/Shift&gt;

&quot;Here we see a value line that generates a number in the range of -90 to +90. Notice the &lt;Scale Y=&quot;4&quot;/&gt; instruction. Without this, the bitmap controlled would move the number of pixels being generated by the value line, from a datum position. This is fairly restrictive, so to give it total flexibility, the scale instruction is used. The Y character tells the bitmap to move in the Y direction (up and down). This could be an X character and produce sideway movement. The Y=&quot;4&quot; multiplies the value generated by 4. So if the positive maximum of 90 is generated, the bitmap will move 4x90=360 pixels.&quot;

The above code is from http://www.fs2x.com/ Tutorial Chapter 1: Main Body Sections

Details of the post may also be viewed at: http://www.kgz.shawbiz.ca/tutorials/xml/backup_attitude_gauge.html

n4gix
04-27-2006, 02:02 PM
Determining the scalar factor is simple...

Measure (in Photoshop) the number of pixels for the range.

Divide this number by the variable's range.

For example:

260 pixels for 0 to 300 variable range

260/300 = .86666 scaling factor

540 pixels for a 100 to 1500 variable range

540/(1500-100) = .3857142

N66FC Raptor
04-28-2006, 05:26 AM
The bitmap size is
100 pixels by
354 pixels as shown in the following XML code:[br]


&lt;Image Name=&quot;backup_attitude_number_strip.bmp&quot; ImageSizes=&quot;100,354&quot;&gt;[br]

You can view the complete code here.[br]

I have two variable ranges to choose from:




0 to
300

100 to
1500



The Variable range for an Attitude Indicator is
90 (uses equal values for both positive (
+90) and negative (
-90) values), which falls into the
0 to
300 variable range. The measurement on the bitmap from
+90 to
-90 using Photoshop, in pixels, is
218 (286-68=218). Using the
0 to
300 variable range, the precise scalar for this bitmap is:




218/180 = 1.21111

(218/2)/(180/2) = 1.21111[br]
- or simply -

109/90 = 1.21111



Thank-you Bill! The updated XML code can be viewed here, and this also leads to several new questions concering this particular gauge.


Note: When I first looked at the PDF document I may have misunderstood what was actually being stated. What I mean is, when you look at the example the document provides:[br]



&lt;Value Minimum=&quot;-90&quot; Maximum=&quot;90&quot;&gt;(A:Attitude indicator pitch degrees, degrees) /-/&lt;/Value&gt;


and continue reading till you see &quot;the bitmap will move
4x90=360 pixels.&quot;, I first noticed the
4x90=360 and not the pixels part of the statement. My error was that I was thinking
360 degrees (because of the
degrees, degrees in the code I had degrees in my train of thought), not
360 pixels. A little confusing for example figures to use, but that's what happened (I think) .. lol


Question? The new scalar of
1.21111 is a repeating number. How many digits should I enter, following the decimal, for the new XML
&lt;Scale Y=&quot;1.21111&quot;/&gt; scalar, or any other repeating value(s) that I may find in other gauges?


Question? Are there any other Variable Ranges for calculating the scalar factor?

n4gix
04-28-2006, 02:06 PM
For FS gauge purposes, two decimal precision is sufficient, thus Scale Y="1.21" should be adequate.

The only time you need be concerned about "ranges" in any guage is if the scale used is non-linear.

A good example might be an airspeed tape, where the segment from 0 to 100 is say, 235 px, but the segment from 100 to 300 is 180 px.

The reason for the non-linearity is that at lower speeds greater precision is required... ;)

In such a case, you would divide the movement into two sections of code, using the appropriate scalar for each section, e.g.:

0 - 100 = 2.35 px/knot

100 - 300 = 1.11 px/knot