ACF $AcfVersion:0$
CQuadrangle.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// ACF includes
6#include <i2d/CObject2dBase.h>
7#include <i2d/CLine2d.h>
8#include <i2d/CRectangle.h>
9
10
11namespace i2d
12{
13
14
19{
20public:
22 CQuadrangle(const CLine2d& firstDiagonal, const CLine2d& secondDiagonal);
23 explicit CQuadrangle(const CRectangle& rectangle);
24
25 bool operator==(const CQuadrangle& quadrangle) const;
26 bool operator!=(const CQuadrangle& quadrangle) const;
27
28 bool IsQuadrangleValid() const;
29 bool IsQuadrangleEmpty() const;
30
31 const CLine2d& GetFirstDiagonal() const;
32 void SetFirstDiagonal(const CLine2d& firstDiagonal);
33
34 const CLine2d& GetSecondDiagonal() const;
35 void SetSecondDiagonal(const CLine2d& secondDiagonal);
36
37 // reimplemented (i2d::IObject2d)
38 virtual CVector2d GetCenter() const override;
39 virtual void MoveCenterTo(const CVector2d& position) override;
40 virtual CRectangle GetBoundingBox() const override;
41 virtual bool Transform(
42 const ITransformation2d& transformation,
44 double* errorFactorPtr = NULL) override;
45 virtual bool InvTransform(
46 const ITransformation2d& transformation,
48 double* errorFactorPtr = NULL) override;
49 virtual bool GetTransformed(
50 const ITransformation2d& transformation,
51 IObject2d& result,
53 double* errorFactorPtr = NULL) const override;
54 virtual bool GetInvTransformed(
55 const ITransformation2d& transformation,
56 IObject2d& result,
58 double* errorFactorPtr = NULL) const override;
59
60 // reimplemented (istd::IChangeable)
61 virtual int GetSupportedOperations() const override;
62 virtual bool CopyFrom(const IChangeable& object, CompatibilityMode mode = CM_WITHOUT_REFS) override;
64
65 // reimplemented (iser::ISerializable)
66 virtual bool Serialize(iser::IArchive& archive) override;
67
68private:
69 CLine2d m_firstDiagonal;
70 CLine2d m_secondDiagonal;
71};
72
73
74} // namespace i2d
75
76
77
78
Definition of a line in 2D-space.
Definition CLine2d.h:25
Base class for 2D-objects implementing interface i2d::IObject2d.
Definition of convexes quadrangle object.
Definition CQuadrangle.h:19
virtual void MoveCenterTo(const CVector2d &position) override
Move object to position position.
void SetSecondDiagonal(const CLine2d &secondDiagonal)
virtual int GetSupportedOperations() const override
Get set of flags for supported operations.
virtual bool GetTransformed(const ITransformation2d &transformation, IObject2d &result, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) const override
Calulate transformation of the object into second one.
virtual bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
bool operator!=(const CQuadrangle &quadrangle) const
virtual bool GetInvTransformed(const ITransformation2d &transformation, IObject2d &result, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) const override
Calulate inverse transformation of the object into second one.
const CLine2d & GetFirstDiagonal() const
bool operator==(const CQuadrangle &quadrangle) const
void SetFirstDiagonal(const CLine2d &firstDiagonal)
virtual CVector2d GetCenter() const override
Returns center of this 2D-object.
virtual bool Transform(const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) override
Transform this object using some transformation.
bool IsQuadrangleValid() const
CQuadrangle(const CLine2d &firstDiagonal, const CLine2d &secondDiagonal)
virtual bool CopyFrom(const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
bool IsQuadrangleEmpty() const
const CLine2d & GetSecondDiagonal() const
virtual CRectangle GetBoundingBox() const override
Get bounding box of this shape.
virtual bool InvTransform(const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) override
Do inverse transformation of this object.
virtual istd::TUniqueInterfacePtr< istd::IChangeable > CloneMe(CompatibilityMode mode=CM_WITHOUT_REFS) const override
Make a copy of this object.
CQuadrangle(const CRectangle &rectangle)
Definition of rectangle area orthogonal to axis of coordination system.
Definition CRectangle.h:27
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
Common interface for describing the 2D-objects.
Definition IObject2d.h:26
Common interface for all calibration objects.
@ EM_NONE
There are no preferences, should be automatically selected.
Represents an input/output persistence archive for object serialization.
Definition IArchive.h:164
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
Unique ownership smart pointer for interface types.
#define NULL
Definition istd.h:74
Contains the 2D objects.
Definition CAffine2d.h:11