nx_metadata_sdk
1.0
Metadata SDK
src
nx
sdk
analytics
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
{
14
Rect
() =
default
;
15
16
Rect
(
float
x
,
float
y
,
float
width
,
float
height
):
x
(
x
),
y
(
y
),
width
(
width
),
height
(
height
) {}
17
18
Rect
(
Point
topLeft,
float
width
,
float
height
):
19
x
(topLeft.
x
),
y
(topLeft.
y
),
width
(
width
),
height
(
height
)
20
{
21
}
22
27
float
x
= -1;
28
33
float
y
= -1;
34
39
float
width
= -1;
40
45
float
height
= -1;
46
52
Point
center
()
const
{
return
Point
(
x
+
width
/ 2,
y
+
height
/ 2); }
53
54
bool
isValid()
const
55
{
56
return
x
>= 0 &&
y
>= 0 &&
width
>= 0 &&
height
>= 0
57
&&
x
+
width
<= 1 &&
y
+
height
<= 1;
58
}
59
};
60
61
}
// namespace analytics
62
}
// namespace sdk
63
}
// namespace nx
nx::sdk::analytics::Rect::x
float x
Definition:
rect.h:27
nx::sdk::analytics::Point::y
float y
Definition:
point.h:23
nx::sdk::analytics::Rect::width
float width
Definition:
rect.h:39
nx::sdk::analytics::Rect::y
float y
Definition:
rect.h:33
nx::sdk::analytics::Rect::center
Point center() const
Definition:
rect.h:52
nx::sdk::analytics::Rect::Rect
Rect()=default
nx::sdk::analytics::Rect::height
float height
Definition:
rect.h:45
nx
Definition:
apple_utils.h:6
nx::sdk::analytics::Point
Definition:
point.h:9
nx::sdk::analytics::Point::x
float x
Definition:
point.h:18
nx::sdk::analytics::Rect
Definition:
rect.h:11
Generated by
1.8.14