We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c38b1e4 commit 89a3ed4Copy full SHA for 89a3ed4
2 files changed
main/include/Shapes/RegularPolygon.hpp
@@ -41,6 +41,9 @@ class RegularPolygon : public Shape {
41
int getSides() const;
42
int getRadius();
43
44
+ void setSides(int sides);
45
+ void setRadius(int radius);
46
+
47
private:
48
int calculateRadiusFromSideLength(int sideLength);
49
std::vector<std::pair<int, int>> getVertices();
main/src/Shapes/RegularPolygon.cpp
@@ -18,6 +18,15 @@ int RegularPolygon::getRadius() {
18
return radius;
19
}
20
21
+void RegularPolygon::setSides(int sides) {
22
+ this->sides = sides;
23
+}
24
25
+void RegularPolygon::setRadius(int radius) {
26
+ this->radius = radius;
27
+ this->useSideLength = false;
28
29
30
int RegularPolygon::calculateRadiusFromSideLength(int sideLength) {
31
return sideLength / (2 * std::sin(M_PI / sides));
32
0 commit comments