25#include <QSharedPointer>
37#define RDEFAULT_MIN1 -1
53 RPolyline(
const QList<RVector>& vertices,
bool closed);
54 RPolyline(
const QList<QSharedPointer<RShape> >& segments);
61 virtual QSharedPointer<RShape>
clone()
const {
62 return QSharedPointer<RShape>(
new RPolyline(*
this));
66 return QSharedPointer<RPolyline>(
new RPolyline(*
this));
73 virtual void setZ(
double z);
83 bool prependShape(
const RShape& shape);
84 bool appendShape(
const RShape& shape,
bool prepend =
false);
85 bool appendShapeAuto(
const RShape& shape);
86 bool appendShapeTrim(
const RShape& shape);
89 void appendVertex(
const RVector& vertex,
double bulge = 0.0,
double w1 = 0.0,
double w2 = 0.0);
90 void appendVertex(
double x,
double y,
double bulge = 0.0,
double w1 = 0.0,
double w2 = 0.0);
91 void prependVertex(
const RVector& vertex,
double bulge = 0.0,
double w1 = 0.0,
double w2 = 0.0);
92 void insertVertex(
int index,
const RVector& vertex,
double bulgeBefore = 0.0,
double bulgeAfter = 0.0);
93 void insertVertexAt(
const RVector& point);
94 RVector insertVertexAtDistance(
double dist);
95 void removeFirstVertex();
96 void removeLastVertex();
97 void removeVertex(
int index);
98 void removeVerticesAfter(
int index);
99 void removeVerticesBefore(
int index);
102 return countVertices()==0;
105 void setVertices(
const QList<RVector>& vertices);
106 QList<RVector> getVertices()
const;
107 void setVertexAt(
int i,
const RVector& v);
108 void moveVertexAt(
int i,
const RVector& offset);
112 int countVertices()
const;
114 void setBulges(
const QList<double>& b);
115 QList<double> getBulges()
const;
116 double getBulgeAt(
int i)
const;
117 void setBulgeAt(
int i,
double b);
118 bool hasArcSegments()
const;
120 QList<double> getVertexAngles()
const;
123 void setGlobalWidth(
double w);
124 void setStartWidthAt(
int i,
double w);
125 double getStartWidthAt(
int i)
const;
126 void setEndWidthAt(
int i,
double w);
127 double getEndWidthAt(
int i)
const;
128 bool hasWidths()
const;
129 void setStartWidths(
const QList<double>& sw);
130 QList<double> getStartWidths()
const;
131 void setEndWidths(
const QList<double>& ew);
132 QList<double> getEndWidths()
const;
134 void setClosed(
bool on);
135 bool isClosed()
const;
138 return toLogicallyClosed(tolerance);
141 bool toLogicallyOpen();
148 RPolyline convertArcToLineSegments(
int segments)
const;
149 RPolyline convertArcToLineSegmentsLength(
double segmentLength)
const;
152 bool containsShape(
const RShape& shape)
const;
154 RVector getPointInside()
const;
160 void moveStartPoint(
const RVector& pos);
161 void moveEndPoint(
const RVector& pos);
163 void moveSegmentAt(
int i,
const RVector& offset);
172 double getArea()
const;
184 double getLengthTo(
const RVector& p,
bool limited =
true)
const;
185 double getSegmentsLength(
int fromIndex,
int toIndex)
const;
193 virtual QList<RVector>
getPointCloud(
double segmentLength)
const;
198 bool limited =
true,
double strictRange =
RMAXDOUBLE)
const;
201 int getClosestSegment(
const RVector& point)
const;
202 int getClosestVertex(
const RVector& point)
const;
213 virtual QSharedPointer<RShape>
getTransformed(
const QTransform& transform)
const;
222 QList<RPolyline> getOutline()
const;
223 QList<QPair<RPolyline, RPolyline> > getLeftRightOutline()
const;
225 QList<QPair<RPolyline, RPolyline> > lr = getLeftRightOutline();
226 QList<RPolyline> ret;
227 for (
int i=0;
i<lr.length();
i++) {
228 ret.append(lr[
i].first);
233 QList<QPair<RPolyline, RPolyline> > lr = getLeftRightOutline();
234 QList<RPolyline> ret;
235 for (
int i=0;
i<lr.length();
i++) {
236 ret.append(lr[
i].second);
243 int countSegments()
const;
244 QSharedPointer<RShape> getSegmentAt(
int i)
const;
245 bool isArcSegmentAt(
int i)
const;
246 QSharedPointer<RShape> getLastSegment()
const;
247 QSharedPointer<RShape> getFirstSegment()
const;
249 static bool isStraight(
double bulge);
251 RPainterPath toPainterPath(
bool addOriginalShapes =
false)
const;
257 void setMinimumWidth(
double w);
259 int getSegmentAtDist(
double dist);
260 bool relocateStartPoint(
const RVector& p);
261 bool relocateStartPoint(
double dist);
262 bool convertToClosed();
263 bool convertToOpen();
270 bool isConcave()
const;
271 QList<RVector> getConvexVertices(
bool convex =
true)
const;
272 QList<RVector> getConcaveVertices()
const;
276 QList<RPolyline> splitAtDiscontinuities(
double tolerance)
const;
277 QList<RPolyline> splitAtSegmentTypeChange()
const;
278 bool insertVerticesAtSelfIntersections();
280 double getBaseAngle()
const;
281 double getWidth()
const;
282 bool setWidth(
double v);
283 double getHeight()
const;
284 bool setHeight(
double v);
287 RPolyline roundAllCorners(
double radius)
const;
288 RPolyline getPolygon(
double segmentLength)
const;
289 RPolyline getPolygonHull(
double angle,
double tolerance,
bool inner =
false)
const;
292 return polylineProxy!=
NULL;
299 if (polylineProxy!=
NULL) {
300 delete polylineProxy;
309 return polylineProxy;
312#if QT_VERSION >= 0x060000
323 bool isLineSegment(
int i)
const;
325 void print(QDebug dbg)
const;
#define RDEFAULT_MIN1
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RExplodable.h:30
#define RNANDOUBLE
Definition RMath.h:74
Q_DECLARE_METATYPE(RMath *)
#define RMAXDOUBLE
Definition RMath.h:66
#define M_PI_4
Definition RMath.h:46
#define RDEFAULT_RVECTOR
Definition RVector.h:38
int i
Copyright (c) 2011-2018 by Andrew Mustun.
Definition autostart.js:32
Represents a box e.g.
Definition RBox.h:46
Interface for explodable shape classes.
Definition RExplodable.h:40
virtual QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const =0
Low-level mathematical representation of a line.
Definition RLine.h:41
Extended painter path with a z-level and a pen.
Definition RPainterPath.h:48
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition RPolyline.h:50
virtual RShape::Type getShapeType() const
Definition RPolyline.h:57
static bool hasProxy()
Definition RPolyline.h:291
QList< double > startWidths
Definition RPolyline.h:337
bool closed
Getter function for this property: isClosed Setter function for this property: setClosed
Definition RPolyline.h:343
static void setPolylineProxy(RPolylineProxy *p)
Definition RPolyline.h:298
QSharedPointer< RPolyline > cloneToPolyline() const
Definition RPolyline.h:65
QList< double > endWidths
Definition RPolyline.h:336
virtual bool isDirected() const
Definition RPolyline.h:69
QList< RVector > vertices
Getter function for this property: getVertices Setter function for this property: setVertices
Definition RPolyline.h:332
QList< RPolyline > getRightOutline() const
Definition RPolyline.h:232
static RPolylineProxy * polylineProxy
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPolyline.h:348
virtual QSharedPointer< RShape > clone() const
Definition RPolyline.h:61
bool isEmpty() const
Definition RPolyline.h:101
QList< double > bulges
Definition RPolyline.h:334
virtual bool isInterpolated() const
Reimplement and return true if this shape relies on interpolation for geometrical operations such as ...
Definition RPolyline.h:240
QList< RPolyline > getLeftOutline() const
Definition RPolyline.h:224
static RPolylineProxy * getPolylineProxy()
Definition RPolyline.h:308
bool autoClose(double tolerance=RS::PointTolerance)
Definition RPolyline.h:137
virtual double getDistanceFromStart(const RVector &p) const
Definition RPolyline.h:176
Proxy for advanced polyline functionality.
Definition RPolylineProxy.h:42
Orientation
Definition RS.h:700
@ UnknownOrientation
Definition RS.h:701
From
End used to specify from which end of a shape to measure a distance.
Definition RS.h:371
@ FromStart
Definition RS.h:372
@ FromAny
Start or end.
Definition RS.h:374
static const double PointTolerance
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RS.h:920
static const double AngleTolerance
Definition RS.h:921
Side
Side used for side of a point relative to an entity (right hand or left hand side)
Definition RS.h:313
Ending
Entity ending.
Definition RS.h:323
Easing
Definition RS.h:722
@ Linear
Definition RS.h:723
Interface for geometrical shape classes.
Definition RShape.h:72
virtual RVector getVectorTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const =0
virtual QList< RVector > getPointCloud(double segmentLength) const =0
virtual bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition RShape.h:309
virtual RVector getStartPoint() const
Definition RShape.h:289
virtual bool stretch(const RBox &area, const RVector &offset)
Definition RShape.cpp:1741
virtual QList< double > getDistancesFromStart(const RVector &p) const
Definition RShape.h:365
virtual QList< RVector > getPointsWithDistanceToEnd(double distance, int from=RS::FromAny) const =0
virtual RVector getEndPoint() const
Definition RShape.h:292
virtual bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition RShape.h:328
Type
Definition RShape.h:74
@ Polyline
Definition RShape.h:81
virtual QList< RVector > getCenterPoints() const =0
virtual bool move(const RVector &offset)=0
virtual QList< double > getDoubleProperties() const
Definition RShape.h:172
virtual double getAngleAt(double distance, RS::From from=RS::FromStart) const
Definition RShape.h:249
virtual bool rotate(double rotation, const RVector ¢er=RDEFAULT_RVECTOR)=0
virtual void print(QDebug dbg) const
Definition RShape.cpp:1760
virtual bool mirror(const RLine &axis)=0
virtual double getDirection1() const
Definition RShape.h:277
virtual QList< RVector > getEndPoints() const =0
virtual RVector getMiddlePoint() const
Definition RShape.h:295
virtual QList< RVector > getSelfIntersectionPoints(double tolerance=RS::PointTolerance) const
Definition RShape.h:268
virtual double getDirection2() const
Definition RShape.h:280
virtual RS::Side getSideOfPoint(const RVector &point) const
Definition RShape.h:284
virtual QList< RVector > getVectorProperties() const
Definition RShape.h:170
virtual RVector getPointAtPercent(double p) const
Definition RShape.cpp:191
virtual QList< RVector > getMiddlePoints() const =0
virtual bool reverse()
Definition RShape.h:299
virtual void setZ(double z)=0
virtual QSharedPointer< RShape > getTransformed(const QTransform &transform) const =0
virtual RBox getBoundingBox() const =0
virtual double getDistanceTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const
Definition RShape.cpp:57
virtual RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition RShape.h:345
virtual bool scale(double scaleFactor, const RVector ¢er=RVector())
Definition RShape.cpp:1756
virtual QList< bool > getBoolProperties() const
Definition RShape.h:173
virtual double getLength() const =0
Represents a 3d vector (x/y/z).
Definition RVector.h:47
static const RVector invalid
invalid vector
Definition RVector.h:335
#define QCADCORE_EXPORT
Definition core_global.h:10
#define NULL
Definition opennurbs_system.h:256