PhotonVision C++ v2027.0.0-alpha-2
Loading...
Searching...
No Matches
PhotonTargetSortMode.h
Go to the documentation of this file.
1/*
2 * MIT License
3 *
4 * Copyright (c) PhotonVision
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
25#pragma once
26
27#include <cmath>
28
30
31namespace photon {
32
33namespace PhotonTargetSortMode {
34
35struct Smallest {
36 inline bool operator()(const PhotonTrackedTarget& target1,
37 const PhotonTrackedTarget& target2) {
38 return target1.GetArea() < target2.GetArea();
39 }
40};
41
42struct Largest {
43 inline bool operator()(const PhotonTrackedTarget& target1,
44 const PhotonTrackedTarget& target2) {
45 return target1.GetArea() > target2.GetArea();
46 }
47};
48
49struct Highest {
50 inline bool operator()(const PhotonTrackedTarget& target1,
51 const PhotonTrackedTarget& target2) {
52 return target1.GetPitch() < target2.GetPitch();
53 }
54};
55
56struct Lowest {
57 inline bool operator()(const PhotonTrackedTarget& target1,
58 const PhotonTrackedTarget& target2) {
59 return target1.GetPitch() > target2.GetPitch();
60 }
61};
62
63struct RightMost {
64 inline bool operator()(const PhotonTrackedTarget& target1,
65 const PhotonTrackedTarget& target2) {
66 return target1.GetYaw() < target2.GetYaw();
67 }
68};
69
70struct LeftMost {
71 inline bool operator()(const PhotonTrackedTarget& target1,
72 const PhotonTrackedTarget& target2) {
73 return target1.GetYaw() > target2.GetYaw();
74 }
75};
76
77struct CenterMost {
78 inline bool operator()(const PhotonTrackedTarget& target1,
79 const PhotonTrackedTarget& target2) {
80 return std::pow(target1.GetPitch(), 2) + std::pow(target1.GetYaw(), 2) <
81 std::pow(target2.GetPitch(), 2) + std::pow(target2.GetYaw(), 2);
82 }
83};
84} // namespace PhotonTargetSortMode
85} // namespace photon
Represents a tracked target within a pipeline.
Definition PhotonTrackedTarget.h:31
double GetArea() const
Returns the target area (0-100).
Definition PhotonTrackedTarget.h:59
double GetPitch() const
Returns the target pitch (positive-up)
Definition PhotonTrackedTarget.h:53
double GetYaw() const
Returns the target yaw (positive-left).
Definition PhotonTrackedTarget.h:47
Definition VisionEstimation.h:30
Definition PhotonTargetSortMode.h:77
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:78
Definition PhotonTargetSortMode.h:49
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:50
Definition PhotonTargetSortMode.h:42
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:43
Definition PhotonTargetSortMode.h:70
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:71
Definition PhotonTargetSortMode.h:56
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:57
Definition PhotonTargetSortMode.h:63
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:64
Definition PhotonTargetSortMode.h:35
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:36