nx_metadata_sdk  1.0
Metadata SDK
rect.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2 
3 #pragma once
4 
5 #include <nx/sdk/analytics/point.h>
6 
7 namespace nx {
8 namespace sdk {
9 namespace analytics {
10 
11 struct Rect
12 {
13  Rect() = default;
14 
15  Rect(float x, float y, float width, float height): x(x), y(y), width(width), height(height) {}
16 
17  Rect(Point topLeft, float width, float height):
18  x(topLeft.x), y(topLeft.y), width(width), height(height)
19  {
20  }
21 
26  float x = -1;
27 
32  float y = -1;
33 
38  float width = -1;
39 
44  float height = -1;
45 
51  Point center() const { return Point(x + width / 2, y + height / 2); }
52 };
53 
54 } // namespace analytics
55 } // namespace sdk
56 } // namespace nx
float x
Definition: rect.h:26
float y
Definition: point.h:23
float width
Definition: rect.h:38
float y
Definition: rect.h:32
Point center() const
Definition: rect.h:51
float height
Definition: rect.h:44
Definition: apple_utils.h:6
Definition: point.h:9
float x
Definition: point.h:18
Definition: rect.h:11