egml_core/model/geometry/primitives/
curve_kind.rs1use crate::impl_abstract_curve_traits;
2use crate::model::geometry::Envelope;
3use crate::model::geometry::primitives::{
4 AbstractCurve, AsAbstractCurve, AsAbstractCurveMut, LineString,
5};
6use nalgebra::Isometry3;
7
8#[derive(Debug, Clone, PartialEq)]
10pub enum CurveKind {
11 LineString(LineString),
13}
14
15impl AsAbstractCurve for CurveKind {
16 fn abstract_curve(&self) -> &AbstractCurve {
17 match self {
18 Self::LineString(x) => x.abstract_curve(),
19 }
20 }
21}
22
23impl AsAbstractCurveMut for CurveKind {
24 fn abstract_curve_mut(&mut self) -> &mut AbstractCurve {
25 match self {
26 Self::LineString(x) => x.abstract_curve_mut(),
27 }
28 }
29}
30
31impl_abstract_curve_traits!(CurveKind);
32
33impl CurveKind {
34 pub fn compute_envelope(&self) -> Envelope {
35 match self {
36 Self::LineString(x) => x.compute_envelope(),
37 }
38 }
39
40 pub fn apply_transform(&mut self, m: &Isometry3<f64>) {
41 match self {
42 Self::LineString(x) => x.apply_transform(m),
43 }
44 }
45
46 pub fn length_3d(&self) -> f64 {
47 match self {
48 Self::LineString(x) => x.length_3d(),
49 }
50 }
51}