PhotonVision C++ dev-v2025.0.0-beta-8-2-gbd1c5c03
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
34
35namespace photon {
36
37namespace PhotonTargetSortMode {
38
39struct Smallest {
40 inline bool operator()(const PhotonTrackedTarget& target1,
41 const PhotonTrackedTarget& target2) {
42 return target1.GetArea() < target2.GetArea();
43 }
44};
45
46struct Largest {
47 inline bool operator()(const PhotonTrackedTarget& target1,
48 const PhotonTrackedTarget& target2) {
49 return target1.GetArea() > target2.GetArea();
50 }
51};
52
53struct Highest {
54 inline bool operator()(const PhotonTrackedTarget& target1,
55 const PhotonTrackedTarget& target2) {
56 return target1.GetPitch() < target2.GetPitch();
57 }
58};
59
60struct Lowest {
61 inline bool operator()(const PhotonTrackedTarget& target1,
62 const PhotonTrackedTarget& target2) {
63 return target1.GetPitch() > target2.GetPitch();
64 }
65};
66
67struct RightMost {
68 inline bool operator()(const PhotonTrackedTarget& target1,
69 const PhotonTrackedTarget& target2) {
70 return target1.GetYaw() < target2.GetYaw();
71 }
72};
73
74struct LeftMost {
75 inline bool operator()(const PhotonTrackedTarget& target1,
76 const PhotonTrackedTarget& target2) {
77 return target1.GetYaw() > target2.GetYaw();
78 }
79};
80
81struct CenterMost {
82 inline bool operator()(const PhotonTrackedTarget& target1,
83 const PhotonTrackedTarget& target2) {
84 return std::pow(target1.GetPitch(), 2) + std::pow(target1.GetYaw(), 2) <
85 std::pow(target2.GetPitch(), 2) + std::pow(target2.GetYaw(), 2);
86 }
87};
88} // namespace PhotonTargetSortMode
89} // namespace photon
Represents a tracked target within a pipeline.
Definition PhotonTrackedTarget.h:34
double GetArea() const
Returns the target area (0-100).
Definition PhotonTrackedTarget.h:62
double GetPitch() const
Returns the target pitch (positive-up)
Definition PhotonTrackedTarget.h:56
double GetYaw() const
Returns the target yaw (positive-left).
Definition PhotonTrackedTarget.h:50
Definition VisionEstimation.h:32
Definition PhotonTargetSortMode.h:81
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:82
Definition PhotonTargetSortMode.h:53
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:54
Definition PhotonTargetSortMode.h:46
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:47
Definition PhotonTargetSortMode.h:74
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:75
Definition PhotonTargetSortMode.h:60
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:61
Definition PhotonTargetSortMode.h:67
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:68
Definition PhotonTargetSortMode.h:39
bool operator()(const PhotonTrackedTarget &target1, const PhotonTrackedTarget &target2)
Definition PhotonTargetSortMode.h:40