Enrollment 28.2.0
Loading...
Searching...
No Matches
CriticalPoint.h
Go to the documentation of this file.
1
9
10#pragma once
11
15#include <cmath>
16
17namespace inno
18{
23 */
24 class CriticalPoint : public Serializable
25 {
26 public:
29 /// @image latex cores_deltas.png "Critical points types" width = 5cm
30 enum class Type : uint8_t
31 {
33 CORE = 1,
37 DELTA = 2
38 };
42 Type type;
46
50 */
51 void WriteTo(Writer& writer) const final
52 {
53 writer.Write("c", center);
54 writer.Write("t", static_cast<uint8_t>(type));
55 writer.Write("a", angle);
56 }
57
64 */
65 CriticalPoint(Point pointArg, Type typeArg, Angle angleArg)
66 : center(std::move(pointArg))
67 , type(typeArg)
68 , angle(angleArg)
69 {
70 }
71 bool operator==(const CriticalPoint& m) const
72 {
73 auto isAngleEqual = std::abs(angle - m.angle) < std::numeric_limits<Angle>::epsilon();
74 return center == m.center && type == m.type && isAngleEqual;
75 }
76 bool operator!=(const CriticalPoint& m) const
77 {
78 return !(*this == m);
79 }
80
81 CriticalPoint()
82 : type(Type::CORE)
83 , angle(0)
84 {
85 }
86
87 virtual ~CriticalPoint() = default;
88
89 CriticalPoint(const CriticalPoint& m) = default;
90 CriticalPoint(CriticalPoint&& m) = delete;
91 CriticalPoint& operator=(const CriticalPoint& m) = default;
92 CriticalPoint& operator=(CriticalPoint&& m) = delete;
93 };
94
101 */
102 class CriticalPointShape : public ImageShape
103 {
104 public:
108 */
109 void DrawIn(ImageShapeDrawer& drawer) const final
110 {
111 if (m->type == CriticalPoint::Type::DELTA)
112 {
113 auto rect = Rectangle{ { m->center.x - static_cast<int>(r), m->center.y - static_cast<int>(r) },
114 { m->center.x + static_cast<int>(r), m->center.y - static_cast<int>(r) },
115 { m->center.x + static_cast<int>(r), m->center.y + static_cast<int>(r) },
116 { m->center.x - static_cast<int>(r), m->center.y + static_cast<int>(r) } };
117 auto rectShape = RectangleShape(rect, a);
118 rectShape.DrawIn(drawer);
119 }
120 else
121 {
122 drawer.DrawCircle(Circle{ { m->center.x, m->center.y }, r }, a);
123 }
124 auto angleLine = Line{ { m->center.x, m->center.y }, m->angle, al };
125 drawer.DrawLine(angleLine, a);
126 }
127
135 */
136 CriticalPointShape(std::shared_ptr<CriticalPoint> point,
137 Radius radius,
139 unsigned int angleLength)
140 : m(std::move(point))
141 , r(radius)
142 , a(std::move(attr))
143 , al(angleLength)
144 {
145 }
146
152 */
153 CriticalPointShape(std::shared_ptr<CriticalPoint> point, ImageShapeAttributes attr)
154 : m(std::move(point))
155 , r(DefaultRadius)
156 , a(std::move(attr))
157 , al(DefaultAngleLength)
158 {
159 }
160
161 CriticalPointShape() = delete;
162 virtual ~CriticalPointShape() = default;
163 CriticalPointShape(const CriticalPointShape&) = delete;
165 CriticalPointShape& operator=(const CriticalPointShape&) = delete;
166 CriticalPointShape& operator=(CriticalPointShape&&) = delete;
167
168 private:
169 std::shared_ptr<CriticalPoint> m;
170 static constexpr Radius DefaultRadius = 5;
171 Radius r;
173 static constexpr unsigned int DefaultAngleLength = 10;
174 unsigned int al;
175 };
176
180 */
181 class CriticalPointsShape : public ImageShape
182 {
183 public:
187 */
188 void DrawIn(ImageShapeDrawer& drawer) const final
189 {
190 for (const auto& mi : m)
191 {
192 auto ms = CriticalPointShape(mi, r, a, al);
193 ms.DrawIn(drawer);
194 }
195 }
196
204 */
205 CriticalPointsShape(const std::vector<std::shared_ptr<CriticalPoint>>& point,
206 Radius radius,
208 unsigned int angleLength)
209 : m(point)
210 , r(radius)
211 , a(std::move(attr))
212 , al(angleLength)
213 {
214 }
215
221 */
222 CriticalPointsShape(const std::vector<std::shared_ptr<CriticalPoint>>& point, ImageShapeAttributes attr)
223 : m(point)
224 , r(DefaultRadius)
225 , a(std::move(attr))
226 , al(DefaultAngleLength)
227 {
228 }
229 CriticalPointsShape() = delete;
230 virtual ~CriticalPointsShape() = default;
233 CriticalPointsShape& operator=(const CriticalPointsShape&) = delete;
234 CriticalPointsShape& operator=(CriticalPointsShape&&) = delete;
235
236 private:
237 std::vector<std::shared_ptr<CriticalPoint>> m;
238 static constexpr Radius DefaultRadius = 5;
239 Radius r;
241 static constexpr unsigned int DefaultAngleLength = 10;
242 unsigned int al;
243 };
244} // namespace inno
It holds circle dimensions.
Definition ImageAttribute.h:691
It draws CriticalPoint into image.
Definition CriticalPoint.h:102
CriticalPointShape(std::shared_ptr< CriticalPoint > point, ImageShapeAttributes attr)
Create CriticalPoint shape.
Definition CriticalPoint.h:152
void DrawIn(ImageShapeDrawer &drawer) const final
It draws CriticalPoint into image.
Definition CriticalPoint.h:108
CriticalPointShape(std::shared_ptr< CriticalPoint > point, Radius radius, ImageShapeAttributes attr, unsigned int angleLength)
Create CriticalPoint shape.
Definition CriticalPoint.h:135
It represents a particular CriticalPoint.
Definition CriticalPoint.h:24
void WriteTo(Writer &writer) const final
Write itself into writer.
Definition CriticalPoint.h:50
Point center
CriticalPoint point.
Definition CriticalPoint.h:39
CriticalPoint(Point pointArg, Type typeArg, Angle angleArg)
It creates CriticalPoint with given parameters.
Definition CriticalPoint.h:64
Type
Type of CriticalPoint.
Definition CriticalPoint.h:30
@ DELTA
Delta is point on a ridge at or nearest to the point of divergence of two type lines (one of the two ...
Definition CriticalPoint.h:36
@ CORE
Core is topmost point on the innermost recurving ridge line of a fingerprint iso_19794-1_2011.
Definition CriticalPoint.h:32
Type type
CriticalPoint type (core/delta).
Definition CriticalPoint.h:41
Angle angle
The orientation of the point is represented in degrees, with zero degrees pointing horizontally and t...
Definition CriticalPoint.h:44
It draws collection of CriticalPoint into image.
Definition CriticalPoint.h:181
void DrawIn(ImageShapeDrawer &drawer) const final
It draws all CriticalPoint into image.
Definition CriticalPoint.h:187
CriticalPointsShape(const std::vector< std::shared_ptr< CriticalPoint > > &point, ImageShapeAttributes attr)
Create CriticalPoint shape.
Definition CriticalPoint.h:221
CriticalPointsShape(const std::vector< std::shared_ptr< CriticalPoint > > &point, Radius radius, ImageShapeAttributes attr, unsigned int angleLength)
Create CriticalPoint shape.
Definition CriticalPoint.h:204
It holds shape attributes such as color and line width.
Definition ImageShape.h:22
It is used by ImageShape to draw its shape.
Definition ImageShape.h:108
It holds line points.
Definition ImageAttribute.h:615
It holds X and Y coordinates of point.
Definition ImageAttribute.h:312
It holds rectangle and draws it.
Definition ImageShape.h:163
It holds rectangle vertexes, width, height.
Definition ImageAttribute.h:357
Provides interface for serialization of all classes.
Definition Writer.h:164
float Angle
Angle in degrees.
Definition ImageAttribute.h:122
unsigned int Radius
Radius.
Definition ImageAttribute.h:127