src/miscallenous.cpp

changeset 1024
67ba0ee049eb
parent 1023
9450ac3cd930
child 1062
4119185b56ca
equal deleted inserted replaced
1023:9450ac3cd930 1024:67ba0ee049eb
45 numerator /= factor; 45 numerator /= factor;
46 denominator /= factor; 46 denominator /= factor;
47 } 47 }
48 48
49 49
50 Vertex getRotationPoint (const LDObjectList& objs)
51 {
52 switch (RotationPoint (Config->rotationPointType()))
53 {
54 case RotationPoint::ObjectOrigin:
55 {
56 BoundingBox box;
57
58 // Calculate center vertex
59 for (LDObject* obj : objs)
60 {
61 if (obj->hasMatrix())
62 box << static_cast<LDMatrixObject*> (obj)->position();
63 else
64 box << obj;
65 }
66
67 return box.center();
68 }
69
70 case RotationPoint::WorldOrigin:
71 return Origin;
72
73 case RotationPoint::CustomPoint:
74 return Config->customRotationPoint();
75
76 case RotationPoint::NumValues:
77 break;
78 }
79
80 return Vertex();
81 }
82
83
84 QString joinStrings (QList<StringFormatArg> vals, QString delim) 50 QString joinStrings (QList<StringFormatArg> vals, QString delim)
85 { 51 {
86 QStringList list; 52 QStringList list;
87 53
88 for (const StringFormatArg& arg : vals) 54 for (const StringFormatArg& arg : vals)

mercurial