Sun, 29 Aug 2021 22:14:42 +0300
added a simple matrix transformation tool
15
9e18ec63eec3
split quadrilateral and triangle into their own source files
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
1 | #include "quadrilateral.h" |
9e18ec63eec3
split quadrilateral and triangle into their own source files
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
2 | |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
3 | QString ldraw::Quadrilateral::textRepresentation() const |
15
9e18ec63eec3
split quadrilateral and triangle into their own source files
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
4 | { |
9e18ec63eec3
split quadrilateral and triangle into their own source files
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
5 | return utility::format("%1 %2 %3 %4", |
87
93ec4d630346
added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents:
86
diff
changeset
|
6 | utility::vertexToStringParens(this->points[0]), |
93ec4d630346
added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents:
86
diff
changeset
|
7 | utility::vertexToStringParens(this->points[1]), |
93ec4d630346
added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents:
86
diff
changeset
|
8 | utility::vertexToStringParens(this->points[2]), |
93ec4d630346
added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents:
86
diff
changeset
|
9 | utility::vertexToStringParens(this->points[3])); |
15
9e18ec63eec3
split quadrilateral and triangle into their own source files
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
10 | } |
21 | 11 | |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
12 | void ldraw::Quadrilateral::getPolygons( |
21 | 13 | std::vector<gl::Polygon>& polygons, |
14 | GetPolygonsContext* context) const | |
15 | { | |
16 | Q_UNUSED(context) | |
17 | polygons.push_back(gl::quadrilateral( | |
18 | this->points[0], | |
19 | this->points[1], | |
20 | this->points[2], | |
21 | this->points[3], | |
22 | this->colorIndex, | |
87
93ec4d630346
added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents:
86
diff
changeset
|
23 | this->id)); |
21 | 24 | } |
26 | 25 | |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
26 | void ldraw::Quadrilateral::invert() |
26 | 27 | { |
28 | // 0 1 2 3 | |
29 | // -> 2 1 0 3 | |
30 | std::swap(this->points[0], this->points[2]); | |
31 | } |