From 355faa59c766faaa0b9a17ab583c79088f32f8a8 Mon Sep 17 00:00:00 2001 From: Alain Emilia Anna Zscheile Date: Wed, 11 Dec 2024 14:57:42 +0100 Subject: [PATCH] deps(specctra-core): use geo-types instead of geo --- Cargo.toml | 5 +++++ crates/specctra-core/Cargo.toml | 2 +- crates/specctra-core/src/math.rs | 4 ++-- crates/specctra-core/src/structure.rs | 8 ++++---- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0bbf235..53c3d2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,11 @@ serde_json = "1.0" spade = "2.12" thiserror = "2.0" +[workspace.dependencies.geo-types] +version = "0.7" +default-features = false +features = ["serde"] + [workspace.dependencies.geo] version = "0.29" default-features = false diff --git a/crates/specctra-core/Cargo.toml b/crates/specctra-core/Cargo.toml index 161f05e..5f7cd92 100644 --- a/crates/specctra-core/Cargo.toml +++ b/crates/specctra-core/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] bimap.workspace = true -geo.workspace = true +geo-types.workspace = true serde.workspace = true specctra_derive.path = "../specctra_derive" thiserror.workspace = true diff --git a/crates/specctra-core/src/math.rs b/crates/specctra-core/src/math.rs index 2ba94b1..0b02743 100644 --- a/crates/specctra-core/src/math.rs +++ b/crates/specctra-core/src/math.rs @@ -1,5 +1,5 @@ use core::ops::Sub; -use geo::geometry::Point; +use geo_types::geometry::Point; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] @@ -20,7 +20,7 @@ impl Circle { /// /// `phi` is the angle given in radians starting at `(r, 0)`. pub fn position_at_angle(&self, phi: f64) -> Point { - geo::point! { + geo_types::point! { x: self.pos.0.x + self.r * phi.cos(), y: self.pos.0.y + self.r * phi.sin() } diff --git a/crates/specctra-core/src/structure.rs b/crates/specctra-core/src/structure.rs index bff9112..aaa8f9a 100644 --- a/crates/specctra-core/src/structure.rs +++ b/crates/specctra-core/src/structure.rs @@ -392,17 +392,17 @@ pub struct Point { pub y: f64, } -impl From for Point { +impl From for Point { #[inline(always)] - fn from(z: geo::Point) -> Self { + fn from(z: geo_types::Point) -> Self { Point { x: z.0.x, y: z.0.y } } } -impl From for geo::Point { +impl From for geo_types::Point { #[inline(always)] fn from(z: Point) -> Self { - geo::point! { + geo_types::point! { x: z.x, y: z.y }