3.3 KiB
tags
| tags | |||||||
|---|---|---|---|---|---|---|---|
|
Angular Quantities and Torque Calculations
Try it live on Compiler Explorer{ .md-button }
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:
--8<-- "example/strong_angular_quantities.cpp:42:50"
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:
--8<-- "example/strong_angular_quantities.cpp:50:50"
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:
const quantity angle = isq_angle::angular_measure(90. * deg);
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:
--8<-- "example/strong_angular_quantities.cpp:51:52"
Sample Output:
Applying a perpendicular force of 500 N to a 20 cm long lever results in 100 m N/rad of torque.
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.