.. _program_listing_file_src_primitives_polygon.h: Program Listing for File polygon.h ================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/primitives/polygon.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include #include #include // for vector #include "tal/vector3.h" // for Vector3 namespace sota { class RegularPolygon { public: RegularPolygon(Vector3 center, std::vector points, Vector3 normal) : _center(center), _points(points), _normal(normal) {} RegularPolygon(Vector3 center, Vector3 normal) : _center(center), _normal(normal) {} RegularPolygon(const RegularPolygon& other) = default; RegularPolygon(RegularPolygon&& other) = default; RegularPolygon& operator=(const RegularPolygon& rhs) = default; RegularPolygon& operator=(RegularPolygon&& rhs) = default; virtual ~RegularPolygon() = default; // getters Vector3 center() const { return _center; } Vector3 normal() const { return _normal; } std::vector points() const { return _points; } // modifiers void add_point(const Vector3& p) { _points.push_back(p); } void sort_points(); // validation virtual void check() const = 0; protected: Vector3 _center; std::vector _points; Vector3 _normal; }; } // namespace sota