# GDI+ Nonlinearity Needles (C++)

## Recommended Posts

Hello at all!I have one Question: has anyone figured out or could anyone explain me how to Setup nonlinearity Needles in GDI+ Gauges using C++? My linearity Transformations working fine but i have no Idea how to make this for Nonlineraity. I want to draw a Needle for the Vertical Speed (Values in Range +- 6000ft) similar to the Airbus or Boeing PFD's.Thanks for your Help.RegardsSven

##### Share on other sites
 Help AVSIM continue to serve you!Please donate today!

>Hello at all!>>I have one Question: has anyone figured out or could anyone>explain me how to Setup nonlinearity Needles in GDI+ Gauges>using C++? My linearity Transformations working fine but i>have no Idea how to make this for Nonlineraity. I want to draw>a Needle for the Vertical Speed (Values in Range +- 6000ft)>similar to the Airbus or Boeing PFD's.>>Thanks for your Help.>>Regards>SvenIn the easiest case the scale will be split up into linear parts, depends on the type of aircraft you are modelling obviously. That way you could just define an if-construction, like:if VS between -1000 and 1000, move needle at (fictious) speed 3if VS between 1000 and 3000, move needle at speed 2 (same for negative values)if VS between 3000 and 6000, move needle at speed 1Cheers, :-beerchugEtienne :-wave

##### Share on other sites

In GDI+ (as well as XML "vector drawing") movement is accomplished by shifting x and/or y coordinate values by some calculated factor.For example, if you need to shift the x coordinate from 0 to 1000, and the total "distance in pixels" between 0 and 1000 is say, 300, then you will need to calculate the appropriate factor by dividing delta-pixels by the delta-value:300pix / 1000ft-min = 0.3 pix per ft-minIf the next range from 1000 to 2000 is only 200 pixels, then the factor becomes:200pix / 1000ft-min = 0.2 pix per ft-minAlternatively, you can use a similar method to calculate a rotational factor based on the degree of rotation needed for each non-linear portion of your scale.

##### Share on other sites

Exactly, this is some explanation for my arbitrary "speed" value. :-smooch

## Create an account

Register a new account

• Tom Allensworth,
Founder of AVSIM Online

• ### Hot Spots

• 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!