QCAD
Open Source 2D CAD
RShape Class Referenceabstract

Interface for geometrical shape classes. More...

#include <RShape.h>

Inheritance diagram for RShape:
RArc RCircle REllipse RLine RPoint RPolyline RSpline RTriangle RXLine

Public Types

enum  Type {
  Unknown = -1, Point = 0, Line = 1, Arc = 2,
  Circle = 3, Ellipse = 4, Polyline = 5, Spline = 6,
  Triangle = 7, XLine = 8, Ray = 9
}
 

Public Member Functions

virtual RShapeclone () const =0
 
void dump () const
 
virtual bool equals (const RShape &other, double tolerance=RS::PointTolerance) const
 
virtual QList< RVectorfilterOnShape (const QList< RVector > &pointList, bool limited=true, double tolerance=RDEFAULT_TOLERANCE_1E_MIN4) const
 
virtual bool flipHorizontal ()
 
virtual bool flipVertical ()
 
virtual double getAngleAt (double distance, RS::From from=RS::FromStart) const
 
virtual double getAngleAtPercent (double p) const
 
virtual double getAngleAtPoint (const RVector &pos) const
 
virtual QList< RVectorgetArcReferencePoints () const
 
virtual QList< bool > getBoolProperties () const
 
virtual RBox getBoundingBox () const =0
 
virtual QList< RVectorgetCenterPoints () const =0
 
virtual RVector getClosestPointOnShape (const RVector &p, bool limited=true, double strictRange=RMAXDOUBLE) const
 
virtual double getDirection1 () const
 
virtual double getDirection2 () const
 
virtual double getDistanceFromStart (const RVector &p) const
 
virtual QList< double > getDistancesFromStart (const RVector &p) const
 
