Inverse tangent
Find the angle of a slope from rise divided by horizontal run. The result is in radians.
std.math.atan
Simple example
Find the angle for this ratio.
Start0
Result0
const std = @import("std");
pub fn main() !void {
std.debug.print("{d}\n", .{std.math.atan(@as(f64, 0.0))});
}
0
Advertisements
Everyday examples
A model road rises one metre for each horizontal metre. What is its angle?
Start1
Result0.7853981633974483
const std = @import("std");
pub fn main() !void {
std.debug.print("{d}\n", .{std.math.atan(@as(f64, 1.0))});
}
0.7853981633974483
A drawing shows a rise of one metre for every two across. What angle should be marked?
Start0.5
Result0.4636476090008061
const std = @import("std");
pub fn main() !void {
std.debug.print("{d}\n", .{std.math.atan(@as(f64, 0.5))});
}
0.4636476090008061
A flat path has zero rise per metre. What is its angle?
Start0
Result0
const std = @import("std");
pub fn main() !void {
std.debug.print("{d}\n", .{std.math.atan(@as(f64, 0.0))});
}
0