Skip to content

Commit

Permalink
Use Angle type anywhere a raw f64 angle was used previously.
Browse files Browse the repository at this point in the history
Most likely many places have been missed since
  • Loading branch information
gabsi26 committed May 23, 2022
1 parent 9740397 commit 4338fdf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/fj-operations/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ impl ToShape for fj::Transform {
fn transform(transform: &fj::Transform) -> Transform {
let axis = Vector::from(transform.axis).normalize();
Transform::translation(transform.offset)
* Transform::rotation(axis * transform.angle)
* Transform::rotation(axis * transform.angle.rad())
}
4 changes: 2 additions & 2 deletions crates/fj/src/shape_3d.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{Shape, Shape2d};
use crate::{Angle, Shape, Shape2d};

/// A 3-dimensional shape
#[derive(Clone, Debug)]
Expand Down Expand Up @@ -72,7 +72,7 @@ pub struct Transform {
pub axis: [f64; 3],

/// The angle of the rotation
pub angle: f64,
pub angle: Angle,

/// The offset of the translation
pub offset: [f64; 3],
Expand Down
6 changes: 3 additions & 3 deletions crates/fj/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub trait Transform {
///
/// Create a rotation that rotates `shape` by `angle` around an axis defined
/// by `axis`.
fn rotate(&self, axis: [f64; 3], angle: f64) -> crate::Transform;
fn rotate(&self, axis: [f64; 3], angle: crate::Angle) -> crate::Transform;

/// Create a translation
///
Expand All @@ -111,7 +111,7 @@ impl<T> Transform for T
where
T: Clone + Into<crate::Shape3d>,
{
fn rotate(&self, axis: [f64; 3], angle: f64) -> crate::Transform {
fn rotate(&self, axis: [f64; 3], angle: crate::Angle) -> crate::Transform {
let shape = self.clone().into();
crate::Transform {
shape,
Expand All @@ -126,7 +126,7 @@ where
crate::Transform {
shape,
axis: [1., 0., 0.],
angle: 0.,
angle: crate::Angle::from_rad(0.),
offset,
}
}
Expand Down

0 comments on commit 4338fdf

Please sign in to comment.