Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace fj_kernel's Circle with fj_math::Circle #578

Merged
merged 2 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/fj-kernel/src/algorithms/approx/curves.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::cmp::max;

use fj_math::Scalar;
use fj_math::{Circle, Scalar};

use crate::geometry::{self, Circle, Curve};
use crate::geometry::{self, Curve};

use super::Tolerance;

Expand Down Expand Up @@ -36,7 +36,7 @@ pub fn approx_curve(
/// `tolerance` specifies how much the approximation is allowed to deviate
/// from the circle.
pub fn approx_circle(
circle: &Circle,
circle: &Circle<3>,
tolerance: Tolerance,
out: &mut Vec<geometry::Point<1>>,
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
mod circle;

pub use self::circle::Circle;

use fj_math::{Line, Point, Transform, Vector};
use fj_math::{Circle, Line, Point, Transform, Vector};

use crate::geometry;

Expand All @@ -18,7 +14,7 @@ use crate::geometry;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub enum Curve {
/// A circle
Circle(Circle),
Circle(Circle<3>),

/// A line
Line(Line<3>),
Expand Down Expand Up @@ -52,7 +48,7 @@ impl Curve {
/// Access the origin of the curve's coordinate system
pub fn origin(&self) -> Point<3> {
match self {
Self::Circle(curve) => curve.origin(),
Self::Circle(curve) => curve.center,
Self::Line(curve) => curve.origin,
}
}
Expand All @@ -70,7 +66,9 @@ impl Curve {
#[must_use]
pub fn transform(self, transform: &Transform) -> Self {
match self {
Self::Circle(curve) => Self::Circle(curve.transform(transform)),
Self::Circle(curve) => {
Self::Circle(transform.transform_circle(&curve))
}
Self::Line(curve) => Self::Line(transform.transform_line(&curve)),
}
}
Expand Down
125 changes: 0 additions & 125 deletions crates/fj-kernel/src/geometry/curves/circle.rs

This file was deleted.

2 changes: 1 addition & 1 deletion crates/fj-kernel/src/geometry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mod points;
mod surfaces;

pub use self::{
curves::{Circle, Curve},
curves::Curve,
points::Point,
surfaces::{Surface, SweptCurve},
};
4 changes: 2 additions & 2 deletions crates/fj-kernel/src/topology/builder.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use fj_math::{Line, Point, Scalar, Vector};
use fj_math::{Circle, Line, Point, Scalar, Vector};

use crate::{
geometry::{Circle, Curve, Surface},
geometry::{Curve, Surface},
shape::{Handle, Shape, ValidationResult},
};

Expand Down