src/model.h

changeset 379
8d88adffb779
parent 374
75efc3ba5a56
child 383
530d23cd4e97
equal deleted inserted replaced
378:01537fbe096e 379:8d88adffb779
60 // a < c * b / d 60 // a < c * b / d
61 // a * d < c * b 61 // a * d < c * b
62 return p.segments * q.divisions < q.segments / p.divisions; 62 return p.segments * q.divisions < q.segments / p.divisions;
63 } 63 }
64 64
65 struct CircularPrimitive 65 enum class circular_primitive_type_e
66 { 66 {
67 enum Type 67 circle,
68 { 68 disc,
69 Circle, 69 cylinder,
70 Disc, 70 cylinder_open,
71 Cylinder, 71 cylinder_closed,
72 CylinderOpen, 72 disc_negative,
73 CylinderClosed, 73 chord,
74 DiscNegative, 74 };
75 Chord, 75
76 } type; 76 struct circular_primitive
77 static constexpr int NUM_TYPES = Chord + 1; 77 {
78 static constexpr int NUM_TYPES = static_cast<int>(circular_primitive_type_e::chord) + 1;
79 circular_primitive_type_e type;
78 CircularFraction fraction; 80 CircularFraction fraction;
79 glm::mat4 transformation; 81 glm::mat4 transformation;
80 bool inverted = false; 82 bool inverted = false;
81 }; 83 };
82 84
83 constexpr char circularPrimitiveStems[CircularPrimitive::NUM_TYPES][5] = { 85 constexpr char circularPrimitiveStems[circular_primitive::NUM_TYPES][5] = {
84 "edge", 86 "edge",
85 "disc", 87 "disc",
86 "cyli", 88 "cyli",
87 "cylo", 89 "cylo",
88 "cylc", 90 "cylc",
89 "ndis", 91 "ndis",
90 "chrd", 92 "chrd",
91 }; 93 };
92 94
93 Q_DECLARE_METATYPE(CircularPrimitive::Type) 95 Q_DECLARE_METATYPE(circular_primitive_type_e)
94 96
95 struct CircleToolOptions 97 struct CircleToolOptions
96 { 98 {
97 CircularFraction fraction; 99 CircularFraction fraction;
98 CircularPrimitive::Type type; 100 circular_primitive_type_e type;
99 }; 101 };
100 102
101 using ModelElement = std::variant< 103 using ModelElement = std::variant<
102 Colored<SubfileReference>, 104 Colored<SubfileReference>,
103 Colored<LineSegment>, 105 Colored<LineSegment>,
104 Colored<Triangle>, 106 Colored<Triangle>,
105 Colored<Quadrilateral>, 107 Colored<Quadrilateral>,
106 Colored<ConditionalEdge>, 108 Colored<ConditionalEdge>,
107 Colored<CircularPrimitive>, 109 Colored<circular_primitive>,
108 Comment, 110 Comment,
109 Empty, 111 Empty,
110 ParseError>; 112 ParseError>;
111 113
112 using PlainPolygonElement = std::variant< 114 using PlainPolygonElement = std::variant<

mercurial