QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RShape Class Reference

Interface for geometrical shape classes. More...

#include <RShape.h>

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

List of all members.

Public Member Functions

virtual RShapeclone () const =0
void dump ()
virtual QList< RVectorfilterOnShape (const QList< RVector > &pointList, bool limited=true, double tolerance=RDEFAULT_TOLERANCE_1E_MIN4) const
virtual bool flipHorizontal ()
virtual bool flipVertical ()
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 getDistanceTo (const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const
virtual QList< RVectorgetEndPoints () const =0
QList< RVectorgetIntersectionPoints (const RShape &other, bool limited=true, bool same=false, bool force=false) const
virtual double getLength () const =0
virtual QList< RVectorgetMiddlePoints () const =0
virtual RVector getPointAtPercent (double p) const
virtual QList< RVectorgetPointsWithDistanceToEnd (double distance, RS::From from=RS::FromAny) const =0
virtual QSharedPointer< RShapegetTransformed (const QTransform &transform) const =0
virtual RVector getVectorFromEndpointTo (const RVector &point) 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 isInterpolated () const
 Reimplement and return true if this shape relies on interpolation for geometrical operations such as finding intersection points.
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 rotate (double rotation, const RVector &center=RDEFAULT_RVECTOR)=0
 RShape ()
virtual bool scale (double scaleFactor, const RVector &center=RVector())
virtual bool scale (const RVector &scaleFactors, const RVector &center=RVector())=0
virtual bool stretch (const RBox &area, const RVector &offset)
virtual bool stretch (const RPolyline &area, const RVector &offset)
virtual void to2D ()=0
 Flattens this shape to the X/Y plane.
virtual ~RShape ()

Static Public Member Functions

static const RExplodablecastToExplodable (const RShape *shape)
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)
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 limited=true)
static QList< RVectorgetIntersectionPointsLA (const RLine &line1, const RArc &arc2, bool limited1, bool limited2)
static QList< RVectorgetIntersectionPointsLC (const RLine &line1, const RCircle &circle2, bool limited=true)
static QList< RVectorgetIntersectionPointsLE (const RLine &line1, const REllipse &ellipse2, bool limited=true)
static QList< RVectorgetIntersectionPointsLE (const RLine &line1, const REllipse &ellipse2, bool limited1, bool limited2)
static QList< RVectorgetIntersectionPointsLL (const RLine &line1, const RLine &line2, bool limited=true)
static QList< RVectorgetIntersectionPointsLL (const RLine &line1, const RLine &line2, bool limited1, bool limited2)
static QList< RVectorgetIntersectionPointsLS (const RLine &line1, const RSpline &spline2, bool limited=true)
static QList< RVectorgetIntersectionPointsLT (const RLine &line1, const RTriangle &triangle2, bool limited=true)
static QList< RVectorgetIntersectionPointsLT (const RLine &line1, const RTriangle &triangle2, bool limited1, bool limited2)
static QList< RVectorgetIntersectionPointsLX (const RLine &line1, const RExplodable &explodable2, bool limited=true)
static QList< RVectorgetIntersectionPointsXX (const RExplodable &explodable1, const RExplodable &explodable2, bool limited=true, bool same=false)
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.

Protected Member Functions

virtual void print (QDebug dbg) const

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-04
static double twopi = M_PI*2
 Copyright (c) 2011-2014 by Andrew Mustun.

Friends

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

Detailed Description

Interface for geometrical shape classes.

Scriptable:
This class is wrapped for script environments.
Shared Pointer Support:
Script wrappers of this class support wrapping in QSharedPointer.

Constructor & Destructor Documentation

RShape::RShape ( )
inline
virtual RShape::~RShape ( )
inlinevirtual

Member Function Documentation

const RExplodable * RShape::castToExplodable ( const RShape shape)
static
virtual RShape* RShape::clone ( ) const
pure virtual
void RShape::dump ( )
double RShape::ellipse2tr ( double  x,
double  y,
double  AA,
double  BB,
double  CC,
double  DD,
double  EE,
double  FF 
)
staticprivate
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.
bool RShape::flipHorizontal ( )
virtual

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

