Angular Quantities and Torque Calculations¶
Try it live on Compiler Explorer
Overview¶
Angular mechanics requires careful handling of angles, angular positions, and angular-dependent quantities like torque. This example demonstrates using the dedicated ISQ angular system to calculate torque from force, lever arm position, and angle with proper dimensional analysis.
Key Concepts¶
The ISQ Angular System¶
The library provides isq_angle, an alternative ISQ system that treats angles as
dimensional quantities rather than dimensionless:
using namespace mp_units;
using namespace mp_units::si::unit_symbols;
using mp_units::angular::unit_symbols::deg;
using mp_units::angular::unit_symbols::rad;
const quantity lever = isq_angle::position_vector(20 * cm);
const quantity force = isq_angle::force(500 * N);
const quantity angle = isq_angle::angular_measure(90. * deg);
const quantity torque = isq_angle::torque(lever * force * angular::sin(angle) / (1 * isq_angle::cotes_angle));
In this system:
isq_angle::position_vectorrepresents a position with angular dependenceisq_angle::forcerepresents force with angular considerationsisq_angle::angular_measureexplicitly represents angles (not dimensionless)isq_angle::torquehas dimensions that include angular components
Dimensional Torque Calculation¶
The torque formula τ = r × F × sin(θ) is implemented with full dimensional checking:
const quantity torque = isq_angle::torque(lever * force * angular::sin(angle) / (1 * isq_angle::cotes_angle));
The division by cotes_angle normalizes the angular measure to work correctly with
the dimensional analysis system, ensuring that the resulting torque has the proper
dimensions.
Working with Angles as Quantities¶
Unlike treating angles as dimensionless (radians as pure numbers), this approach makes angles first-class quantities:
This enables:
- Compile-time checking that angles are used correctly
- Explicit conversion between angle units (degrees, radians, etc.)
- Prevention of accidentally treating angles as scalars
Output Formatting¶
The result is displayed with explicit angular units:
std::cout << "Applying a perpendicular force of " << force << " to a " << lever << " long lever results in "
Sample Output:
Why This Matters¶
- Dimensional Correctness: Angles are strong quantities, not just numbers — this system enforces that
- Rotational Mechanics: Essential for robotics, mechanical engineering, aerospace applications
- Type Safety: Prevents mixing angular and linear quantities inappropriately
- ISQ Compliance: Follows international standards for quantity systems
Alternative Approach¶
For simpler cases where angles can be treated as dimensionless, the standard isq system
can be used. The isq_angle system is valuable when you need stronger type checking for
angular quantities or when working with standards that treat angles dimensionally.
Related Concepts¶
- Angular velocity and acceleration
- Moment of inertia
- Angular momentum
- Rotational kinetic energy
All of these benefit from treating angles as dimensional quantities rather than pure scalars.
For more details on the theoretical background and design decisions, see the Strong Angular System chapter in the user's guide.