Tue, 19 Jun 2018 23:18:58 +0300
added support for inverting circular primitives
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
1 | #include "../algorithms/geometry.h" |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
2 | #include "../glShared.h" |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
3 | #include "../model.h" |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
4 | #include "../algorithms/invert.h" |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
5 | #include "circularprimitive.h" |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
6 | #include "quadrilateral.h" |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
7 | #include "primitives.h" |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
8 | |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
9 | QString LDCircularPrimitive::buildFilename() const |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
10 | { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
11 | int numerator = this->m_segments; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
12 | int denominator = this->m_divisions; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
13 | QString prefix; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
14 | |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
15 | if (m_divisions != MediumResolution) |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
16 | prefix = QString::number(m_divisions) + '\\'; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
17 | |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
18 | simplify(numerator, denominator); |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
19 | |
1399
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
20 | // Ensure that the denominator is at least 4, expand if necessary |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
21 | if (denominator < 4) |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
22 | { |
1399
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
23 | numerator = static_cast<int>(round(numerator * 4.0 / denominator)); |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
24 | denominator = 4; |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
25 | } |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
26 | |
1399
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
27 | return format("%1%2-%3%4.dat", prefix, numerator, denominator, stem()); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
28 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
29 | |
1403
7a2d84112983
replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents:
1402
diff
changeset
|
30 | LDCircularPrimitive::LDCircularPrimitive(PrimitiveModel::Type type, |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
31 | int segments, |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
32 | int divisions, |
1403
7a2d84112983
replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents:
1402
diff
changeset
|
33 | const QMatrix4x4& matrix) : |
7a2d84112983
replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents:
1402
diff
changeset
|
34 | LDMatrixObject {matrix}, |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
35 | m_type {type}, |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
36 | m_segments {segments}, |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
37 | m_divisions {divisions} {} |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
38 | |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
39 | LDObjectType LDCircularPrimitive::type() const |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
40 | { |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
41 | return SubclassType; |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
42 | } |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
43 | |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
44 | QString LDCircularPrimitive::asText() const |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
45 | { |
1403
7a2d84112983
replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents:
1402
diff
changeset
|
46 | return LDSubfileReference(buildFilename(), transformationMatrix()).asText(); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
47 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
48 | |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
49 | void LDCircularPrimitive::getVertices(DocumentManager* /* context */, QSet<Vertex>& vertices) const |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
50 | { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
51 | int endSegment = (m_segments == m_divisions) ? m_segments : m_segments + 1; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
52 | |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
53 | for (int i = 0; i < endSegment; i += 1) |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
54 | { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
55 | QPointF point2d = pointOnLDrawCircumference(i, m_divisions); |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
56 | |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
57 | for (double y_value : {0.0, 1.0}) |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
58 | { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
59 | Vertex vertex {point2d.x(), y_value, point2d.y()}; |
1403
7a2d84112983
replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents:
1402
diff
changeset
|
60 | vertex.transform(transformationMatrix()); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
61 | vertices.insert(vertex); |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
62 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
63 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
64 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
65 | |
1399
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
66 | bool LDCircularPrimitive::isRasterizable() const |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
67 | { |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
68 | return true; |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
69 | } |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
70 | |
1412
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
71 | bool LDCircularPrimitive::isFlat() const |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
72 | { |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
73 | switch (m_type) |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
74 | { |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
75 | case PrimitiveModel::Cylinder: |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
76 | case PrimitiveModel::CylinderClosed: |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
77 | case PrimitiveModel::CylinderOpen: |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
78 | return false; |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
79 | |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
80 | default: |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
81 | return true; |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
82 | } |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
83 | } |
f5eb947a2e7f
added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1410
diff
changeset
|
84 | |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
85 | void LDCircularPrimitive::rasterize( |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
86 | DocumentManager* context, |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
87 | Winding /* parentWinding */, |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
88 | Model& model, |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
89 | bool /* deep */, |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
90 | bool /* render */ |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
91 | ) { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
92 | Model cylinderBody {context}; |
1407
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
93 | buildPrimitiveBody(cylinderBody, false); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
94 | |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
95 | for (LDObject* object : cylinderBody.objects()) |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
96 | { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
97 | for (int i = 0; i < object->numVertices(); i += 1) |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
98 | { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
99 | Vertex vertex = object->vertex(i); |
1403
7a2d84112983
replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents:
1402
diff
changeset
|
100 | vertex.transform(transformationMatrix()); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
101 | object->setVertex(i, vertex); |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
102 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
103 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
104 | |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
105 | model.merge(cylinderBody); |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
106 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
107 | |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
108 | QVector<LDPolygon> LDCircularPrimitive::rasterizePolygons(DocumentManager* context, Winding winding) |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
109 | { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
110 | Model cylinderBody {context}; |
1407
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
111 | buildPrimitiveBody(cylinderBody, true); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
112 | QVector<LDPolygon> result; |
1394
8d9d0532b3df
fixed cylinder rendering
Teemu Piippo <teemu@hecknology.net>
parents:
1391
diff
changeset
|
113 | bool cachedShouldInvert = shouldInvert(winding, context); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
114 | |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
115 | for (LDObject* object : cylinderBody.objects()) |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
116 | { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
117 | for (int i = 0; i < object->numVertices(); i += 1) |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
118 | { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
119 | Vertex vertex = object->vertex(i); |
1403
7a2d84112983
replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents:
1402
diff
changeset
|
120 | vertex.transform(transformationMatrix()); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
121 | object->setVertex(i, vertex); |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
122 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
123 | |
1400 | 124 | LDPolygon polygon = object->getPolygon(); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
125 | |
1400 | 126 | if (polygon.isValid()) |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
127 | { |
1394
8d9d0532b3df
fixed cylinder rendering
Teemu Piippo <teemu@hecknology.net>
parents:
1391
diff
changeset
|
128 | if (cachedShouldInvert) |
1400 | 129 | invertPolygon(polygon); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
130 | |
1400 | 131 | result.append(polygon); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
132 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
133 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
134 | |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
135 | return result; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
136 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
137 | |
1407
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
138 | void LDCircularPrimitive::buildPrimitiveBody(Model& model, bool deep) const |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
139 | { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
140 | PrimitiveModel primitive; |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
141 | primitive.type = m_type; |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
142 | primitive.segments = m_segments; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
143 | primitive.divisions = m_divisions; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
144 | primitive.ringNumber = 0; |
1407
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
145 | primitive.generateBody(model, deep); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
146 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
147 | |
1399
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
148 | QString LDCircularPrimitive::stem() const |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
149 | { |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
150 | switch (m_type) |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
151 | { |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
152 | case PrimitiveModel::Cylinder: |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
153 | return "cyli"; |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
154 | |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
155 | case PrimitiveModel::Circle: |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
156 | return "edge"; |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
157 | |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
158 | case PrimitiveModel::Disc: |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
159 | return "disc"; |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
160 | |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
161 | case PrimitiveModel::DiscNegative: |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
162 | return "ndis"; |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
163 | |
1407
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
164 | case PrimitiveModel::CylinderClosed: |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
165 | return "cylc"; |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
166 | |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
167 | case PrimitiveModel::CylinderOpen: |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
168 | return "cylo"; |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
169 | |
1408
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
170 | case PrimitiveModel::Chord: |
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
171 | return "chrd"; |
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
172 | |
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
173 | case PrimitiveModel::Ring: |
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
174 | case PrimitiveModel::Cone: |
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
175 | break; |
1399
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
176 | } |
1408
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
177 | |
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
178 | throw std::logic_error("Bad primitive type to LDCircularPrimitive"); |
1399
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
179 | } |
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
180 | |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
181 | QString LDCircularPrimitive::objectListText() const |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
182 | { |
1402
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
183 | QString prefix; |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
184 | |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
185 | if (m_divisions == HighResolution) |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
186 | prefix = "Hi-Res"; |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
187 | else if (m_divisions == LowResolution) |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
188 | prefix = "Lo-Res"; |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
189 | else if (m_divisions != MediumResolution) |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
190 | prefix = format("%1-resolution", m_divisions); |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
191 | |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
192 | QString result = format( |
1402
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
193 | "%1 %2 %3 %4, (", |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
194 | prefix, |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
195 | PrimitiveModel::typeName(m_type), |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
196 | m_segments / m_divisions, |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
197 | position().toString(true) |
1402
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
198 | ).simplified(); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
199 | |
1403
7a2d84112983
replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents:
1402
diff
changeset
|
200 | for (int i = 0; i < 3; ++i) |
7a2d84112983
replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents:
1402
diff
changeset
|
201 | for (int j = 0; j < 3; ++j) |
7a2d84112983
replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents:
1402
diff
changeset
|
202 | result += format("%1%2", transformationMatrix()(i, j), (i != 2 or j != 2) ? " " : ""); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
203 | |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
204 | result += ')'; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
205 | return result; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
206 | } |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
207 | |
1406
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
208 | PrimitiveModel::Type LDCircularPrimitive::primitiveType() const |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
209 | { |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
210 | return m_type; |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
211 | } |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
212 | |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
213 | void LDCircularPrimitive::setPrimitiveType(PrimitiveModel::Type newType) |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
214 | { |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
215 | changeProperty(&m_type, newType); |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
216 | } |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
217 | |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
218 | int LDCircularPrimitive::segments() const |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
219 | { |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
220 | return m_segments; |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
221 | } |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
222 | |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
223 | void LDCircularPrimitive::setSegments(int newSegments) |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
224 | { |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
225 | changeProperty(&m_segments, newSegments); |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
226 | } |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
227 | |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
228 | int LDCircularPrimitive::divisions() const |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
229 | { |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
230 | return m_divisions; |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
231 | } |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
232 | |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
233 | void LDCircularPrimitive::setDivisions(int newDivisions) |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
234 | { |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
235 | changeProperty(&m_divisions, newDivisions); |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
236 | } |
37fffb682d2f
Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents:
1403
diff
changeset
|
237 | |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
238 | int LDCircularPrimitive::triangleCount(DocumentManager*) const |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
239 | { |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
240 | switch (m_type) |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
241 | { |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
242 | case PrimitiveModel::Ring: |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
243 | case PrimitiveModel::Cone: |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
244 | throw std::logic_error("Bad primitive type to LDCircularPrimitive"); |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
245 | |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
246 | case PrimitiveModel::Cylinder: |
1407
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
247 | case PrimitiveModel::CylinderClosed: |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
248 | case PrimitiveModel::CylinderOpen: |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
249 | return 2 * m_segments; |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
250 | |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
251 | case PrimitiveModel::Disc: |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
252 | case PrimitiveModel::DiscNegative: |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
253 | return m_segments; |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
254 | |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
255 | case PrimitiveModel::Circle: |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
256 | return 0; |
1408
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
257 | |
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
258 | case PrimitiveModel::Chord: |
1410 | 259 | return qBound(0, m_segments - 1, m_divisions - 2); |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
260 | } |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
261 | |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
262 | return 0; |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
263 | } |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
264 | |
1402
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
265 | QString LDCircularPrimitive::iconName() const |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
266 | { |
1402
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
267 | switch (m_type) |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
268 | { |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
269 | case PrimitiveModel::Ring: |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
270 | case PrimitiveModel::Cone: |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
271 | break; |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
272 | |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
273 | case PrimitiveModel::Cylinder: |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
274 | return "cylinder"; |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
275 | |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
276 | case PrimitiveModel::Disc: |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
277 | return "disc"; |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
278 | |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
279 | case PrimitiveModel::DiscNegative: |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
280 | return "disc-negative"; |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
281 | |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
282 | case PrimitiveModel::Circle: |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
283 | return "circle"; |
1407
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
284 | |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
285 | case PrimitiveModel::CylinderClosed: |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
286 | return "cylinder-closed"; |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
287 | |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
288 | case PrimitiveModel::CylinderOpen: |
22bc5862cb56
added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents:
1406
diff
changeset
|
289 | return "cylinder-open"; |
1408
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
290 | |
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
291 | case PrimitiveModel::Chord: |
0d6162662040
fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents:
1407
diff
changeset
|
292 | return "chord"; |
1402
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
293 | } |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
294 | |
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1401
diff
changeset
|
295 | return ""; |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
296 | } |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
297 | |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
298 | void LDCircularPrimitive::serialize(class Serializer& serializer) |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
299 | { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
300 | LDMatrixObject::serialize(serializer); |
1401
59b578c77111
fixed bugs regarding circular primitives
Teemu Piippo <teemu@hecknology.net>
parents:
1400
diff
changeset
|
301 | serializer << m_segments << m_divisions << m_type; |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
302 | } |