virtual double getDistanceTo (const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const
 
virtual QList< double > getDoubleProperties () const
 
virtual RVector getEndPoint () const
 
virtual QList< RVectorgetEndPoints () const =0
 
QList< RVectorgetIntersectionPoints (const RShape &other, bool limited=true, bool same=false, bool force=false) const
 
virtual QList< int > getIntProperties () const
 
virtual double getLength () const =0
 
virtual double getMaxDistanceTo (const QList< RVector > &points, bool limited=true, double strictRange=RMAXDOUBLE) const
 
virtual RVector getMiddlePoint () const
 
virtual QList< RVectorgetMiddlePoints () const =0
 
virtual QList< QSharedPointer< RShape > > getOffsetShapes (double distance, int number, RS::Side side, const RVector &position=RVector::invalid)
 
virtual RVector getPointAtPercent (double p) const
 
virtual QList< RVectorgetPointCloud (double segmentLength) const =0
 
virtual RVector getPointOnShape () const
 
virtual QList< RVectorgetPointsWithDistanceToEnd (double distance, int from=RS::FromAny) const =0
 
virtual RVector getPointWithDistanceToEnd (double distance) const
 
virtual RVector getPointWithDistanceToStart (double distance) const
 
virtual QList< RVectorgetSelfIntersectionPoints () const
 
virtual RShape::Type getShapeType () const
 
virtual RS::Side getSideOfPoint (const RVector &point) const
 
virtual RVector getStartPoint () const
 
virtual QSharedPointer< RShapegetTransformed (const QTransform &transform) const =0
 
virtual RS::Ending getTrimEnd (const RVector &trimPoint, const RVector &clickPoint)
 
virtual RVector getVectorFromEndpointTo (const RVector &point) const
 
virtual QList< RVectorgetVectorProperties () const
 
virtual RVector getVectorTo (const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const =0
 
virtual bool intersectsWith (const RShape &other, bool limited=true) const
 
virtual bool isDirected () const
 
virtual bool isInterpolated () const
 Reimplement and return true if this shape relies on interpolation for geometrical operations such as finding intersection points. More...
 
virtual bool isOnShape (const RVector &point, bool limited=true, double tolerance=RDEFAULT_TOLERANCE_1E_MIN4) const
 
virtual bool mirror (const RLine &axis)=0
 
virtual bool move (const RVector &offset)=0
 
virtual bool reverse ()
 
virtual bool rotate (double rotation, const RVector &center=RDEFAULT_RVECTOR)=0
 
 RShape ()
 
virtual bool scale (const RVector &scaleFactors, const RVector &center=RVector())=0
 
virtual bool scale (double scaleFactor, const RVector &center=RVector())
 
virtual void setZ (double z)=0
 
virtual QList< QSharedPointer< RShape > > splitAt (const QList< RVector > &points) const
 
virtual bool stretch (const RBox &area, const RVector &offset)
 
virtual bool stretch (const RPolyline &area, const RVector &offset)
 
virtual void to2D ()
 Flattens this shape to the X/Y plane. More...
 
virtual bool trimEndPoint (const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
 
virtual bool trimEndPoint (double trimDist)
 
virtual bool trimStartPoint (const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
 
virtual bool trimStartPoint (double trimDist)
 
virtual ~RShape ()
 

Static Public Member Functions

static const RExplodablecastToExplodable (const RShape *shape)
 
static QSharedPointer< RShapeellipseToArcCircleEllipse (const REllipse &ellipse)
 
static int getErrorCode ()
 
static QList< RVectorgetIntersectionPoints (const RShape &shape1, const RShape &shape2, bool limited=true, bool same=false, bool force=false)
 
static QList< RVectorgetIntersectionPointsAA (const RArc &arc1, const RArc &arc2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsAC (const RArc &arc1, const RCircle &circle2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsAE (const RArc &arc1, const REllipse &ellipse2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsAS (const RArc &arc1, const RSpline &spline2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsAT (const RArc &arc1, const RTriangle &triangle2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsAX (const RArc &arc1, const RExplodable &explodable2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsCC (const RCircle &circle1, const RCircle &circle2)
 
static QList< RVectorgetIntersectionPointsCE (const RCircle &circle1, const REllipse &ellipse2)
 
static QList< RVectorgetIntersectionPointsCS (const RCircle &circle1, const RSpline &spline2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsCX (const RCircle &circle1, const RExplodable &explodable2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsEE (const REllipse &ellipse1, const REllipse &ellipse2)
 Based on "Hughes and Chraibi (2011-2012), Calculating Ellipse Overlap Areas". More...
 
static QList< RVectorgetIntersectionPointsEE (const REllipse &ellipse1, const REllipse &ellipse2, bool limited)
 
static QList< RVectorgetIntersectionPointsES (const REllipse &ellipse1, const RSpline &spline2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsEX (const REllipse &ellipse1, const RExplodable &explodable2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsLA (const RLine &line1, const RArc &arc2, bool limited1, bool limited2)
 
static QList< RVectorgetIntersectionPointsLA (const RLine &line1, const RArc &arc2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsLC (const RLine &line1, const RCircle &circle2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsLE (const RLine &line1, const REllipse &ellipse2, bool limited1, bool limited2)
 
static QList< RVectorgetIntersectionPointsLE (const RLine &line1, const REllipse &ellipse2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsLL (const RLine &line1, const RLine &line2, bool limited1, bool limited2)
 
static QList< RVectorgetIntersectionPointsLL (const RLine &line1, const RLine &line2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsLS (const RLine &line1, const RSpline &spline2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsLT (const RLine &line1, const RTriangle &triangle2, bool limited1, bool limited2)
 
static QList< RVectorgetIntersectionPointsLT (const RLine &line1, const RTriangle &triangle2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsLX (const RLine &line1, const RExplodable &explodable2, bool limited=true)
 
static QList< RVectorgetIntersectionPointsSS (const RSpline &spline1, const RSpline &spline2, bool limited=true, bool same=false)
 
static QList< RVectorgetIntersectionPointsSX (const RSpline &spline1, const RExplodable &explodable2, bool limited)
 
static QList< RVectorgetIntersectionPointsXX (const RExplodable &explodable1, const RExplodable &explodable2, bool limited=true, bool same=false)
 
static QList< QSharedPointer< RShape > > getOffsetArcs (const RShape &shape, double distance, int number, RS::Side side, const RVector &position=RVector::invalid)
 
static QList< QSharedPointer< RShape > > getOffsetLines (const RShape &shape, double distance, int number, RS::Side side, const RVector &position=RVector::invalid)
 
static QList< QSharedPointer< RShape > > getReversedShapeList (const QList< QSharedPointer< RShape > > &shapes)
 
static RShapeProxygetShapeProxy ()
 
static bool hasProxy ()
 
static bool isArcShape (const RShape &s)
 
static bool isCircleShape (const RShape &s)
 
static bool isEllipseShape (const RShape &s)
 
static bool isFullEllipseShape (const RShape &s)
 
static bool isLineShape (const RShape &s)
 
static bool isPointShape (const RShape &s)
 
static bool isPolylineShape (const RShape &s)
 
static bool isRayShape (const RShape &s)
 
static bool isSplineShape (const RShape &s)
 
static bool isTriangleShape (const RShape &s)
 
static bool isXLineShape (const RShape &s)
 
static bool order (QList< QList< QSharedPointer< RShape > > > &boundary)
 Orders the given list of loops into a list of closed loops in which all shapes are connected end to start point. More...
 
static QSharedPointer< RShaperayToLine (QSharedPointer< RShape > shape)
 
static QList< QSharedPointer< RShape > > roundAllCorners (const QList< QSharedPointer< RShape > > &shapes, double radius)
 Round every corner of the list of given (connected) shapes with the given radius. More...
 
static QList< QSharedPointer< RShape > > roundShapes (const QSharedPointer< RShape > shape1, const RVector &clickPos1, const QSharedPointer< RShape > shape2, const RVector &clickPos2, bool trim, bool samePolyline, double radius, const RVector &pos)
 Rounds the given shape1 against shape2. More...
 
static QSharedPointer< RShapescaleArc (const RShape &shape, const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)
 
static void setShapeProxy (RShapeProxy *p)
 
static QSharedPointer< RShapetransformArc (const RShape &shape, RShapeTransformation &transformation)
 
static QList< QSharedPointer< RShape > > trim (const RShape &trimShape, const RVector &trimClickPos, const RShape &limitingShape, const RVector &limitingClickPos, bool trimBoth, bool samePolyline)
 Trims a shape to another or two shapes to each other. More...
 
static QSharedPointer< RShapexLineToRay (QSharedPointer< RShape > shape)
 

Protected Member Functions

virtual void print (QDebug dbg) const
 

Static Protected Attributes

static int errorCode = 0
 

Static Private Member Functions

static double ellipse2tr (double x, double y, double AA, double BB, double CC, double DD, double EE, double FF)
 

Static Private Attributes

static double epsTolerance = 1.0e-02
 
static RShapeProxyshapeProxy = NULL
 
static double twopi = M_PI*2
 Copyright (c) 2011-2018 by Andrew Mustun. More...
 

Friends

QDebug operator<< (QDebug dbg, const RShape &s)
 

Detailed Description

Interface for geometrical shape classes.

Scriptable:\nThis class is available in script environments.\n
Shared Pointer Support:\nObjects can be used in QSharedPointer.\n

Member Enumeration Documentation

◆ Type

Enumerator
Unknown 
Point 
Line 
Arc 
Circle 
Ellipse 
Polyline 
Spline 
Triangle 
XLine 
Ray 

Constructor & Destructor Documentation

◆ RShape()

RShape::RShape ( )
inline

◆ ~RShape()

virtual RShape::~RShape ( )
inlinevirtual

Member Function Documentation

◆ castToExplodable()

const RExplodable * RShape::castToExplodable ( const RShape shape)
static

◆ clone()

virtual RShape* RShape::clone ( ) const
pure virtual

◆ dump()

void RShape::dump ( ) const

◆ ellipse2tr()

double RShape::ellipse2tr ( double  x,
double  y,
double  AA,
double  BB,
double  CC,
double  DD,
double  EE,
double  FF 
)
staticprivate

◆ ellipseToArcCircleEllipse()

QSharedPointer< RShape > RShape::ellipseToArcCircleEllipse ( const REllipse ellipse)
static

◆ equals()

bool RShape::equals ( const RShape other,
double  tolerance = RS::PointTolerance 
) const
virtual

◆ filterOnShape()

QList< RVector > RShape::filterOnShape ( const QList< RVector > &  pointList,
bool  limited = true,
double  tolerance = RDEFAULT_TOLERANCE_1E_MIN4 
) const
virtual
Returns
List of those points in pointList which are on this shape.

◆ flipHorizontal()

bool RShape::flipHorizontal ( )
virtual

Reimplemented in RSpline, RTriangle, RLine, RCircle, and RPoint.

◆ flipVertical()

bool RShape::flipVertical ( )
virtual

Reimplemented in RSpline, RTriangle, RLine, RCircle, and RPoint.

◆ getAngleAt()

virtual double RShape::getAngleAt ( double  distance,
RS::From  from = RS::FromStart 
) const
inlinevirtual
Returns
Angle on the entity at the given distance from the start point.

Reimplemented in RPolyline, RSplineData, RSpline, REllipse, RArc, RCircle, RXLine, RLine, and RPoint.

◆ getAngleAtPercent()

double RShape::getAngleAtPercent ( double  p) const
virtual
Returns
Angle at given percentile.

◆ getAngleAtPoint()

virtual double RShape::getAngleAtPoint ( const RVector pos) const
inlinevirtual

Reimplemented in REllipse.

◆ getArcReferencePoints()

virtual QList<RVector> RShape::getArcReferencePoints ( ) const
inlinevirtual
Returns
The reference point(s) of this shape.

Reimplemented in RArc, and RCircle.

◆ getBoolProperties()

virtual QList<bool> RShape::getBoolProperties ( ) const
inlinevirtual

Reimplemented in RSpline, RPolyline, REllipse, and RArc.

◆ getBoundingBox()

virtual RBox RShape::getBoundingBox ( ) const
pure virtual
Returns
The bounding box of this shape.

Implemented in RPolyline, RSpline, RArc, REllipse, RCircle, RLine, RTriangle, RXLine, RViewportData, and RPoint.

◆ getCenterPoints()

virtual QList<RVector> RShape::getCenterPoints ( ) const
pure virtual
Returns
The center point(s) of this shape.

Implemented in RPolyline, RSpline, RArc, REllipse, RCircle, RTriangle, RXLine, RLine, and RPoint.

◆ getClosestPointOnShape()

RVector RShape::getClosestPointOnShape ( const RVector p,
bool  limited = true,
double  strictRange = RMAXDOUBLE 
) const
virtual
Returns
Point on this shape that is closest to p. Based on getVectorTo.

◆ getDirection1()

virtual double RShape::getDirection1 ( ) const
inlinevirtual

◆ getDirection2()

virtual double RShape::getDirection2 ( ) const
inlinevirtual

◆ getDistanceFromStart()

virtual double RShape::getDistanceFromStart ( const RVector p) const
inlinevirtual
Returns
Distance of given point to start point of shape along shape.
Parameters
pPoint (assumed to be on shape).

Reimplemented in RSpline, RPolyline, RArc, RLine, and RXLine.

◆ getDistancesFromStart()

virtual QList<double> RShape::getDistancesFromStart ( const RVector p) const
inlinevirtual
Returns
All possible distances of given point to start point of shape along shape.
Parameters
pPoint (assumed to be on shape).

Reimplemented in RPolyline.

◆ getDistanceTo()

double RShape::getDistanceTo ( const RVector point,
bool  limited = true,
double  strictRange = RMAXDOUBLE 
) const
virtual
Returns
Shortest distance from this shape to the given point. Based on getVectorTo.

Reimplemented in RPolyline, and RTriangle.

◆ getDoubleProperties()

virtual QList<double> RShape::getDoubleProperties ( ) const
inlinevirtual

Reimplemented in RSpline, RPolyline, REllipse, RCircle, and RArc.

◆ getEndPoint()

virtual RVector RShape::getEndPoint ( ) const
inlinevirtual

◆ getEndPoints()

virtual QList<RVector> RShape::getEndPoints ( ) const
pure virtual
Returns
The end point(s) of this shape.

Implemented in RPolyline, RSpline, RArc, REllipse, RCircle, RTriangle, RXLine, RLine, and RPoint.

◆ getErrorCode()

static int RShape::getErrorCode ( )
inlinestatic

◆ getIntersectionPoints() [1/2]

QList< RVector > RShape::getIntersectionPoints ( const RShape other,
bool  limited = true,
bool  same = false,
bool  force = false 
) const
Returns
The intersection point(s) between this shape and the given other shape.

◆ getIntersectionPoints() [2/2]

QList< RVector > RShape::getIntersectionPoints ( const RShape shape1,
const RShape shape2,
bool  limited = true,
bool  same = false,
bool  force = false 
)
static
Returns
The intersection point(s) between this shape and the given other shape.

◆ getIntersectionPointsAA()

QList< RVector > RShape::getIntersectionPointsAA ( const RArc arc1,
const RArc arc2,
bool  limited = true 
)
static

◆ getIntersectionPointsAC()

QList< RVector > RShape::getIntersectionPointsAC ( const RArc arc1,
const RCircle circle2,
bool  limited = true 
)
static

◆ getIntersectionPointsAE()

QList< RVector > RShape::getIntersectionPointsAE ( const RArc arc1,
const REllipse ellipse2,
bool  limited = true 
)
static

◆ getIntersectionPointsAS()

QList< RVector > RShape::getIntersectionPointsAS ( const RArc arc1,
const RSpline spline2,
bool  limited = true 
)
static

◆ getIntersectionPointsAT()

QList< RVector > RShape::getIntersectionPointsAT ( const RArc arc1,
const RTriangle triangle2,
bool  limited = true 
)
static

◆ getIntersectionPointsAX()

QList< RVector > RShape::getIntersectionPointsAX ( const RArc arc1,
const RExplodable explodable2,
bool  limited = true 
)
static

◆ getIntersectionPointsCC()

QList< RVector > RShape::getIntersectionPointsCC ( const RCircle circle1,
const RCircle circle2 
)
static

◆ getIntersectionPointsCE()

QList< RVector > RShape::getIntersectionPointsCE ( const RCircle circle1,
const REllipse ellipse2 
)
static

◆ getIntersectionPointsCS()

QList< RVector > RShape::getIntersectionPointsCS ( const RCircle circle1,
const RSpline spline2,
bool  limited = true 
)
static

◆ getIntersectionPointsCX()

QList< RVector > RShape::getIntersectionPointsCX ( const RCircle circle1,
const RExplodable explodable2,
bool  limited = true 
)
static

◆ getIntersectionPointsEE() [1/2]

QList< RVector > RShape::getIntersectionPointsEE ( const REllipse ellipse1,
const REllipse ellipse2 
)
static

Based on "Hughes and Chraibi (2011-2012), Calculating Ellipse Overlap Areas".

◆ getIntersectionPointsEE() [2/2]

QList< RVector > RShape::getIntersectionPointsEE ( const REllipse ellipse1,
const REllipse ellipse2,
bool  limited 
)
static

◆ getIntersectionPointsES()

QList< RVector > RShape::getIntersectionPointsES ( const REllipse ellipse1,
const RSpline spline2,
bool  limited = true 
)
static

◆ getIntersectionPointsEX()

QList< RVector > RShape::getIntersectionPointsEX ( const REllipse ellipse1,
const RExplodable explodable2,
bool  limited = true 
)
static

◆ getIntersectionPointsLA() [1/2]

QList< RVector > RShape::getIntersectionPointsLA ( const RLine line1,
const RArc arc2,
bool  limited1,
bool  limited2 
)
static

◆ getIntersectionPointsLA() [2/2]

static QList<RVector> RShape::getIntersectionPointsLA ( const RLine line1,
const RArc arc2,
bool  limited = true 
)
inlinestatic

◆ getIntersectionPointsLC()

QList< RVector > RShape::getIntersectionPointsLC ( const RLine line1,
const RCircle circle2,
bool  limited = true 
)
static

◆ getIntersectionPointsLE() [1/2]

QList< RVector > RShape::getIntersectionPointsLE ( const RLine line1,
const REllipse ellipse2,
bool  limited1,
bool  limited2 
)
static

◆ getIntersectionPointsLE() [2/2]

static QList<RVector> RShape::getIntersectionPointsLE ( const RLine line1,
const REllipse ellipse2,
bool  limited = true 
)
inlinestatic

◆ getIntersectionPointsLL() [1/2]

QList< RVector > RShape::getIntersectionPointsLL ( const RLine line1,
const RLine line2,
bool  limited1,
bool  limited2 
)
static

◆ getIntersectionPointsLL() [2/2]

static QList<RVector> RShape::getIntersectionPointsLL ( const RLine line1,
const RLine line2,
bool  limited = true 
)
inlinestatic

◆ getIntersectionPointsLS()

QList< RVector > RShape::getIntersectionPointsLS ( const RLine line1,
const RSpline spline2,
bool  limited = true 
)
static

◆ getIntersectionPointsLT() [1/2]

QList< RVector > RShape::getIntersectionPointsLT ( const RLine line1,
const RTriangle triangle2,
bool  limited1,
bool  limited2 
)
static

◆ getIntersectionPointsLT() [2/2]

static QList<RVector> RShape::getIntersectionPointsLT ( const RLine line1,
const RTriangle triangle2,
bool  limited = true 
)
inlinestatic

◆ getIntersectionPointsLX()

QList< RVector > RShape::getIntersectionPointsLX ( const RLine line1,
const RExplodable explodable2,
bool  limited = true 
)
static

◆ getIntersectionPointsSS()

QList< RVector > RShape::getIntersectionPointsSS ( const RSpline spline1,
const RSpline spline2,
bool  limited = true,
bool  same = false 
)
static

◆ getIntersectionPointsSX()

QList< RVector > RShape::getIntersectionPointsSX ( const RSpline spline1,
const RExplodable explodable2,
bool  limited 
)
static

◆ getIntersectionPointsXX()

QList< RVector > RShape::getIntersectionPointsXX ( const RExplodable explodable1,
const RExplodable explodable2,
bool  limited = true,
bool  same = false 
)
static
Parameters
sameTrue if the two shapes are identical, from the same interpolated shape (e.g. spline).

◆ getIntProperties()

virtual QList<int> RShape::getIntProperties ( ) const
inlinevirtual

Reimplemented in RSpline.

◆ getLength()

virtual double RShape::getLength ( ) const
pure virtual
Returns
The total length of this shape if applicable or NaN if not.

Implemented in RSplineData, RPolyline, RSpline, REllipse, RArc, REllipseData, RArcData, RXLine, RLine, RCircle, RTriangle, and RPoint.

◆ getMaxDistanceTo()

double RShape::getMaxDistanceTo ( const QList< RVector > &  points,
bool  limited = true,
double  strictRange = RMAXDOUBLE 
) const
virtual
Returns
Maximum shortest distance from this shape to any of the given points.

◆ getMiddlePoint()

virtual RVector RShape::getMiddlePoint ( ) const
inlinevirtual

Reimplemented in RSpline, REllipse, RPolyline, RArc, RXLine, and RLine.

◆ getMiddlePoints()

virtual QList<RVector> RShape::getMiddlePoints ( ) const
pure virtual
Returns
The middle point(s) of this shape.

Implemented in RPolyline, RSpline, RArc, REllipse, RCircle, RTriangle, RXLine, RLine, and RPoint.

◆ getOffsetArcs()

QList< QSharedPointer< RShape > > RShape::getOffsetArcs ( const RShape shape,
double  distance,
int  number,
RS::Side  side,
const RVector position = RVector::invalid 
)
static

◆ getOffsetLines()

QList< QSharedPointer< RShape > > RShape::getOffsetLines ( const RShape shape,
double  distance,
int  number,
RS::Side  side,
const RVector position = RVector::invalid 
)
static

◆ getOffsetShapes()

QList< QSharedPointer< RShape > > RShape::getOffsetShapes ( double  distance,
int  number,
RS::Side  side,
const RVector position = RVector::invalid 
)
virtual
Returns
Parallels to this shape.
Parameters
distanceDistance of first parallel or concentric arc or circle.
numberNumber of offset shapes to generate.
sideSide, should be RS.LeftHand or RS.RightHand or RS.BothSides.
sidePositionPosition indicating what side of the shape the parallels should be.

Reimplemented in REllipse, RArc, RLine, RXLine, and RCircle.

◆ getPointAtPercent()

RVector RShape::getPointAtPercent ( double  p) const
virtual
Returns
Point at given percentile.

Reimplemented in RPolyline.

◆ getPointCloud()

virtual QList<RVector> RShape::getPointCloud ( double  segmentLength) const
pure virtual

◆ getPointOnShape()

RVector RShape::getPointOnShape ( ) const
virtual

◆ getPointsWithDistanceToEnd()

virtual QList<RVector> RShape::getPointsWithDistanceToEnd ( double  distance,
int  from = RS::FromAny 
) const
pure virtual
Returns
All points on this shape with the given distance to an endpoint.

Implemented in RPolyline, RSpline, RArc, REllipse, RCircle, RTriangle, RXLine, RLine, RPoint, and RRay.

◆ getPointWithDistanceToEnd()

virtual RVector RShape::getPointWithDistanceToEnd ( double  distance) const
inlinevirtual

◆ getPointWithDistanceToStart()

virtual RVector RShape::getPointWithDistanceToStart ( double  distance) const
inlinevirtual

◆ getReversedShapeList()

QList< QSharedPointer< RShape > > RShape::getReversedShapeList ( const QList< QSharedPointer< RShape > > &  shapes)
static

◆ getSelfIntersectionPoints()

virtual QList<RVector> RShape::getSelfIntersectionPoints ( ) const
inlinevirtual

Reimplemented in RSpline, and RPolyline.

◆ getShapeProxy()

static RShapeProxy* RShape::getShapeProxy ( )
inlinestatic
Non-Scriptable:\nThis function is not available in script environments.\n

◆ getShapeType()

virtual RShape::Type RShape::getShapeType ( ) const
inlinevirtual

◆ getSideOfPoint()

virtual RS::Side RShape::getSideOfPoint ( const RVector point) const
inlinevirtual

◆ getStartPoint()

virtual RVector RShape::getStartPoint ( ) const
inlinevirtual

◆ getTransformed()

virtual QSharedPointer<RShape> RShape::getTransformed ( const QTransform &  transform) const
pure virtual

◆ getTrimEnd()

virtual RS::Ending RShape::getTrimEnd ( const RVector trimPoint,
const RVector clickPoint 
)
inlinevirtual
Parameters
trimPointTrim start point or end point to this coordinate.
clickPointPoint that was clicked by user.

Reimplemented in RPolyline, RSpline, REllipse, RArc, RSplineData, RLine, RXLine, RArcData, RLineData, RXLineData, RRayData, and RSolidData.

◆ getVectorFromEndpointTo()

RVector RShape::getVectorFromEndpointTo ( const RVector point) const
virtual
Returns
Shortest vector from any end point of this shape to the given point.

◆ getVectorProperties()

virtual QList<RVector> RShape::getVectorProperties ( ) const
inlinevirtual

◆ getVectorTo()

virtual RVector RShape::getVectorTo ( const RVector point,
bool  limited = true,
double  strictRange = RMAXDOUBLE 
) const
pure virtual
Returns
Shortest vector from this shape to the given point.
Parameters
pointthe given point
limitedIf false, the shape is treated as an unlimited shape that extends in a logical way. For example an unlimited line for a line, full circle for an arc or a plane for a triangle.

Implemented in RPolyline, RSpline, RArc, RCircle, REllipse, RXLine, RTriangle, RLine, RPoint, and RRay.

◆ hasProxy()

static bool RShape::hasProxy ( )
inlinestatic

◆ intersectsWith()

bool RShape::intersectsWith ( const RShape other,
bool  limited = true 
) const
virtual
Returns
True if this shape intersects with the given shape.

◆ isArcShape()

static bool RShape::isArcShape ( const RShape s)
inlinestatic

◆ isCircleShape()

static bool RShape::isCircleShape ( const RShape s)
inlinestatic

◆ isDirected()

virtual bool RShape::isDirected ( ) const
inlinevirtual

Reimplemented in RSpline, RPolyline, REllipse, RXLine, RArc, and RLine.

◆ isEllipseShape()

static bool RShape::isEllipseShape ( const RShape s)
inlinestatic

◆ isFullEllipseShape()

bool RShape::isFullEllipseShape ( const RShape s)
static

◆ isInterpolated()

virtual bool RShape::isInterpolated ( ) const
inlinevirtual

Reimplement and return true if this shape relies on interpolation for geometrical operations such as finding intersection points.

E.g. splines.

Reimplemented in RPolyline, and RSpline.

◆ isLineShape()

static bool RShape::isLineShape ( const RShape s)
inlinestatic

◆ isOnShape()

bool RShape::isOnShape ( const RVector point,
bool  limited = true,
double  tolerance = RDEFAULT_TOLERANCE_1E_MIN4 
) const
virtual
Returns
true if the given point is on this shape.

Reimplemented in RSpline.

◆ isPointShape()

static bool RShape::isPointShape ( const RShape s)
inlinestatic

◆ isPolylineShape()

static bool RShape::isPolylineShape ( const RShape s)
inlinestatic

◆ isRayShape()

static bool RShape::isRayShape ( const RShape s)
inlinestatic

◆ isSplineShape()

static bool RShape::isSplineShape ( const RShape s)
inlinestatic

◆ isTriangleShape()

static bool RShape::isTriangleShape ( const RShape s)
inlinestatic

◆ isXLineShape()

static bool RShape::isXLineShape ( const RShape s)
inlinestatic

◆ mirror()

virtual bool RShape::mirror ( const RLine axis)
pure virtual

◆ move()

virtual bool RShape::move ( const RVector offset)
pure virtual

◆ order()

bool RShape::order ( QList< QList< QSharedPointer< RShape > > > &  boundary)
static

Orders the given list of loops into a list of closed loops in which all shapes are connected end to start point.

Empty loops are dropped.

Returns
True if all loops are closed, false otherwise.

◆ print()

void RShape::print ( QDebug  dbg) const
protectedvirtual

◆ rayToLine()

QSharedPointer< RShape > RShape::rayToLine ( QSharedPointer< RShape shape)
static

◆ reverse()

virtual bool RShape::reverse ( )
inlinevirtual

◆ rotate()

virtual bool RShape::rotate ( double  rotation,
const RVector center = RDEFAULT_RVECTOR 
)
pure virtual

◆ roundAllCorners()

QList< QSharedPointer< RShape > > RShape::roundAllCorners ( const QList< QSharedPointer< RShape > > &  shapes,
double  radius 
)
static

Round every corner of the list of given (connected) shapes with the given radius.

◆ roundShapes()

QList< QSharedPointer< RShape > > RShape::roundShapes ( const QSharedPointer< RShape shape1,
const RVector clickPos1,
const QSharedPointer< RShape shape2,
const RVector clickPos2,
bool  trim,
bool  samePolyline,
double  radius,
const RVector pos 
)
static

Rounds the given shape1 against shape2.

Parameters
shape1First shape of corner.
clickPos1Coordinate that was clicked when the user selected shape1.
shape2Second shape of corner.
clickPos2Coordinate that was clicked when the user selected shape2.
trimtrue: Trim both shapes to rounding arc.
radiusRadius of rounding.
solutionPosPosition that determines which solution to apply (optional, defaults to clickPos1)
Returns
Array of three shapes: shape1 (trimmed), rounding, shape2 (trimmed) or empty array.

◆ scale() [1/2]

virtual bool RShape::scale ( const RVector scaleFactors,
const RVector center = RVector() 
)
pure virtual

◆ scale() [2/2]

bool RShape::scale ( double  scaleFactor,
const RVector center = RVector() 
)
virtual

Reimplemented in RPolyline.

◆ scaleArc()

static QSharedPointer<RShape> RShape::scaleArc ( const RShape shape,
const RVector scaleFactors,
const RVector center = RDEFAULT_RVECTOR 
)
inlinestatic

◆ setShapeProxy()

static void RShape::setShapeProxy ( RShapeProxy p)
inlinestatic
Non-Scriptable:\nThis function is not available in script environments.\n

◆ setZ()

virtual void RShape::setZ ( double  z)
pure virtual

◆ splitAt()

QList< QSharedPointer< RShape > > RShape::splitAt ( const QList< RVector > &  points) const
virtual
Returns
Array of shapes which represent the given shape split up at the given points.
Parameters
pointsArray of RVector, assumed to be on shape.

Reimplemented in RSpline, REllipse, RArc, RLine, RXLine, RCircle, and RRay.

◆ stretch() [1/2]

bool RShape::stretch ( const RBox area,
const RVector offset 
)
virtual

◆ stretch() [2/2]

bool RShape::stretch ( const RPolyline area,
const RVector offset 
)
virtual

Reimplemented in RPolyline, RSpline, RArc, RXLine, RLine, RLeaderData, and RRay.

◆ to2D()

virtual void RShape::to2D ( )
inlinevirtual

Flattens this shape to the X/Y plane.

Reimplemented in RViewportData.

◆ transformArc()

QSharedPointer< RShape > RShape::transformArc ( const RShape shape,
RShapeTransformation transformation 
)
static
Non-Scriptable:\nThis function is not available in script environments.\n

◆ trim()

QList< QSharedPointer< RShape > > RShape::trim ( const RShape trimShape,
const RVector trimClickPos,
const RShape limitingShape,
const RVector limitingClickPos,
bool  trimBoth,
bool  samePolyline 
)
static

Trims a shape to another or two shapes to each other.

Parameters
trimShapeShape which will always be trimmed.
trimClickPosCoordinate which defines which endpoint of the trim entity to trim.
limitingShapeEntity to which the trim entity will be trimmed.
limitingClickPosCoordinate which defines the intersection to which the trim entity will be trimmed.
trimBothtrue: Trim both entities. false: trim trimEntity only.

◆ trimEndPoint() [1/2]

virtual bool RShape::trimEndPoint ( const RVector trimPoint,
const RVector clickPoint = RVector::invalid,
bool  extend = false 
)
inlinevirtual
Parameters
trimPointTrim start point or end point to this coordinate.
clickPointPoint that was clicked by user.
extendTrue if the shape is to be extended. Used for polylines to determine that the last segment has to be trimmed even if another segment was clicked.

Reimplemented in RPolyline, RSpline, REllipse, RArc, RSplineData, RLine, RXLine, RArcData, RLineData, RXLineData, RRayData, RSolidData, and RRay.

◆ trimEndPoint() [2/2]

virtual bool RShape::trimEndPoint ( double  trimDist)
inlinevirtual

Reimplemented in RPolyline, RSpline, REllipse, RArc, RLine, and RXLine.

◆ trimStartPoint() [1/2]

virtual bool RShape::trimStartPoint ( const RVector trimPoint,
const RVector clickPoint = RVector::invalid,
bool  extend = false 
)
inlinevirtual
Parameters
trimPointTrim start point or end point to this coordinate.
clickPointPoint that was clicked by user.
extendTrue if the shape is to be extended. Used for polylines to determine that the first segment has to be trimmed even if another segment was clicked.

Reimplemented in RPolyline, RSpline, REllipse, RArc, RSplineData, RLine, RXLine, RArcData, RLineData, RXLineData, RRayData, and RSolidData.

◆ trimStartPoint() [2/2]

virtual bool RShape::trimStartPoint ( double  trimDist)
inlinevirtual

Reimplemented in RPolyline, RSpline, REllipse, RArc, RLine, and RXLine.

◆ xLineToRay()

QSharedPointer< RShape > RShape::xLineToRay ( QSharedPointer< RShape shape)
static

Friends And Related Function Documentation

◆ operator<<

QDebug operator<< ( QDebug  dbg,
const RShape s 
)
friend
Non-Scriptable:\nThis function is not available in script environments.\n

Member Data Documentation

◆ epsTolerance

double RShape::epsTolerance = 1.0e-02
staticprivate

◆ errorCode

int RShape::errorCode = 0
staticprotected

◆ shapeProxy

RShapeProxy * RShape::shapeProxy = NULL
staticprivate

◆ twopi

double RShape::twopi = M_PI*2
staticprivate

Copyright (c) 2011-2018 by Andrew Mustun.

All rights reserved.

This file is part of the QCAD project.

QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with QCAD.


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