Rot2
Rot2
- cos : f32
- sin : f32
Description
A counterclockwise 2D rotation.
Example
# use approx::assert_relative_eq; # use bevy_math::{Rot2, Vec2}; use std::f32::consts::PI; // Create rotations from radians or degrees let rotation1 = Rot2::radians(PI / 2.0); let rotation2 = Rot2::degrees(45.0); // Get the angle back as radians or degrees assert_eq!(rotation1.as_degrees(), 90.0); assert_eq!(rotation2.as_radians(), PI / 4.0); // "Add" rotations together using `*` assert_relative_eq!(rotation1 * rotation2, Rot2::degrees(135.0)); // Rotate vectors assert_relative_eq!(rotation1 * Vec2::X, Vec2::Y);