Sine
For a right triangle, sine links an angle to the side opposite it. A 30-degree angle is about 0.5236 radians. Supply the angle in radians, then multiply by the sloping length to find the rise.
@sin
Simple example
Use an angle of zero radians.
Start0
Result0
const std = @import("std");
pub fn main() !void {
std.debug.print("{d}\n", .{@sin(@as(f64, 0.0))});
}
0
Advertisements
Everyday examples
A scale drawing shows a four-metre ladder at 30 degrees to the ground. How high is its top in metres?
Start0.5235987755982988
Result1.9999999999999998
const std = @import("std");
pub fn main() !void {
std.debug.print("{d}\n", .{4.0 * @sin(@as(f64, 0.5235987755982988))});
}
1.9999999999999998
A Ferris wheel has an eight-metre radius. The hub is ten metres above the ground. When the cabin is 30 degrees above the horizontal, how high is it above the ground?
Start0.5235987755982988
Result14
const std = @import("std");
pub fn main() !void {
std.debug.print("{d}\n", .{10.0 + 8.0 * @sin(@as(f64, 0.5235987755982988))});
}
14
A two-metre model ramp rises at 30 degrees. How many metres does it rise?
Start0.5235987755982988
Result0.9999999999999999
const std = @import("std");
pub fn main() !void {
std.debug.print("{d}\n", .{2.0 * @sin(@as(f64, 0.5235987755982988))});
}
0.9999999999999999