Seamly2D
Code documentation
VAbstractCubicBezier Class Referenceabstract

#include <vabstractcubicbezier.h>

Inheritance diagram for VAbstractCubicBezier:
Collaboration diagram for VAbstractCubicBezier:

Public Member Functions

 VAbstractCubicBezier (const GOType &type, const quint32 &idObject=null_id, const Draw &mode=Draw::Calculation)
 
 VAbstractCubicBezier (const VAbstractCubicBezier &curve)
 
VAbstractCubicBezieroperator= (const VAbstractCubicBezier &curve)
 
virtual ~VAbstractCubicBezier ()
 
virtual VPointF GetP1 () const =0
 
virtual VPointF GetP2 () const =0
 
virtual VPointF GetP3 () const =0
 
virtual VPointF GetP4 () const =0
 
QPointF CutSpline (qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3) const
 CutSpline cut spline. More...
 
virtual QString NameForHistory (const QString &toolName) const Q_DECL_OVERRIDE
 
qreal GetParmT (qreal length) const
 
qreal LengthT (qreal t) const
 
- Public Member Functions inherited from VAbstractBezier
 VAbstractBezier (const GOType &type, const quint32 &idObject=null_id, const Draw &mode=Draw::Calculation)
 
 VAbstractBezier (const VAbstractBezier &curve)
 
VAbstractBezieroperator= (const VAbstractBezier &curve)
 
virtual ~VAbstractBezier ()
 
virtual qreal GetC1Length () const =0
 
virtual qreal GetC2Length () const =0
 
- Public Member Functions inherited from VAbstractCurve
 VAbstractCurve (const GOType &type, const quint32 &idObject=null_id, const Draw &mode=Draw::Calculation)
 
 VAbstractCurve (const VAbstractCurve &curve)
 
virtual ~VAbstractCurve () Q_DECL_OVERRIDE
 
VAbstractCurveoperator= (const VAbstractCurve &curve)
 
void Swap (VAbstractCurve &curve) Q_DECL_NOTHROW
 
virtual QVector< QPointF > getPoints () const =0
 
QVector< QPointF > GetSegmentPoints (const QPointF &begin, const QPointF &end, bool reverse=false) const
 
virtual QPainterPath GetPath () const
 
virtual qreal GetLength () const =0
 
qreal GetLengthByPoint (const QPointF &point) const
 
virtual QVector< QPointF > IntersectLine (const QLineF &line) const
 IntersectLine return list of points for real intersection with line. More...
 
virtual bool IsIntersectLine (const QLineF &line) const
 
bool isPointOnCurve (const QPointF &p) const
 
virtual qreal GetStartAngle () const =0
 
virtual qreal GetEndAngle () const =0
 
quint32 GetDuplicate () const
 
void SetDuplicate (quint32 number)
 
QString getLineColor () const
 
void setLineColor (const QString &color)
 
QString GetPenStyle () const
 
void SetPenStyle (const QString &penStyle)
 
QString getLineWeight () const
 getLineWeight return weight of the lines More...
 
void setLineWeight (const QString &lineWeight)
 setLineWeight set weight of the lines More...
 
QPointF getFirstPoint ()
 
QPointF getLastPoint ()
 
virtual QVector< DirectionArrowDirectionArrows () const
 
- Public Member Functions inherited from VGObject
 VGObject ()
 VGObject default constructor. More...
 
 VGObject (const GOType &type, const quint32 &idObject=0, const Draw &mode=Draw::Calculation)
 VGObject constructor. More...
 
 VGObject (const VGObject &obj)
 VGObject copy constructor. More...
 
virtual ~VGObject ()
 
VGObjectoperator= (const VGObject &obj)
 operator = assignment operator. More...
 
void Swap (VGObject &obj) Q_DECL_NOTHROW
 
quint32 getIdObject () const
 getIdObject return parent id. More...
 
void setIdObject (const quint32 &value)
 setIdObject set parent id. More...
 
virtual QString name () const
 name return name graphical object. More...
 
void setName (const QString &name)
 setName set name graphical object. More...
 
Draw getMode () const
 getMode return mode creation. More...
 
void setMode (const Draw &value)
 setMode set mode creation. More...
 
GOType getType () const
 getType return object type. More...
 
void setType (const GOType &type)
 
quint32 id () const
 id return id object. More...
 
virtual void setId (const quint32 &id)
 setId set id object. More...
 
quint32 getIdTool () const
 

Protected Member Functions

virtual void CreateName () Q_DECL_OVERRIDE
 
virtual QPointF GetControlPoint1 () const =0
 
virtual QPointF GetControlPoint2 () const =0
 

Static Protected Member Functions

static qreal CalcSqDistance (qreal x1, qreal y1, qreal x2, qreal y2)
 CalcSqDistance calculate squared distance. More...
 
static void PointBezier_r (qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4, qint16 level, QVector< qreal > &px, QVector< qreal > &py)
 PointBezier_r find spline point using four point of spline. More...
 
