/usr/include/OpenLayer/Placement.hpp is in libopenlayer-dev 2.1-2.1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | #ifndef OL_TRANSFORM_MATRIX_HPP
#define OL_TRANSFORM_MATRIX_HPP
#include "Matrix.hpp"
#include "Vec2D.hpp"
#include "Declspec.hpp"
namespace ol {
class OL_LIB_DECLSPEC Placement {
public:
Placement( Vec2D position = Vec2D( 0.0, 0.0 ),
float rotation = 0.0,
float stretch = 1.0,
Vec2D rotationPivot = Vec2D( 0.0, 0.0 ))
: position( position ), rotation( rotation ), stretch( stretch ), rotationPivot( rotationPivot ) {}
inline float GetDistance( const Placement &other ) const{
return (position - other.position).GetMagnitude();
}
inline void MoveBy( Vec2D value ) {
position += value;
}
inline void RotateBy( float value ) {
rotation += value;
}
inline void StretchBy( float factor ) {
stretch *= factor;
}
inline void SetPosition( Vec2D position ) {
this->position = position;
}
inline Vec2D GetPosition() const {
return position;
}
inline void SetRotation( float rotation ) {
this->rotation = rotation;
}
inline float GetRotation() const {
return rotation;
}
inline void SetRotationPivot( Vec2D rotationPivot ) {
this->rotationPivot = rotationPivot;
}
inline const Vec2D &GetRotationPivot() const {
return rotationPivot;
}
inline void SetStretch( float stretch ) {
this->stretch = stretch;
}
inline float GetStretch() const {
return stretch;
}
inline Placement& operator +( const Vec2D& amount ) {
position += amount;
return *this;
}
inline Placement& operator -( const Vec2D& amount ) {
position -= amount;
return *this;
}
inline Placement& operator +( const Placement& amount ) {
position += amount.position;
rotation += amount.rotation;
stretch *= amount.stretch;
return *this;
}
inline Placement& operator +=( const Placement& amount ) {
position += amount.position;
rotation += amount.rotation;
stretch *= amount.stretch;
return *this;
}
inline Placement& operator -( const Placement& amount ) {
position -= amount.position;
rotation -= amount.rotation;
stretch /= amount.stretch;
return *this;
}
inline Placement& operator -=( const Placement& amount ) {
position += amount.position;
rotation += amount.rotation;
stretch *= amount.stretch;
return *this;
}
// Returns the rotation and stretch in a matrix //
Matrix2D Get2DMatrix() const;
// Applies the placement
inline void Apply() const {
Apply( rotationPivot );
}
// Same as above but overrides the pivot
void Apply( const Vec2D &pivot ) const;
std::string ToString() const;
private:
Vec2D position;
float rotation;
float stretch;
Vec2D rotationPivot;
};
}
#endif // OL_TRANSFORM_MATRIX_HPP
|