Profile image

A simplified explanation of greater than or less than statements

37.2k V  4.8 years ago

So spef's post on greater than or less than statements are quite complex, and a lot of people really didnt understand it, so to make things simpler, i will explain things in non-mathmetician language, mostly

Think of clamp01( x - y ) as a > statement. "But i want a < statement!" Then just flip the values around, making clamp01( y - x) because x>y = y<x

So lets take take an inverted airbrake for example, you want to do TAS < 1000, since 1000 is greater, flip the values around, making 1000 > TAS. Since clamp01( x - y) is a > statement, you can plug in the values, giving you clamp01(1000 - TAS).

"my craft is going 2000 mph instead of 1000!"
Speed is measured in m/s, so convert your desired speed into meters per second

How does it work? Well the value is clamped between 0 and 1, meaning all values above 1, will be set to 1. So that means if your speed is below a certian point, your value will be a 1, but when it reaches 500, it will go to 0, turning off the airbrake, and as soon as your speed goes back down to 499, you will have a value of 1 again. 500 - 500 = 0, 500 - 499 = 1.