Add Circle::transform

This commit is contained in:
Hanno Braun 2024-09-24 19:48:27 +02:00
parent 4772a55091
commit 3a7d2ed4ce
2 changed files with 9 additions and 4 deletions

View File

@ -63,9 +63,7 @@ impl Path<3> {
#[must_use]
pub fn transform(self, transform: &Transform) -> Self {
match self {
Self::Circle(curve) => {
Self::Circle(transform.transform_circle(&curve))
}
Self::Circle(curve) => Self::Circle(curve.transform(transform)),
Self::Line(curve) => Self::Line(transform.transform_line(&curve)),
}
}

View File

@ -1,6 +1,6 @@
use approx::AbsDiffEq;
use crate::{Aabb, Point, Scalar, Vector};
use crate::{Aabb, Point, Scalar, Transform, Vector};
/// An n-dimensional circle
///
@ -163,6 +163,13 @@ impl<const D: usize> Circle<D> {
}
}
impl Circle<3> {
/// # Transform the circle
pub fn transform(&self, transform: &Transform) -> Self {
transform.transform_circle(self)
}
}
impl<const D: usize> approx::AbsDiffEq for Circle<D> {
type Epsilon = <Scalar as approx::AbsDiffEq>::Epsilon;