static QVector< QPointF > GetCubicBezierPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4)
 GetCubicBezierPoints return list with cubic bezier curve points. More...
 
static qreal LengthBezier (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4)
 LengthBezier return spline length using 4 spline point. More...
 
- Static Protected Member Functions inherited from VGObject
static QTransform flipTransform (const QLineF &axis)
 

Additional Inherited Members

- Static Public Member Functions inherited from VAbstractCurve
static QVector< QPointF > GetSegmentPoints (const QVector< QPointF > &points, const QPointF &begin, const QPointF &end, bool reverse=false)
 
static bool isPointOnCurve (const QVector< QPointF > &points, const QPointF &p)
 
static qreal PathLength (const QVector< QPointF > &path)
 
static QVector< QPointF > CurveIntersectLine (const QVector< QPointF > &points, const QLineF &line)
 
static QPainterPath ShowDirection (const QVector< DirectionArrow > &arrows, qreal width)
 
- Static Public Member Functions inherited from VGObject
static QLineF BuildLine (const QPointF &p1, const qreal &length, const qreal &angle)
 
static QPointF BuildRay (const QPointF &firstPoint, const qreal &angle, const QRectF &scRect)
 
static QLineF BuildAxis (const QPointF &p, const qreal &angle, const QRectF &scRect)
 
static QLineF BuildAxis (const QPointF &p1, const QPointF &p2, const QRectF &scRect)
 
static int ContactPoints (const QPointF &p, const QPointF &center, qreal radius, QPointF &p1, QPointF &p2)
 
static QPointF LineIntersectRect (const QRectF &rec, const QLineF &line)
 LineIntersectRect find point intersection line and rect. More...
 
static int IntersectionCircles (const QPointF &c1, double r1, const QPointF &c2, double r2, QPointF &p1, QPointF &p2)
 
static qint32 LineIntersectCircle (const QPointF &center, qreal radius, const QLineF &line, QPointF &p1, QPointF &p2)
 LineIntersectCircle find point intersection line and circle. More...
 
static QPointF ClosestPoint (const QLineF &line, const QPointF &point)
 ClosestPoint find point projection of point onto line. More...
 
static QPointF addVector (const QPointF &p, const QPointF &p1, const QPointF &p2, qreal k)
 
static void LineCoefficients (const QLineF &line, qreal *a, qreal *b, qreal *c)
 LineCoefficients coefficient for equation of segment. Segment equestion ax+by+c=0. More...
 
static bool IsPointOnLineSegment (const QPointF &t, const QPointF &p1, const QPointF &p2)
 IsPointOnLineSegment Check if the point is on the line segment. More...
 
static bool IsPointOnLineviaPDP (const QPointF &t, const QPointF &p1, const QPointF &p2)
 IsPointOnLineviaPDP use the perp dot product (PDP) way. More...
 
template<typename T >
static QVector< T > GetReversePoints (const QVector< T > &points)
 GetReversePoint return revers container of points. More...
 
static int GetLengthContour (const QVector< QPointF > &contour, const QVector< QPointF > &newPoints)
 GetLengthContour return length of contour. More...
 
- Static Public Attributes inherited from VAbstractCurve
static const qreal lengthCurveDirectionArrow = 14
 
- Static Public Attributes inherited from VGObject
static const double accuracyPointOnLine = (0.1555 / 25.4) * 96.0
 

Detailed Description

Definition at line 67 of file vabstractcubicbezier.h.

Constructor & Destructor Documentation

◆ VAbstractCubicBezier() [1/2]

VAbstractCubicBezier::VAbstractCubicBezier ( const GOType type,
const quint32 &  idObject = null_id,
const Draw mode = Draw::Calculation 
)

Definition at line 64 of file vabstractcubicbezier.cpp.

◆ VAbstractCubicBezier() [2/2]

VAbstractCubicBezier::VAbstractCubicBezier ( const VAbstractCubicBezier curve)

Definition at line 70 of file vabstractcubicbezier.cpp.

◆ ~VAbstractCubicBezier()

VAbstractCubicBezier::~VAbstractCubicBezier ( )
virtual

Definition at line 87 of file vabstractcubicbezier.cpp.

Member Function Documentation

◆ CalcSqDistance()

qreal VAbstractCubicBezier::CalcSqDistance ( qreal  x1,
qreal  y1,
qreal  x2,
qreal  y2 
)
staticprotected

CalcSqDistance calculate squared distance.

Parameters
x1х coordinate first point.
y1у coordinate first point.
x2х coordinate second point.
y2у coordinate second point.
Returns
squared length.

Definition at line 216 of file vabstractcubicbezier.cpp.

Referenced by PointBezier_r().

◆ CreateName()

void VAbstractCubicBezier::CreateName ( )
protectedvirtual

◆ CutSpline()

QPointF VAbstractCubicBezier::CutSpline ( qreal  length,
QPointF &  spl1p2,
QPointF &  spl1p3,
QPointF &  spl2p2,
QPointF &  spl2p3 
) const

