Method: TelemetryProcessor.get_tilt

Defined in:
lib/kamelopard/helpers.rb

.get_tilt(p) ⇒ Object



285
286
287
288
289
290
291
292
293
294
# File 'lib/kamelopard/helpers.rb', line 285

def TelemetryProcessor.get_tilt(p)
    x1, y1, z1, x2, y2, z2 = [ p[1][0], p[1][1], p[1][2], p[2][0], p[2][1], p[2][2] ]
    smoothing_factor = 10.0
    dist = get_dist3(x1, y1, z1, x2, y2, z2)
    dist = dist + 1
            # + 1 to avoid setting dist to 0, and having div-by-0 errors later
    t = Math.atan((z2 - z1) / dist) * 180 / Pi / @@options[:exaggerate]
            # the / 2.0 is just because it looked nicer that way
    90.0 + t
end