rscad_csg_bsp/
metadata.rs1use nalgebra::{Point3, SVector};
2use slotmap::new_key_type;
3
4use crate::Number;
5
6new_key_type! {
9 pub struct PrimitiveKey;
11 pub struct FaceKey;
13 pub struct EdgeKey;
15}
16
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
21pub enum PrimitiveKind {
22 Cube,
23 Cuboid,
24 Cylinder,
25 Cone,
26 Torus,
27 Rhomboid,
28 Sphere,
29}
30
31#[derive(Clone, Debug)]
35pub struct PrimitiveMeta {
36 pub kind: PrimitiveKind,
37 pub face_keys: Vec<FaceKey>,
38 pub edge_keys: Vec<EdgeKey>,
39 pub color: Option<[f32; 4]>,
41}
42
43#[derive(Clone, Debug)]
45pub struct FaceMeta<T: Number> {
46 pub primitive_key: PrimitiveKey,
47 pub normal: SVector<T, 3>,
48 pub label: String,
49}
50
51#[derive(Clone, Debug)]
53pub struct EdgeMeta<T: Number> {
54 pub primitive_key: PrimitiveKey,
55 pub vertices: (Point3<T>, Point3<T>),
56 pub face_keys: [FaceKey; 2],
57}