CVB++ 14.0
ellipse.hpp
1#pragma once
2
3#include "global.hpp"
4
5#include "point_2d.hpp"
6#include "angle.hpp"
7
8namespace Cvb
9{
10
11CVB_BEGIN_INLINE_NS
12
14
19class Ellipse final
20{
21 public:
22
24
32 : center_(center)
35 , rotation_(rotation)
36 {
37 rotation_.SetIsTrimmed(true);
38
43 }
44
46
50 Point2D<double> Center() const noexcept
51 {
52 return center_;
53 }
54
56
60 void SetCenter(Point2D<double> center) noexcept
61 {
62 center_ = center;
63 }
64
66
71 {
73 }
74
76
81 {
85 }
86
88
93 {
95 }
96
98
103 {
107 }
108
110
114 Angle Rotation() const noexcept
115 {
116 return rotation_;
117 }
118
120
124 void SetRotation(Angle rotation) noexcept
125 {
126 rotation_ = rotation;
127 rotation_.SetIsTrimmed(true);
128 }
129
131
136 bool operator==(const Ellipse& ellipse) const noexcept
137 {
138 return (center_ == ellipse.center_
141 && rotation_ == ellipse.rotation_);
142 }
143
144
146
151 bool operator!=(const Ellipse& ellipse) const noexcept
152 {
153 return !(*this == ellipse);
154 }
155
156 private:
157
158 Point2D<double> center_;
161 Angle rotation_;
162
163};
164
165
166CVB_END_INLINE_NS
167
168}
Object for convenient and type - safe handling of angles.
Definition: angle.hpp:19
void SetIsTrimmed(bool trim) noexcept
Set trimming of the value of the angle to the range -PI...PI.
Definition: angle.hpp:119
Class representing an ellipse.
Definition: ellipse.hpp:20
Sets the smaller radius of the ellipse.
Definition: ellipse.hpp:102
Point2D< double > Center() const noexcept
Gets the center of the ellipse.
Definition: ellipse.hpp:50
void SetRotation(Angle rotation) noexcept
Sets the angle by which the ellipse is rotated.
Definition: ellipse.hpp:124
bool operator==(const Ellipse &ellipse) const noexcept
Compares to an other ellipse.
Definition: ellipse.hpp:136
Sets the larger radius A of the ellipse.
Definition: ellipse.hpp:80
Gets the larger radius of the ellipse.
Definition: ellipse.hpp:92
Angle Rotation() const noexcept
Gets the angle by which the ellipse is rotated.
Definition: ellipse.hpp:114
void SetCenter(Point2D< double > center) noexcept
Sets the center of the ellipse.
Definition: ellipse.hpp:60
Gets the larger radius of the ellipse.
Definition: ellipse.hpp:70
bool operator!=(const Ellipse &ellipse) const noexcept
Compares to an other ellipse.
Definition: ellipse.hpp:151
Create an ellipse.
Definition: ellipse.hpp:31
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24