diff --git a/crates/fj-kernel/src/geometry/curves.rs b/crates/fj-kernel/src/geometry/curves.rs index bfa48256a..87c9b5b77 100644 --- a/crates/fj-kernel/src/geometry/curves.rs +++ b/crates/fj-kernel/src/geometry/curves.rs @@ -26,43 +26,6 @@ pub enum Curve { Line(Line), } -impl Curve<3> { - /// Construct a `Curve` that represents the x-axis - pub fn x_axis() -> Self { - Self::Line(Line { - origin: Point::origin(), - direction: Vector::unit_x(), - }) - } - - /// Construct a `Curve` that represents the y-axis - pub fn y_axis() -> Self { - Self::Line(Line { - origin: Point::origin(), - direction: Vector::unit_y(), - }) - } - - /// Construct a `Curve` that represents the z-axis - pub fn z_axis() -> Self { - Self::Line(Line { - origin: Point::origin(), - direction: Vector::unit_z(), - }) - } - - /// Create a new instance that is transformed by `transform` - #[must_use] - pub fn transform(self, transform: &Transform) -> Self { - match self { - Self::Circle(curve) => { - Self::Circle(transform.transform_circle(&curve)) - } - Self::Line(curve) => Self::Line(transform.transform_line(&curve)), - } - } -} - impl Curve { /// Access the origin of the curve's coordinate system pub fn origin(&self) -> Point { @@ -129,6 +92,61 @@ impl Curve { } } +impl Curve<2> { + /// Construct a `Curve` that represents the u-axis + pub fn u_axis() -> Self { + Self::Line(Line { + origin: Point::origin(), + direction: Vector::unit_u(), + }) + } + + /// Construct a `Curve` that represents the v-axis + pub fn v_axis() -> Self { + Self::Line(Line { + origin: Point::origin(), + direction: Vector::unit_v(), + }) + } +} + +impl Curve<3> { + /// Construct a `Curve` that represents the x-axis + pub fn x_axis() -> Self { + Self::Line(Line { + origin: Point::origin(), + direction: Vector::unit_x(), + }) + } + + /// Construct a `Curve` that represents the y-axis + pub fn y_axis() -> Self { + Self::Line(Line { + origin: Point::origin(), + direction: Vector::unit_y(), + }) + } + + /// Construct a `Curve` that represents the z-axis + pub fn z_axis() -> Self { + Self::Line(Line { + origin: Point::origin(), + direction: Vector::unit_z(), + }) + } + + /// Create a new instance that is transformed by `transform` + #[must_use] + pub fn transform(self, transform: &Transform) -> Self { + match self { + Self::Circle(curve) => { + Self::Circle(transform.transform_circle(&curve)) + } + Self::Line(curve) => Self::Line(transform.transform_line(&curve)), + } + } +} + impl fmt::Display for Curve { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self {