From 110481bee48bdb18f3d635cbc507aac1acc7c694 Mon Sep 17 00:00:00 2001 From: angeld55 Date: Tue, 24 May 2022 20:10:50 +0300 Subject: added shapes collection --- Sem. 13/ShapeCollection/ShapeCollection.h | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Sem. 13/ShapeCollection/ShapeCollection.h (limited to 'Sem. 13/ShapeCollection/ShapeCollection.h') diff --git a/Sem. 13/ShapeCollection/ShapeCollection.h b/Sem. 13/ShapeCollection/ShapeCollection.h new file mode 100644 index 0000000..4adaca7 --- /dev/null +++ b/Sem. 13/ShapeCollection/ShapeCollection.h @@ -0,0 +1,32 @@ +#pragma once +#include "Shape.h" + +class ShapeCollection +{ + Shape** shapes; + size_t shapesCount; + size_t capacity; + + void free(); + void copyFrom(const ShapeCollection& other); + void resize(); + + void addShape(Shape* shape); + +public: + ShapeCollection(); + ShapeCollection(const ShapeCollection& other); + ShapeCollection& operator=(const ShapeCollection& other); + ~ShapeCollection(); + + + void addRectangle(int x1, int y1, int x3, int y3); + void addCircle(int x1, int y1, int r); + + void addTriangle(int x1, int y1, int x2, int y2, int x3, int y3); + + double getPerOfFigureByIndex(size_t ind) const; + double getAreaOfFigureByIndex(size_t ind) const; + double getIfPointInShapeByIndex(size_t ind, int x,int y) const; + +}; \ No newline at end of file -- cgit v1.3.1-23-gd82d