CutSpline cut spline.

Parameters
lengthlength first spline
spl1p2second point of first spline
spl1p3third point of first spline
spl2p2second point of second spline
spl2p3third point of second spline
Returns
point of cutting. This point is forth point of first spline and first point of second spline.

Definition at line 101 of file vabstractcubicbezier.cpp.

References GetControlPoint1(), GetControlPoint2(), VAbstractCurve::GetLength(), GetP1(), GetP4(), GetParmT(), Mm, and ToPixel().

Referenced by VToolCurveIntersectAxis::InitSegments().

◆ GetControlPoint1()

virtual QPointF VAbstractCubicBezier::GetControlPoint1 ( ) const
protectedpure virtual

Implemented in VSpline, and VCubicBezier.

Referenced by CutSpline(), and LengthT().

◆ GetControlPoint2()

virtual QPointF VAbstractCubicBezier::GetControlPoint2 ( ) const
protectedpure virtual

Implemented in VSpline, and VCubicBezier.

Referenced by CutSpline(), and LengthT().

◆ GetCubicBezierPoints()

QVector< QPointF > VAbstractCubicBezier::GetCubicBezierPoints ( const QPointF &  p1,
const QPointF &  p2,
const QPointF &  p3,
const QPointF &  p4 
)
staticprotected

GetCubicBezierPoints return list with cubic bezier curve points.

Parameters
p1first spline point.
p2first control point.
p3second control point.
p4last spline point.
Returns
list of points.

Definition at line 534 of file vabstractcubicbezier.cpp.

References PointBezier_r().

Referenced by VCubicBezier::getPoints(), VSpline::getPoints(), LengthBezier(), and VSpline::SplinePoints().

◆ GetP1()

virtual VPointF VAbstractCubicBezier::GetP1 ( ) const
pure virtual

Implemented in VSpline, and VCubicBezier.

Referenced by CreateName(), CutSpline(), LengthT(), and NameForHistory().

◆ GetP2()

virtual VPointF VAbstractCubicBezier::GetP2 ( ) const
pure virtual

Implemented in VSpline, and VCubicBezier.

◆ GetP3()

virtual VPointF VAbstractCubicBezier::GetP3 ( ) const
pure virtual

Implemented in VSpline, and VCubicBezier.

◆ GetP4()

virtual VPointF VAbstractCubicBezier::GetP4 ( ) const
pure virtual

Implemented in VSpline, and VCubicBezier.

Referenced by CreateName(), CutSpline(), LengthT(), and NameForHistory().

◆ GetParmT()

qreal VAbstractCubicBezier::GetParmT ( qreal  length) const

Definition at line 170 of file vabstractcubicbezier.cpp.

References VAbstractCurve::GetLength(), and LengthT().

Referenced by CutSpline().

◆ LengthBezier()

qreal VAbstractCubicBezier::LengthBezier ( const QPointF &  p1,
const QPointF &  p2,
const QPointF &  p3,
const QPointF &  p4 
)
staticprotected

LengthBezier return spline length using 4 spline point.

Parameters
p1first spline point
p2first control point.
p3second control point.
p4last spline point.
Returns
length.

Definition at line 564 of file vabstractcubicbezier.cpp.

References GetCubicBezierPoints(), and VAbstractCurve::PathLength().

Referenced by VCubicBezier::GetLength(), VSpline::GetLength(), and LengthT().

◆ LengthT()

qreal VAbstractCubicBezier::LengthT ( qreal  t) const

Definition at line 570 of file vabstractcubicbezier.cpp.

References GetControlPoint1(), GetControlPoint2(), GetP1(), GetP4(), and LengthBezier().

Referenced by GetParmT().

◆ NameForHistory()

QString VAbstractCubicBezier::NameForHistory ( const QString &  toolName) const
virtual

◆ operator=()

VAbstractCubicBezier & VAbstractCubicBezier::operator= ( const VAbstractCubicBezier curve)

Definition at line 76 of file vabstractcubicbezier.cpp.

Referenced by VCubicBezier::operator=(), and VSpline::operator=().

◆ PointBezier_r()

void VAbstractCubicBezier::PointBezier_r ( qreal  x1,
qreal  y1,
qreal  x2,
qreal  y2,
qreal  x3,
qreal  y3,
qreal  x4,
qreal  y4,
qint16  level,
QVector< qreal > &  px,
QVector< qreal > &  py 
)
staticprotected

PointBezier_r find spline point using four point of spline.

Parameters
x1х coordinate first point.
y1у coordinate first point.
x2х coordinate first control point.
y2у coordinate first control point.
x3х coordinate second control point.
y3у coordinate second control point.
x4х coordinate last point.
y4у coordinate last point.
levellevel of recursion. In the begin 0.
pxlist х coordinat spline points.
pylist у coordinat spline points.

Definition at line 238 of file vabstractcubicbezier.cpp.

References CalcSqDistance(), and M_2PI.

Referenced by GetCubicBezierPoints().


The documentation for this class was generated from the following files: