2023-01-15 17:01:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cmath>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
|
|
|
#include "Vector2.h"
|
2023-02-05 17:39:02 +00:00
|
|
|
#include <string>
|
2023-01-15 17:01:27 +00:00
|
|
|
|
|
|
|
class Shape {
|
|
|
|
public:
|
|
|
|
virtual Vector2 nextVector(double drawingProgress) = 0;
|
|
|
|
virtual void rotate(double theta) = 0;
|
|
|
|
virtual void scale(double x, double y) = 0;
|
|
|
|
virtual void translate(double x, double y) = 0;
|
|
|
|
virtual double length() = 0;
|
2023-02-05 00:43:57 +00:00
|
|
|
virtual std::unique_ptr<Shape> clone() = 0;
|
2023-02-05 17:39:02 +00:00
|
|
|
virtual std::string type() = 0;
|
2023-01-15 17:01:27 +00:00
|
|
|
|
|
|
|
static double totalLength(std::vector<std::unique_ptr<Shape>>&);
|
2023-02-05 17:39:02 +00:00
|
|
|
static void normalize(std::vector<std::unique_ptr<Shape>>&, double, double);
|
|
|
|
static void normalize(std::vector<std::unique_ptr<Shape>>&);
|
|
|
|
static double height(std::vector<std::unique_ptr<Shape>>&);
|
|
|
|
static double width(std::vector<std::unique_ptr<Shape>>&);
|
|
|
|
static Vector2 maxVector(std::vector<std::unique_ptr<Shape>>&);
|
|
|
|
static void removeOutOfBounds(std::vector<std::unique_ptr<Shape>>&);
|
2023-01-15 17:01:27 +00:00
|
|
|
|
|
|
|
const double INVALID_LENGTH = -1.0;
|
2023-01-15 22:34:02 +00:00
|
|
|
|
|
|
|
double len = INVALID_LENGTH;
|
2023-01-15 17:01:27 +00:00
|
|
|
};
|