Banuba SDK
Loading...
Searching...
No Matches
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 was generated by Djinni from types.djinni
7
8#pragma once
9
10#include <bnb/utils/defs.hpp>
11#include <memory>
12#include <vector>
13
14namespace bnb { namespace interfaces {
15
16enum class rotation;
17struct pixel_rect;
18struct point2d;
19
20class BNB_EXPORT transformation {
21public:
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
virtual std::shared_ptr< transformation > clone_j() const =0
Clone the transformation.
static std::shared_ptr< transformation > make_identity()
Constructs identity transform.
virtual std::shared_ptr< transformation > chain_right(const std::shared_ptr< transformation > &t) const =0
Applies transform t after this e.g.
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.
static std::shared_ptr< transformation > make_rot(rotation rot)
Constructs rotate transformation.
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...
virtual point2d transform_point(const point2d &p) const =0
Apply transform to point.
virtual std::shared_ptr< transformation > inverse_j() const =0
Get the inverse of the transformation.
static std::shared_ptr< transformation > make_data(const std::vector< float > &mat)
Constructs from mat_t.
virtual std::vector< float > get_mat_j() const =0
Returns 3x3 row-maj transform matrix.