Banuba SDK
transformation.hpp
Go to the documentation of this file.
1 /// \file
2 /// \addtogroup Types
3 /// @{
4 ///
5 // AUTOGENERATED FILE - DO NOT MODIFY!
6 // This file generated by Djinni from types.djinni
7 
8 #pragma once
9 
10 #include <bnb/utils/defs.hpp>
11 #include <memory>
12 #include <vector>
13 
14 namespace bnb { namespace interfaces {
15 
16 enum class rotation;
17 struct pixel_rect;
18 struct point2d;
19 
20 class BNB_EXPORT transformation {
21 public:
22  virtual ~transformation() {}
23 
24  /** Constructs identity transform */
25  static std::shared_ptr<transformation> make_identity();
26 
27  /** Constructs from mat_t */
28  static std::shared_ptr<transformation> make_data(const std::vector<float> & mat);
29 
30  /** Constructs rotate transformation */
31  static std::shared_ptr<transformation> make_rot(rotation rot);
32 
33  /** Constructs affine transformation */
34  static std::shared_ptr<transformation> make_affine(float scale_x, float scale_y, float t_x, float t_y, rotation rot, bool flip_x, bool flip_y);
35 
36  /**
37  * Constructs transformation from source to target rectangle
38  * Rotation and flips are around rectangles' center
39  */
40  static std::shared_ptr<transformation> make_rects(const pixel_rect & source_rect, const pixel_rect & target_rect, rotation rot, bool flip_x, bool flip_y);
41 
42  /**
43  * Applies transform t after this
44  * e.g. {rotate >> translate;} rotates first: (initial -> rotated) >> (rotated -> translated) = (initial -> translated)
45  */
46  virtual std::shared_ptr<transformation> chain_right(const std::shared_ptr<transformation> & t) const = 0;
47 
48  /** Apply transform to point */
49  virtual point2d transform_point(const point2d & p) const = 0;
50 
51  virtual pixel_rect transform_rect(const pixel_rect & rect) const = 0;
52 
53  virtual bool equals(const std::shared_ptr<transformation> & t) const = 0;
54 
55  /**
56  * Get the inverse of the transformation
57  * @throw std::logic_error when matrix is singular
58  */
59  virtual std::shared_ptr<transformation> inverse_j() const = 0;
60 
61  /** Clone the transformation */
62  virtual std::shared_ptr<transformation> clone_j() const = 0;
63 
64  /** Returns 3x3 row-maj transform matrix */
65  virtual std::vector<float> get_mat_j() const = 0;
66 };
67 
68 } } // namespace bnb::interfaces
69 /// @}
70 
bnb::interfaces::transformation
Definition: transformation.hpp:20
bnb::interfaces::transformation::make_affine
static std::shared_ptr< transformation > make_affine(float scale_x, float scale_y, float t_x, float t_y, rotation rot, bool flip_x, bool flip_y)
Constructs affine transformation.
bnb::interfaces::transformation::chain_right
virtual std::shared_ptr< transformation > chain_right(const std::shared_ptr< transformation > &t) const =0
Applies transform t after this e.g.
bnb::interfaces::transformation::make_data
static std::shared_ptr< transformation > make_data(const std::vector< float > &mat)
Constructs from mat_t.
bnb::interfaces::transformation::make_rects
static std::shared_ptr< transformation > make_rects(const pixel_rect &source_rect, const pixel_rect &target_rect, rotation rot, bool flip_x, bool flip_y)
Constructs transformation from source to target rectangle Rotation and flips are around rectangles' c...
bnb::interfaces::transformation::make_identity
static std::shared_ptr< transformation > make_identity()
Constructs identity transform.
bnb::interfaces::pixel_rect
Definition: pixel_rect.hpp:15
bnb::interfaces::transformation::make_rot
static std::shared_ptr< transformation > make_rot(rotation rot)
Constructs rotate transformation.
bnb::interfaces::point2d
Definition: point2d.hpp:14
bnb::interfaces::transformation::clone_j
virtual std::shared_ptr< transformation > clone_j() const =0
Clone the transformation.
bnb::interfaces::transformation::get_mat_j
virtual std::vector< float > get_mat_j() const =0
Returns 3x3 row-maj transform matrix.
bnb::interfaces::transformation::transform_point
virtual point2d transform_point(const point2d &p) const =0
Apply transform to point.
bnb::interfaces::transformation::inverse_j
virtual std::shared_ptr< transformation > inverse_j() const =0
Get the inverse of the transformation.