PCL
Rotation.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.7.0
6 // ----------------------------------------------------------------------------
7 // pcl/Rotation.h - Released 2024-06-18T15:48:54Z
8 // ----------------------------------------------------------------------------
9 // This file is part of the PixInsight Class Library (PCL).
10 // PCL is a multiplatform C++ framework for development of PixInsight modules.
11 //
12 // Copyright (c) 2003-2024 Pleiades Astrophoto S.L. All Rights Reserved.
13 //
14 // Redistribution and use in both source and binary forms, with or without
15 // modification, is permitted provided that the following conditions are met:
16 //
17 // 1. All redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer.
19 //
20 // 2. All redistributions in binary form must reproduce the above copyright
21 // notice, this list of conditions and the following disclaimer in the
22 // documentation and/or other materials provided with the distribution.
23 //
24 // 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
25 // of their contributors, may be used to endorse or promote products derived
26 // from this software without specific prior written permission. For written
27 // permission, please contact info@pixinsight.com.
28 //
29 // 4. All products derived from this software, in any form whatsoever, must
30 // reproduce the following acknowledgment in the end-user documentation
31 // and/or other materials provided with the product:
32 //
33 // "This product is based on software from the PixInsight project, developed
34 // by Pleiades Astrophoto and its contributors (https://pixinsight.com/)."
35 //
36 // Alternatively, if that is where third-party acknowledgments normally
37 // appear, this acknowledgment must be reproduced in the product itself.
38 //
39 // THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
40 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
41 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
43 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 // EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
45 // INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
46 // DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 // POSSIBILITY OF SUCH DAMAGE.
50 // ----------------------------------------------------------------------------
51 
52 #ifndef __PCL_Rotation_h
53 #define __PCL_Rotation_h
54 
56 
57 #include <pcl/Defs.h>
58 #include <pcl/Diagnostics.h>
59 
61 #include <pcl/ParallelProcess.h>
62 
63 namespace pcl
64 {
65 
66 // ----------------------------------------------------------------------------
67 
75  public ParallelProcess
76 {
77 public:
78 
93  Rotation( PixelInterpolation& p, double angle = 0, double cx = 0, double cy = 0 )
95  , m_angle( angle )
96  , m_center( cx, cy )
97  {
98  }
99 
111  Rotation( PixelInterpolation& p, double angle, const DPoint& center )
113  , m_angle( angle )
114  , m_center( center )
115  {
116  }
117 
121  Rotation( const Rotation& ) = default;
122 
126  double Angle() const
127  {
128  return m_angle;
129  }
130 
134  void SetAngle( double rads )
135  {
136  m_angle = rads;
137  }
138 
143  DPoint Center() const
144  {
145  return m_center;
146  }
147 
152  double CenterX() const
153  {
154  return m_center.x;
155  }
156 
161  double CenterY() const
162  {
163  return m_center.y;
164  }
165 
170  void SetCenter( const DPoint& center )
171  {
172  m_center = center;
173  }
174 
179  void SetCenter( double xc, double yc )
180  {
181  m_center.x = xc; m_center.y = yc;
182  }
183 
195  bool IsUnclipped() const
196  {
197  return m_unclipped;
198  }
199 
204  void EnableUnclippedRotation( bool enable = true )
205  {
206  m_unclipped = enable;
207  }
208 
213  void DisableUnclippedRotation( bool disable = true )
214  {
215  EnableUnclippedRotation( !disable );
216  }
217 
224  const DVector& FillValues() const
225  {
226  return m_fillValues;
227  }
228 
241  void SetFillValues( const DVector& fillValues )
242  {
243  m_fillValues = fillValues;
244  }
245 
248  void GetNewSizes( int& width, int& height ) const override;
249 
252  bool SupportsGammaCorrection() const override
253  {
254  return true;
255  }
256 
257 protected:
258 
259  double m_angle = 0; // radians
260  bool m_unclipped = false;
261  DPoint m_center = DPoint( 0 );
262  DVector m_fillValues;
263 
264  // Inherited from ImageTransformation.
265  void Apply( pcl::Image& ) const override;
266  void Apply( pcl::DImage& ) const override;
267  void Apply( pcl::UInt8Image& ) const override;
268  void Apply( pcl::UInt16Image& ) const override;
269  void Apply( pcl::UInt32Image& ) const override;
270 };
271 
272 // ----------------------------------------------------------------------------
273 
274 } // pcl
275 
276 #endif // __PCL_Rotation_h
277 
278 // ----------------------------------------------------------------------------
279 // EOF pcl/Rotation.h - Released 2024-06-18T15:48:54Z
Implements a generic, two-dimensional, shared or local image.
Definition: Image.h:278
A generic point in the two-dimensional space.
Definition: Point.h:100
Generic vector of arbitrary length.
Definition: Vector.h:107
Abstract base class of all PCL interpolating geometric image transformations.
A process using multiple concurrent execution threads.
Abstract root base class for all pixel interpolation algorithms.
Image rotation algorithm.
Definition: Rotation.h:76
const DVector & FillValues() const
Definition: Rotation.h:224
double Angle() const
Definition: Rotation.h:126
Rotation(PixelInterpolation &p, double angle=0, double cx=0, double cy=0)
Definition: Rotation.h:93
void Apply(pcl::UInt8Image &) const override
void SetAngle(double rads)
Definition: Rotation.h:134
Rotation(const Rotation &)=default
void DisableUnclippedRotation(bool disable=true)
Definition: Rotation.h:213
Rotation(PixelInterpolation &p, double angle, const DPoint &center)
Definition: Rotation.h:111
double CenterY() const
Definition: Rotation.h:161
DPoint Center() const
Definition: Rotation.h:143
void Apply(pcl::Image &) const override
void SetCenter(const DPoint &center)
Definition: Rotation.h:170
void EnableUnclippedRotation(bool enable=true)
Definition: Rotation.h:204
void SetFillValues(const DVector &fillValues)
Definition: Rotation.h:241
void Apply(pcl::UInt32Image &) const override
void GetNewSizes(int &width, int &height) const override
double CenterX() const
Definition: Rotation.h:152
void Apply(pcl::DImage &) const override
bool IsUnclipped() const
Definition: Rotation.h:195
void SetCenter(double xc, double yc)
Definition: Rotation.h:179
void Apply(pcl::UInt16Image &) const override
PCL root namespace.
Definition: AbstractImage.h:77