Inverse cosine
Find an angle from the ratio of horizontal reach to sloping length. The returned angle is in radians.
std.math.acos
Simple example
Find the angle for this ratio.
Start1
Result0
const std = @import("std");
pub fn main() !void {
std.debug.print("{d}\n", .{std.math.acos(@as(f64, 1.0))});
}
0
Advertisements
Everyday examples
A shelf support reaches horizontally half its length. What angle does it make?
Start0.5
Result1.0471975511965979
const std = @import("std");
pub fn main() !void {
std.debug.print("{d}\n", .{std.math.acos(@as(f64, 0.5))});
}
1.0471975511965979
A drawing shows a flat arm reaching its full length horizontally. What is its angle?
Start1
Result0
const std = @import("std");
pub fn main() !void {
std.debug.print("{d}\n", .{std.math.acos(@as(f64, 1.0))});
}
0
A model tower points straight up. Its horizontal reach is zero. What is its angle?
Start0
Result1.5707963267948966
const std = @import("std");
pub fn main() !void {
std.debug.print("{d}\n", .{std.math.acos(@as(f64, 0.0))});
}
1.5707963267948966