Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 13 / ShapeCollection / ShapeCollection.h
blob: 4adaca710ba98ff8206e7bf11a4fcad70139f3d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;

};