31 CLine2d(
double x1,
double y1,
double x2,
double y2);
270 double* errorFactorPtr =
NULL)
override;
274 double* errorFactorPtr =
NULL)
override;
279 double* errorFactorPtr =
NULL)
const override;
284 double* errorFactorPtr =
NULL)
const override;
307 return ((m_point1 == line.m_point1) && (m_point2 == line.m_point2));
319 return (m_point1 == m_point2);
325 return m_point2 - m_point1;
357 return (linePosY - m_point1.
GetY()) * diff.
GetX() / diff.
GetY() + m_point1.
GetX();
365 return (linePosX - m_point1.
GetX()) * diff.
GetY() / diff.
GetX() + m_point1.
GetY();
401 return QPair<double, double>(dotProduct / deltaLength2, field / ::sqrt(deltaLength2));
408 m_point1 = newBeginPoint;
415 m_point2 = newEndPoint;
Definition of a line in 2D-space.
bool IsIntersectedBy(const CLine2d &line) const
Check if two lines intersect.
virtual bool CopyFrom(const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
virtual QByteArray GetFactoryId() const override
const CVector2d & GetPoint1() const
Get value of first line point.
double GetCutYPos(double linePosX) const
Get X position of cutting this line by specified vertical line.
virtual CRectangle GetBoundingBox() const override
Get bounding box of this shape.
CVector2d GetPositionFromAlpha(double alpha) const
Get position of point using normed 'alpha' value.
double GetSlope() const
Get slope of this line.
double GetCutAlpha(const CLine2d &line) const
Get a proportion of lines cut point to line length (called also 'alpha value').
bool IsNull() const
Returns true, if the line has a length equal 0.
static QByteArray GetTypeName()
void PushEndPointQuiet(const i2d::CVector2d &newEndPoint)
static bool Intersects(const CVector2d &lhsp1, const CVector2d &lhsp2, const CVector2d &rhsp1, const CVector2d &rhsp2)
Check if two lines intersect - a shortcut to avoid the creation of lines, useful in performance-criti...
CLine2d GetShortestConnection(const i2d::CVector2d &point) const
Return a line, which connects the nearest point of line and specified point.
CLine2d GetShortestConnection(const CLine2d &line) const
Return a line, which connects the nearest points of two lines.
double GetDirectionAngle() const
Get direction angle of this line.
bool GetExtendedIntersection(const CLine2d &line, CVector2d &result) const
Get intersection position of extended lines.
virtual CVector2d GetCenter() const override
Returns center of this 2D-object.
double GetMaxDistance(const CVector2d &position) const
Get maximal distance from points of this line to specified position.
virtual istd::TUniqueInterfacePtr< istd::IChangeable > CloneMe(CompatibilityMode mode=CM_WITHOUT_REFS) const override
Make a copy of this object.
bool ApproxFromPoints(const QSet< i2d::CVector2d > &points)
Calculate this line as approximation of set of points.
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.
i2d::CVector2d GetExtendedNearestPoint(const i2d::CVector2d &point) const
Return a point on the straight line in a mathematical sense, which is the nearest to the specified po...
double GetCutXPos(double linePosY) const
Get Y position of cutting this line by specified horizontal line.
virtual bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
bool IsParallel(const CLine2d &line) const
Check if this line is parallel to another one.
virtual int GetSupportedOperations() const override
Get set of flags for supported operations.
double GetLength2() const
Get quadratic distance between line points.
CLine2d GetSwapped() const
Get the line with replaced points (p1 = p2 and p2 = p1)
void PushEndPoint(const i2d::CVector2d &newEndPoint)
Copy end point to begin point and set new end point.
virtual bool InvTransform(const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) override
Do inverse transformation of this object.
const CVector2d & GetPoint2() const
Get value of second line point.
void PushBeginPoint(const i2d::CVector2d &newBeginPoint)
Copy begin point to end point and set new begin point.
double GetLength() const
Get distance between line points.
double GetCastAlpha(const i2d::CVector2d &point) const
bool operator!=(const CLine2d &line) const
virtual void MoveCenterTo(const CVector2d &position) override
Move object to position position.
CLine2d GetShortestConnectionToNext(const CLine2d &line) const
Return a line, which connects the nearest points of two lines.
CVector2d & GetPoint2Ref()
Get reference to second line point.
void SetPoint2(const CVector2d &point)
Set value of second line point.
double GetIntercept() const
Get intercept of this line.
CVector2d GetDiffVector() const
Get difference vector from point 1 to point 2.
void SetPoint1(const CVector2d &point)
Set value of first line point.
void PushBeginPointQuiet(const i2d::CVector2d &newBeginPoint)
Quiet methods do not trigger any notification changes (to be used inside of algorithms)
double GetDistance(const CVector2d &position) const
Get distance from nearest point of this line to specified position.
void SetPoint2Quiet(const CVector2d &point)
bool operator==(const CLine2d &line) const
CLine2d GetShortestEndConnection(const CLine2d &line) const
Return a line, which connects the nearest end points of two lines.
CLine2d(double x1, double y1, double x2, double y2)
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.
QPair< double, double > GetAlphaAndCastDistance(const i2d::CVector2d &point) const
Get projection position 'alpha value' and orthogonal distance to line.
void SetPoint1Quiet(const CVector2d &point)
bool GetIntersection(const CLine2d &line, CVector2d &result) const
Get intersection position of two lines.
CLine2d GetClipped(const CRectangle &rect) const
Get part of line intersecting specified rectangle.
i2d::CVector2d GetNearestPoint(const i2d::CVector2d &point) const
Return a line point, which is the nearest to the specified point.
double GetExtendedDistance(const CVector2d &position) const
Get distance from nearest point of extended line to specified position.
CLine2d(const CVector2d &p1, const CVector2d &p2)
virtual bool Transform(const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) override
Transform this object using some transformation.
bool GetCutPoint(const CLine2d &otherLine, i2d::CVector2d &cutPoint) const
Get position where this line intersects the second one.
CVector2d & GetPoint1Ref()
Get reference to first line point.
Base class for 2D-objects implementing interface i2d::IObject2d.
Definition of rectangle area orthogonal to axis of coordination system.
Definition of position or mathematical vector on 2D plane.
double GetY() const
Get Y position of this vector.
double GetX() const
Get X position of this vector.
double GetDotProduct(const CVector2d &vector) const
double GetCrossProductZ(const imath::TVector< 2 > &vector) const
Return Z coordinate of two vectors cross product.
Common interface for describing the 2D-objects.
Element GetLength2() const
Calculates the squared Euclidean length of the vector.
Represents an input/output persistence archive for object serialization.
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
Unique ownership smart pointer for interface types.
uint qHash(const CLine2d &key, uint seed=0)