26#include <QSharedPointer>
42#ifndef RDEFAULT_TOLERANCE_1E_MIN4
43#define RDEFAULT_TOLERANCE_1E_MIN4 1.0e-4
132 virtual QSharedPointer<RShape>
clone()
const = 0;
148 bool limited =
true,
double strictRange =
RMAXDOUBLE)
const;
162 virtual void setZ(
double z) = 0;
186 bool limited =
true,
double strictRange =
RMAXDOUBLE)
const = 0;
188 virtual double getDistanceTo(
const RVector& point,
bool limited =
true,
double strictRange =
RMAXDOUBLE)
const;
189 virtual double getMaxDistanceTo(
const QList<RVector>& points,
bool limited =
true,
double strictRange =
RMAXDOUBLE)
const;
190 virtual bool isOnShape(
const RVector& point,
193 virtual QList<RVector> filterOnShape(
const QList<RVector>& pointList,
196 virtual RVector getVectorFromEndpointTo(
const RVector& point)
const;
217 return QList<RVector>();
220 virtual RVector getPointOnShape()
const;
228 double distance,
int from =
RS::FromAny)
const = 0;
255 double d = getDistanceFromStart(pos);
256 return getAngleAt(d);
259 virtual RVector getPointAtPercent(
double p)
const;
260 virtual double getAngleAtPercent(
double p)
const;
262 virtual bool intersectsWith(
const RShape& other,
263 bool limited =
true)
const;
266 bool limited =
true,
bool same =
false,
bool force =
false)
const;
270 return QList<RVector>();
318 RVector p = getPointWithDistanceToStart(trimDist);
337 RVector p = getPointWithDistanceToStart(trimDist);
366 return QList<double>() << getDistanceFromStart(p);
374 const RShape& shape2,
bool limited =
true,
bool same =
false,
bool force =
false);
381 virtual bool flipHorizontal();
382 virtual bool flipVertical();
383 virtual bool stretch(
const RBox& area,
const RVector& offset);
386 virtual QSharedPointer<RShape>
getTransformed(
const QTransform& transform)
const = 0;
388 static QList<RPolyline> getPolylines(
const QList<QSharedPointer<RShape> >& shapes);
389 static QList<QSharedPointer<RShape> > getOrderedShapes(
const QList<QSharedPointer<RShape> >& shapes);
390 static bool order(QList<QList<QSharedPointer<RShape> > >& boundary);
393 const RLine& line2,
bool limited =
true) {
394 return getIntersectionPointsLL(line1, line2, limited, limited);
396 static QList<RVector> getIntersectionPointsLL(
const RLine& line1,
397 const RLine& line2,
bool limited1,
bool limited2);
399 const RArc& arc2,
bool limited =
true) {
400 return getIntersectionPointsLA(line1, arc2, limited, limited);
402 static QList<RVector> getIntersectionPointsLA(
const RLine& line1,
403 const RArc& arc2,
bool limited1,
bool limited2);
404 static QList<RVector> getIntersectionPointsLC(
const RLine& line1,
405 const RCircle& circle2,
bool limited =
true);
407 const REllipse& ellipse2,
bool limited =
true) {
408 return getIntersectionPointsLE(line1, ellipse2, limited, limited);
410 static QList<RVector> getIntersectionPointsLE(
const RLine& line1,
411 const REllipse& ellipse2,
bool limited1,
bool limited2);
413 const RTriangle& triangle2,
bool limited =
true) {
414 return getIntersectionPointsLT(line1, triangle2, limited, limited);
416 static QList<RVector> getIntersectionPointsLT(
const RLine& line1,
417 const RTriangle& triangle2,
bool limited1,
bool limited2);
418 static QList<RVector> getIntersectionPointsLS(
const RLine& line1,
419 const RSpline& spline2,
bool limited =
true);
420 static QList<RVector> getIntersectionPointsLX(
const RLine& line1,
421 const RExplodable& explodable2,
bool limited =
true);
423 static QList<RVector> getIntersectionPointsAA(
const RArc& arc1,
424 const RArc& arc2,
bool limited =
true);
425 static QList<RVector> getIntersectionPointsAC(
const RArc& arc1,
426 const RCircle& circle2,
bool limited =
true);
427 static QList<RVector> getIntersectionPointsAE(
const RArc& arc1,
428 const REllipse& ellipse2,
bool limited =
true);
429 static QList<RVector> getIntersectionPointsAT(
const RArc& arc1,
430 const RTriangle& triangle2,
bool limited =
true);
431 static QList<RVector> getIntersectionPointsAS(
const RArc& arc1,
432 const RSpline& spline2,
bool limited =
true);
433 static QList<RVector> getIntersectionPointsAX(
const RArc& arc1,
434 const RExplodable& explodable2,
bool limited =
true);
436 static QList<RVector> getIntersectionPointsCC(
const RCircle& circle1,
438 static QList<RVector> getIntersectionPointsCE(
const RCircle& circle1,
440 static QList<RVector> getIntersectionPointsCS(
const RCircle& circle1,
441 const RSpline& spline2,
bool limited =
true);
442 static QList<RVector> getIntersectionPointsCX(
const RCircle& circle1,
443 const RExplodable& explodable2,
bool limited =
true);
445 static QList<RVector> getIntersectionPointsEE(
const REllipse& ellipse1,
447 static QList<RVector> getIntersectionPointsEE(
const REllipse& ellipse1,
448 const REllipse& ellipse2,
bool limited);
449 static QList<RVector> getIntersectionPointsES(
const REllipse& ellipse1,
450 const RSpline& spline2,
bool limited =
true);
451 static QList<RVector> getIntersectionPointsEX(
const REllipse& ellipse1,
452 const RExplodable& explodable2,
bool limited =
true);
454 static QList<RVector> getIntersectionPointsSX(
const RSpline& spline1,
457 static QList<RVector> getIntersectionPointsSS(
const RSpline& spline1,
460 static QList<RVector> getIntersectionPointsXX(
const RExplodable& explodable1,
461 const RExplodable& explodable2,
bool limited =
true,
bool same =
false);
470 static QList<QSharedPointer<RShape> > getReversedShapeList(
const QList<QSharedPointer<RShape> >& shapes);
472 virtual QList<QSharedPointer<RShape> > splitAt(
const QList<RVector>& points)
const;
474 static QList<QSharedPointer<RShape> >
trim(
476 const RShape& limitingShape,
const RVector& limitingClickPos,
477 bool trimBoth,
bool samePolyline);
479 static QList<QSharedPointer<RShape> > roundCorners(
const QList<QSharedPointer<RShape> >& shapes,
double radius);
481 static QList<QSharedPointer<RShape> > roundShapes(
482 const QSharedPointer<RShape> shape1,
const RVector& clickPos1,
483 const QSharedPointer<RShape> shape2,
const RVector& clickPos2,
484 bool trim,
bool samePolyline,
double radius,
const RVector& pos);
486 static QSharedPointer<RShape>
xLineToRay(QSharedPointer<RShape> shape);
487 static QSharedPointer<RShape>
rayToLine(QSharedPointer<RShape> shape);
491 return transformArc(shape, t);
498 static QSharedPointer<RShape> ellipseToArcCircleEllipse(
const REllipse& ellipse);
512 return shapeProxy!=
NULL;
519 if (shapeProxy!=
NULL) {
533 static double ellipse2tr(
double x,
double y,
double AA,
double BB,
534 double CC,
double DD,
double EE,
double FF);
541 virtual void print(QDebug dbg)
const;
QDebug operator<<(QDebug dbg, const RBox &b)
Stream operator for QDebug.
Definition RBox.cpp:640
#define RNANDOUBLE
Definition RMath.h:74
Q_DECLARE_METATYPE(RMath *)
#define RMAXDOUBLE
Definition RMath.h:66
#define RDEFAULT_TOLERANCE_1E_MIN4
Definition RShape.h:43
#define RDEFAULT_RVECTOR
Definition RVector.h:38
Base class for all arc drawing tools.
Definition Arc.js:18
Base class for all circle drawing tools.
Definition Circle.js:18
Base class for all ellipse drawing tools.
Definition Ellipse.js:18
Base class for all line drawing tools.
Definition Line.js:18
Base class for all point drawing tools.
Definition Point.js:18
Base class for all polyline drawing tools.
Definition Polyline.js:19
Low-level mathematical representation of an arc.
Definition RArc.h:42
Represents a box e.g.
Definition RBox.h:46
Low-level mathematical representation of a circle.
Definition RCircle.h:41
Low-level mathematical representation of an ellipse or ellipse arc.
Definition REllipse.h:43
Interface for explodable shape classes.
Definition RExplodable.h:40
Low-level mathematical representation of a line.
Definition RLine.h:41
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition RPolyline.h:50
From
End used to specify from which end of a shape to measure a distance.
Definition RS.h:371
@ AlongPolyline
Definition RS.h:375
@ FromStart
Definition RS.h:372
@ FromAny
Start or end.
Definition RS.h:374
@ FromEnd
Definition RS.h:373
static const double PointTolerance
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RS.h:920
Side
Side used for side of a point relative to an entity (right hand or left hand side)
Definition RS.h:313
@ NoSide
Definition RS.h:314
Ending
Entity ending.
Definition RS.h:323
@ EndingNone
Neither.
Definition RS.h:326
Interface for geometrical shape classes.
Definition RShape.h:72
virtual bool isValid() const
Definition RShape.h:92
virtual double getDistanceFromStart(const RVector &p) const
Definition RShape.h:356
virtual bool trimEndPoint(double trimDist)
Definition RShape.h:336
static bool isArcShape(const RShape &s)
Definition RShape.h:106
virtual RVector getVectorTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const =0
virtual QList< RVector > getPointCloud(double segmentLength) const =0
virtual QSharedPointer< RShape > clone() const =0
static int getErrorCode()
Definition RShape.h:500
virtual bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition RShape.h:309
static QList< RVector > getIntersectionPointsLA(const RLine &line1, const RArc &arc2, bool limited=true)
Definition RShape.h:398
virtual RVector getStartPoint() const
Definition RShape.h:289
virtual QList< RVector > getArcReferencePoints() const
Definition RShape.h:216
virtual QList< double > getDistancesFromStart(const RVector &p) const
Definition RShape.h:365
virtual bool scale(const RVector &scaleFactors, const RVector ¢er=RVector())=0
virtual RVector getPointWithDistanceToStart(double distance) const
Definition RShape.h:230
static bool isRayShape(const RShape &s)
Definition RShape.h:128
virtual bool trimStartPoint(double trimDist)
Definition RShape.h:317
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
static bool isEllipseShape(const RShape &s)
Definition RShape.h:112
static bool hasProxy()
Definition RShape.h:511
Type
Definition RShape.h:74
@ Polyline
Definition RShape.h:81
@ Ellipse
Definition RShape.h:80
@ Arc
Definition RShape.h:78
@ Ray
Definition RShape.h:85
@ Circle
Definition RShape.h:79
@ XLine
Definition RShape.h:84
@ Triangle
Definition RShape.h:83
@ Point
Definition RShape.h:76
@ Line
Definition RShape.h:77
@ Spline
Definition RShape.h:82
static double epsTolerance
Definition RShape.h:538
virtual QList< RVector > getCenterPoints() const =0
virtual bool move(const RVector &offset)=0
virtual QList< double > getDoubleProperties() const
Definition RShape.h:172
virtual bool isInterpolated() const
Reimplement and return true if this shape relies on interpolation for geometrical operations such as ...
Definition RShape.h:143
static QList< RVector > getIntersectionPointsLE(const RLine &line1, const REllipse &ellipse2, bool limited=true)
Definition RShape.h:406
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
static bool isPointShape(const RShape &s)
Definition RShape.h:100
static bool isPolylineShape(const RShape &s)
Definition RShape.h:116
static bool isTriangleShape(const RShape &s)
Definition RShape.h:122
virtual bool mirror(const RLine &axis)=0
static bool isCircleShape(const RShape &s)
Definition RShape.h:109
virtual double getDirection1() const
Definition RShape.h:277
virtual QList< RVector > getEndPoints() const =0
virtual RVector getMiddlePoint() const
Definition RShape.h:295
virtual bool isDirected() const
Definition RShape.h:273
static RShapeProxy * shapeProxy
Definition RShape.h:545
virtual QList< RVector > getSelfIntersectionPoints(double tolerance=RS::PointTolerance) const
Definition RShape.h:268
static QSharedPointer< RShape > scaleArc(const RShape &shape, const RVector &scaleFactors, const RVector ¢er=RDEFAULT_RVECTOR)
Definition RShape.h:489
static double twopi
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RShape.h:537
virtual double getAngleAtPoint(const RVector &pos) const
Definition RShape.h:254
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 getPointWithDistanceToEnd(double distance) const
Definition RShape.h:238
static QList< RVector > getIntersectionPointsLT(const RLine &line1, const RTriangle &triangle2, bool limited=true)
Definition RShape.h:412
virtual QList< RVector > getMiddlePoints() const =0
static void setShapeProxy(RShapeProxy *p)
Definition RShape.h:518
virtual bool reverse()
Definition RShape.h:299
static bool isSplineShape(const RShape &s)
Definition RShape.h:119
virtual void setZ(double z)=0
virtual RShape::Type getShapeType() const
Definition RShape.h:96
virtual QSharedPointer< RShape > getTransformed(const QTransform &transform) const =0
virtual RBox getBoundingBox() const =0
static bool isXLineShape(const RShape &s)
Definition RShape.h:125
static int errorCode
Definition RShape.h:542
virtual QList< int > getIntProperties() const
Definition RShape.h:171
virtual void to2D()
Flattens this shape to the X/Y plane.
Definition RShape.h:158
static bool isLineShape(const RShape &s)
Definition RShape.h:103
static QList< RVector > getIntersectionPointsLL(const RLine &line1, const RLine &line2, bool limited=true)
Definition RShape.h:392
static RShapeProxy * getShapeProxy()
Definition RShape.h:528
virtual RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition RShape.h:345
virtual QList< bool > getBoolProperties() const
Definition RShape.h:173
virtual double getLength() const =0
Proxy for advanced shape functionality.
Definition RShapeProxy.h:36
Low-level mathematical representation of a spline.
Definition RSpline.h:59
Low-level mathematical representation of a triangle.
Definition RTriangle.h:49
Represents a 3d vector (x/y/z).
Definition RVector.h:47
RVector getScaled(const RVector &factors, const RVector ¢er) const
Definition RVector.cpp:398
static const RVector invalid
invalid vector
Definition RVector.h:335
Base class for all spline drawing tools.
Definition Spline.js:18
#define QCADCORE_EXPORT
Definition core_global.h:10
void trim(void trimEntity, void trimClickPos, void limitingEntity, void limitingClickPos, void trimBoth)
Trims the given entity / entities or shape(s).
Definition simple_modify.js:78
void scale(void e, void factor, void focusPoint)
Scales the given entity or shape by the given factor with the given focus point.
Definition simple_modify.js:15
void getIntersectionPoints(void e1, void e2, void limited)
Returns intersection points between the two given entities or shapes.
Definition simple_info.js:12
void trimEndPoint(void shape, void trimPoint, void clickPoint)
Definition library.js:872
void rayToLine(void ray)
Definition library.js:851
void isFullEllipseShape(void obj)
Checks if the given object is a full ellipse shape.
Definition library.js:446
void trimStartPoint(void shape, void trimPoint, void clickPoint)
Definition library.js:954
void xLineToRay(void xline)
Definition library.js:88
char s
Definition opennurbs_string.cpp:32
#define NULL
Definition opennurbs_system.h:256
#define const
Definition zconf.h:156