Ocean
PlaneTracker.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_TRACKING_OFFLINE_PLANE_TRACKER_H
9 #define META_OCEAN_TRACKING_OFFLINE_PLANE_TRACKER_H
10 
14 
16 
17 namespace Ocean
18 {
19 
20 namespace Tracking
21 {
22 
23 namespace Offline
24 {
25 
26 // Forward declaration.
27 class PlaneTracker;
28 
29 /**
30  * Definition of a smart object reference holding a PlaneTracker object.
31  * @see PlaneTracker.
32  * @ingroup trackingoffline
33  */
35 
36 /**
37  * This class implements the abstract base class for all plane trackers.
38  * @see PlaneTrackerRef.
39  * @ingroup trackingoffline
40  */
41 class OCEAN_TRACKING_OFFLINE_EXPORT PlaneTracker : virtual public OfflineTracker
42 {
43  public:
44 
45  /**
46  * Returns the plane of this tracker.
47  * @return Plane that is tracked
48  */
49  virtual Plane3 plane() const;
50 
51  /**
52  * Determines the transformation that transforms points defined in the local coordinate of the tracked object into points defined in the world coordinate system.
53  * @param transformation Resulting transformation
54  * @return True, if succeeded
55  */
56  virtual bool objectTransformation(HomogenousMatrix4& transformation) const;
57 
58  protected:
59 
60  /**
61  * Creates a new plane tracker object.
62  */
63  PlaneTracker() = default;
64 
65  /**
66  * Creates a new plane tracker object.
67  * @param plane The plane of this tracker
68  */
69  inline PlaneTracker(const Plane3& plane);
70 
71  /**
72  * Updates the plane of this tracker and invokes the corresponding state event(s).
73  * @param plane New plane for this tracker
74  */
75  virtual void updatePlane(const Plane3& plane);
76 
77  protected:
78 
79  /// The plane of this tracker.
81 
82  /// The tracker object transformation the tracker coordinate system into the world coordinate system.
83  HomogenousMatrix4 objectTransformation_ = HomogenousMatrix4(false);
84 };
85 
88  plane_(plane),
89  objectTransformation_(false)
90 {
91  ocean_assert(plane_.isValid());
92 }
93 
94 }
95 
96 }
97 
98 }
99 
100 #endif // META_OCEAN_TRACKING_OFFLINE_PLANE_TRACKER_H
bool isValid() const
Returns whether this plane is valid.
Definition: Plane3.h:538
This template class implements a smart object reference which is a specialization of an ObjectRef obj...
Definition: SmartObjectRef.h:90
This class is the base class for all offline tracker objects.
Definition: OfflineTracker.h:45
This class implements the abstract base class for all plane trackers.
Definition: PlaneTracker.h:42
Plane3 plane_
The plane of this tracker.
Definition: PlaneTracker.h:80
virtual Plane3 plane() const
Returns the plane of this tracker.
virtual bool objectTransformation(HomogenousMatrix4 &transformation) const
Determines the transformation that transforms points defined in the local coordinate of the tracked o...
virtual void updatePlane(const Plane3 &plane)
Updates the plane of this tracker and invokes the corresponding state event(s).
PlaneTracker()=default
Creates a new plane tracker object.
HomogenousMatrixT4< Scalar > HomogenousMatrix4
Definition of the HomogenousMatrix4 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION flag eit...
Definition: HomogenousMatrix4.h:37
SmartObjectRef< PlaneTracker, OfflineTracker > PlaneTrackerRef
Definition of a smart object reference holding a PlaneTracker object.
Definition: PlaneTracker.h:27
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15