bool RShape::flipVertical ( )
virtual

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

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

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

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

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

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.
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 RTriangle.

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

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

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.
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.
QList< RVector > RShape::getIntersectionPointsAA ( const RArc arc1,
const RArc arc2,
bool  limited = true 
)
static
QList< RVector > RShape::getIntersectionPointsAC ( const RArc arc1,
const RCircle circle2,
bool  limited = true 
)
static
QList< RVector > RShape::getIntersectionPointsAE ( const RArc arc1,
const REllipse ellipse2,
bool  limited = true 
)
static
QList< RVector > RShape::getIntersectionPointsAS ( const RArc arc1,
const RSpline spline2,
bool  limited = true 
)
static
QList< RVector > RShape::getIntersectionPointsAT ( const RArc arc1,
const RTriangle triangle2,
bool  limited = true 
)
static
QList< RVector > RShape::getIntersectionPointsAX ( const RArc arc1,
const RExplodable explodable2,
bool  limited = true 
)
static
QList< RVector > RShape::getIntersectionPointsCC ( const RCircle circle1,
const RCircle circle2 
)
static
QList< RVector > RShape::getIntersectionPointsCE ( const RCircle circle1,
const REllipse ellipse2 
)
static
QList< RVector > RShape::getIntersectionPointsCS ( const RCircle circle1,
const RSpline spline2,
bool  limited = true 
)
static
QList< RVector > RShape::getIntersectionPointsCX ( const RCircle circle1,
const RExplodable explodable2,
bool  limited = true 
)
static
QList< RVector > RShape::getIntersectionPointsEE ( const REllipse ellipse1,
const REllipse ellipse2 
)
static
QList< RVector > RShape::getIntersectionPointsEE ( const REllipse ellipse1,
const REllipse ellipse2,
bool  limited 
)
static
QList< RVector > RShape::getIntersectionPointsES ( const REllipse ellipse1,
const RSpline spline2,
bool  limited = true 
)
static
QList< RVector > RShape::getIntersectionPointsEX ( const REllipse ellipse1,
const RExplodable explodable2,
bool  limited = true 
)
static
static QList<RVector> RShape::getIntersectionPointsLA ( const RLine line1,
const RArc arc2,
bool  limited = true 
)
inlinestatic
QList< RVector > RShape::getIntersectionPointsLA ( const RLine line1,
const RArc arc2,
bool  limited1,
bool  limited2 
)
static
QList< RVector > RShape::getIntersectionPointsLC ( const RLine line1,
const RCircle circle2,
bool  limited = true 
)
static
static QList<RVector> RShape::getIntersectionPointsLE ( const RLine line1,
const REllipse ellipse2,
bool  limited = true 
)
inlinestatic
QList< RVector > RShape::getIntersectionPointsLE ( const RLine line1,
const REllipse ellipse2,
bool  limited1,
bool  limited2 
)
static
static QList<RVector> RShape::getIntersectionPointsLL ( const RLine line1,
const RLine line2,
bool  limited = true 
)
inlinestatic
QList< RVector > RShape::getIntersectionPointsLL ( const RLine line1,
const RLine line2,
bool  limited1,
bool  limited2 
)
static
QList< RVector > RShape::getIntersectionPointsLS ( const RLine line1,
const RSpline spline2,
bool  limited = true 
)
static
static QList<RVector> RShape::getIntersectionPointsLT ( const RLine line1,
const RTriangle triangle2,
bool  limited = true 
)
inlinestatic
QList< RVector > RShape::getIntersectionPointsLT ( const RLine line1,
const RTriangle triangle2,
bool  limited1,
bool  limited2 
)
static
QList< RVector > RShape::getIntersectionPointsLX ( const RLine line1,
const RExplodable explodable2,
bool  limited = true 
)
static
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).
virtual double RShape::getLength ( ) const
pure virtual
Returns:
The total length of this shape if applicable or NaN if not.

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

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

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

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

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

virtual QSharedPointer<RShape> RShape::getTransformed ( const QTransform &  transform) const
pure virtual
RVector RShape::getVectorFromEndpointTo ( const RVector point) const
virtual
Returns:
Shortest vector from any end point of this shape to the given point.
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 treaded 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 RSpline, RPolyline, RArc, RTriangle, RCircle, REllipse, RPoint, RXLine, RLine, and RRay.

bool RShape::intersectsWith ( const RShape other,
bool  limited = true 
) const
virtual
Returns:
True if this shape intersects with the given shape.
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.

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.
virtual bool RShape::mirror ( const RLine axis)
pure virtual
virtual bool RShape::move ( const RVector offset)
pure virtual
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.
void RShape::print ( QDebug  dbg) const
protectedvirtual
virtual bool RShape::rotate ( double  rotation,
const RVector center = RDEFAULT_RVECTOR 
)
pure virtual
bool RShape::scale ( double  scaleFactor,
const RVector center = RVector() 
)
virtual

Reimplemented in RPolyline.

virtual bool RShape::scale ( const RVector scaleFactors,
const RVector center = RVector() 
)
pure virtual
bool RShape::stretch ( const RBox area,
const RVector offset 
)
virtual
bool RShape::stretch ( const RPolyline area,
const RVector offset 
)
virtual

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

virtual void RShape::to2D ( )
pure virtual

Flattens this shape to the X/Y plane.

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


Friends And Related Function Documentation

QDebug operator<< ( QDebug  dbg,
const RShape s 
)
friend
   \par Non-Scriptable:

This function is not available in script environments.


Member Data Documentation

double RShape::epsTolerance = 1.0e-04
staticprivate
double RShape::twopi = M_PI*2
staticprivate

Copyright (c) 2011-2014 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: