ICF 3.1.1.10
Technical documentation of ICF Libraries
CCircle.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9#include <i2d/CPosition2d.h>
10#include <i2d/CLine2d.h>
11
12
13namespace i2d
14{
15
16
17class CRectangle;
18class CPolygon;
19
20
25class CCircle: public CPosition2d
26{
27public:
29
30 static QByteArray GetTypeName();
31
33 CCircle(double radius, const CVector2d& center);
34
35 double GetRadius() const;
36 void SetRadius(double radius);
37
38 bool operator==(const CCircle& circle) const;
39 bool operator!=(const CCircle& circle) const;
40
45 virtual bool ConvertToPolygon(i2d::CPolygon& result, int segmentsCount = 0) const;
46
52 bool IsIntersectedBy(const CCircle& circle, bool isFilled = false) const;
53
59 bool IsIntersectedBy(const CLine2d& line, bool isFilled = false) const;
60
69 int GetIntersectionAlphas(const CLine2d& line, double result[2]) const;
70
78 int GetIntersectionPoints(const CLine2d& line, i2d::CVector2d& result1, i2d::CVector2d& result2) const;
79
80 // reimplemented (i2d::IObject2d)
81 CRectangle GetBoundingBox() const override;
82 virtual bool Transform(
83 const ITransformation2d& transformation,
85 double* errorFactorPtr = nullptr) override;
86 virtual bool InvTransform(
87 const ITransformation2d& transformation,
89 double* errorFactorPtr = nullptr) override;
90 virtual bool GetTransformed(
91 const ITransformation2d& transformation,
92 IObject2d& result,
94 double* errorFactorPtr = nullptr) const override;
95 virtual bool GetInvTransformed(
96 const ITransformation2d& transformation,
97 IObject2d& result,
99 double* errorFactorPtr = nullptr) const override;
100
101 // reimplemented (iser::IObject)
102 QByteArray GetFactoryId() const override;
103
104 // reimplemented istd::IChangeable
105 int GetSupportedOperations() const override;
106 bool CopyFrom(const IChangeable& object, CompatibilityMode mode = CM_WITHOUT_REFS) override;
107 std::unique_ptr<istd::IChangeable> CloneMe(CompatibilityMode mode = CM_WITHOUT_REFS) const override;
108
109 // reimplemented (iser::ISerializable)
110 bool Serialize(iser::IArchive& archive) override;
111
112protected:
113 double m_radius;
114};
115
116
117// inline methods
118
119inline double CCircle::GetRadius() const
120{
121 return m_radius;
122}
123
124
125} // namespace i2d
126
127
Definition of graphical circle object.
Definition CCircle.h:26
virtual bool ConvertToPolygon(i2d::CPolygon &result, int segmentsCount=0) const
Performs conversion of the circle splitting it to segmentsCount segments to the polygon result.
bool operator!=(const CCircle &circle) const
static QByteArray GetTypeName()
void SetRadius(double radius)
CRectangle GetBoundingBox() const override
Get bounding box of this shape.
bool CopyFrom(const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
bool IsIntersectedBy(const CCircle &circle, bool isFilled=false) const
Check if this circle is intersected by another circle (or disk).
int GetIntersectionPoints(const CLine2d &line, i2d::CVector2d &result1, i2d::CVector2d &result2) const
Get points of intersection circle by line.
virtual bool InvTransform(const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) override
Do inverse transformation of this object.
double m_radius
Definition CCircle.h:113
std::unique_ptr< istd::IChangeable > CloneMe(CompatibilityMode mode=CM_WITHOUT_REFS) const override
Make a copy of this object.
int GetSupportedOperations() const override
Get set of flags for supported operations.
CPosition2d BaseClass
Definition CCircle.h:28
virtual bool GetInvTransformed(const ITransformation2d &transformation, IObject2d &result, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) const override
Calulate inverse transformation of the object into second one.
double GetRadius() const
Definition CCircle.h:119
int GetIntersectionAlphas(const CLine2d &line, double result[2]) const
Get points of intersection circle by line.
bool operator==(const CCircle &circle) const
virtual bool Transform(const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) override
Transform this object using some transformation.
bool IsIntersectedBy(const CLine2d &line, bool isFilled=false) const
Check if this circle is intersected by line.
CCircle(double radius, const CVector2d &center)
bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
virtual bool GetTransformed(const ITransformation2d &transformation, IObject2d &result, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) const override
Calulate transformation of the object into second one.
QByteArray GetFactoryId() const override
Definition of a line in 2D-space.
Definition CLine2d.h:26
Definition of the data model for a polygon.
Definition CPolygon.h:24
Definition of graphical point object.
Definition CPosition2d.h:22
Definition of rectangle area orthogonal to axis of coordination system.
Definition CRectangle.h:31
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
Common interface for describing the 2D-objects.
Definition IObject2d.h:30
Common interface for all calibration objects.
@ EM_NONE
There are no preferences, should be automatically selected.
Represent input/output persistence archive.
Definition IArchive.h:34
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
Contains the 2D objects.
Definition CAffine2d.h:15

© Witold Gantzke and Kirill Lepskiy