QCAD
Open Source 2D CAD
RSpline Class Reference

Copyright (c) 2011-2018 by Andrew Mustun. More...

#include <RSpline.h>

Inheritance diagram for RSpline:
RShape RExplodable RSplineData

Public Member Functions

void appendControlPoint (const RVector &point)
 Disabled for splines (bad performance). More...
 
void appendControlPoints (const QList< RVector > &points)
 Appends the given control points. More...
 
void appendFitPoint (const RVector &point)
 Appends a fit point. More...
 
void appendKnot (double k)
 
RPolyline approximateWithArcs (double tolerance, double radiusLimit=RDEFAULT_MIN1) const
 
virtual RSplineclone () const
 
void copySpline (const RSpline &other)
 
int countControlPoints () const
 
int countFitPoints () const
 
virtual bool flipHorizontal ()
 
virtual bool flipVertical ()
 
QList< double > getActualKnotVector () const
 
virtual double getAngleAt (double distance, RS::From from=RS::FromStart) const
 
QList< RSplinegetBezierSegments (const RBox &queryBox=RDEFAULT_RBOX) const
 
virtual QList< bool > getBoolProperties () const
 
virtual RBox getBoundingBox () const
 
virtual QList< RVectorgetCenterPoints () const
 
RVector getControlPointAt (int i) const
 
QList< RVectorgetControlPoints () const
 
QList< RVectorgetControlPointsWrapped () const
 
int getDegree () const
 
virtual double getDirection1 () const
 
virtual double getDirection2 () const
 
QList< RVectorgetDiscontinuities () const
 
double getDistanceAtT (double t) const
 
virtual double getDistanceFromStart (const RVector &p) const
 
virtual QList< double > getDoubleProperties () const
 
virtual RVector getEndPoint () const
 
virtual QList< RVectorgetEndPoints () const
 
virtual QList< QSharedPointer< RShape > > getExploded (int segments=RDEFAULT_MIN1) const
 
QList< QSharedPointer< RShape > > getExplodedBezier (int segments) const
 
QList< QSharedPointer< RShape > > getExplodedWithSegmentLength (double segmentLength) const
 
RVector getFitPointAt (int i) const
 
QList< RVectorgetFitPoints () const
 
virtual QList< int > getIntProperties () const
 
QList< double > getKnotVector () const
 
virtual double getLength () const
 
virtual RVector getMiddlePoint () const
 
virtual QList< RVectorgetMiddlePoints () const
 
int getOrder () const
 
RVector getPointAt (double t) const
 
RVector getPointAtDistance (double distance) const
 
virtual QList< RVectorgetPointCloud (double segmentLength) const
 
virtual QList< RVectorgetPointsWithDistanceToEnd (double distance, int from=RS::FromAny) const
 
QList< RSplinegetSegments (const QList< RVector > &points) const
 
QList< RVectorgetSelfIntersectionPoints () const
 
virtual RShape::Type getShapeType () const
 
virtual RS::Side getSideOfPoint (const RVector &point) const
 
virtual RVector getStartPoint () const
 
RVector getTangentAtEnd () const
 
RVector getTangentAtStart () const
 
double getTAtDistance (double distance) const
 
double getTAtPoint (const RVector &point) const
 
double getTDelta () const
 
double getTMax () const
 
double getTMin () const
 
QSharedPointer< RShapegetTransformed (const QTransform &transform) const
 
virtual RS::Ending getTrimEnd (const RVector &trimPoint, const RVector &clickPoint)
 
virtual QList< RVectorgetVectorProperties () const
 
virtual RVector getVectorTo (const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const
 
QList< double > getWeights () const
 
bool hasFitPoints () const
 
void insertFitPointAt (const RVector &point)
 Inserts a fit point at the point on the spline closest to the given position. More...
 
void insertFitPointAt (double t, const RVector &point)
 
bool isClosed () const
 
virtual bool isDirected () const
 
bool isDirty () const
 
bool isGeometricallyClosed (double tolerance=RS::PointTolerance) 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
 
bool isPeriodic () const
 
bool isValid () const
 
virtual bool mirror (const RLine &axis)
 
virtual bool move (const RVector &offset)
 
RSplineoperator= (const RSpline &other)
 
void prependFitPoint (const RVector &point)
 Prepends a fit point. More...
 
void removeFirstFitPoint ()
 Removes the first fit point. More...
 
void removeFitPointAt (const RVector &point)
 
void removeLastControlPoint ()
 Removes the last control point. More...
 
void removeLastFitPoint ()
 Removes the last fit point. More...
 
virtual bool reverse ()
 
virtual bool rotate (double rotation, const RVector &center=RDEFAULT_RVECTOR)
 
 RSpline ()
 Creates a spline object without controlPoints. More...
 
 RSpline (const QList< RVector > &controlPoints, int degree)
 Creates a spline object with the given control points and degree. More...
 
 RSpline (const RSpline &other)
 
virtual bool scale (const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)
 
void setControlPoints (const QList< RVector > &points)
 Sets the control points of this spline. More...
 
void setDegree (int d)
 Sets the degree of this spline (2 or 3 for control point defined spline, 3 for fit point defined spline). More...
 
void setEndPoint (const RVector &v)
 
void setFitPoints (const QList< RVector > &points)
 Sets the fit points. More...
 
void setKnotVector (const QList< double > &knots)
 Sets the knot vector manually. More...
 
void setPeriodic (bool on)
 
void setStartPoint (const RVector &v)
 
void setTangentAtEnd (const RVector &t)
 Sets the end tangent. More...
 
void setTangentAtStart (const RVector &t)
 Sets the start tangent. More...
 
void setTangents (const RVector &start, const RVector &end)
 Sets the start and end tangents. More...
 
void setWeights (QList< double > &w)
 
virtual void setZ (double z)
 
RSpline simplify (double tolerance)
 
virtual QList< QSharedPointer< RShape > > splitAt (const QList< RVector > &points) const
 
QList< RSplinesplitAtParams (const QList< double > &params) const
 
QList< RSplinesplitAtPoints (const QList< RVector > &points) const
 
virtual bool stretch (const RPolyline &area, const RVector &offset)
 
RPolyline toPolyline (int segments) const
 
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)
 
void unsetTangentAtEnd ()
 Clears the valud of the end tangent. More...
 
void unsetTangentAtStart ()
 Clears the valud of the start tangent. More...
 
void unsetTangents ()
 Clears the valud of the start and end tangents. More...
 
void update () const
 
void updateFromControlPoints () const
 
void updateFromFitPoints () const
 Closes this spline and makes it periodic if it isn't already. More...
 
void updateTangentsPeriodic ()
 Updates the tangents at the start and end to make the spline periodic. More...
 
- Public Member Functions inherited from RShape
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 double getAngleAtPercent (double p) const
 
virtual double getAngleAtPoint (const RVector &pos) const
 
virtual QList< RVectorgetArcReferencePoints () const
 
virtual RVector getClosestPointOnShape (const RVector &p, bool limited=true, double strictRange=RMAXDOUBLE) const
 
virtual QList< double > getDistancesFromStart (const RVector &p) const
 
virtual double getDistanceTo (const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const
 
QList< RVectorgetIntersectionPoints (const RShape &other, bool limited=true, bool same=false, bool force=false) const
 
virtual double getMaxDistanceTo (const QList< RVector > &points, bool limited=true, double strictRange=RMAXDOUBLE) const
 
virtual QList< QSharedPointer< RShape > > getOffsetShapes (double distance, int number, RS::Side side, const RVector &position=RVector::invalid)
 
virtual RVector getPointAtPercent (double p) const
 
virtual RVector getPointOnShape () const
 
virtual RVector getPointWithDistanceToEnd (double distance) const
 
virtual RVector getPointWithDistanceToStart (double distance) const
 
virtual RVector getVectorFromEndpointTo (const RVector &point) const
 
virtual bool intersectsWith (const RShape &other, bool limited=true) const
 
 RShape ()
 
virtual bool scale (double scaleFactor, const RVector &center=RVector())
 
virtual bool stretch (const RBox &area, const RVector &offset)
 
virtual void to2D ()
 Flattens this shape to the X/Y plane. More...
 
virtual ~RShape ()
 
- Public Member Functions inherited from RExplodable
virtual ~RExplodable ()
 

Static Public Member Functions

static RSpline createBezierFromSmallArc (double r, double a1, double a2)
 Cubic bezier approximation of a circular arc centered at the origin, from (radians) a1 to a2, where a2-a1 < pi/2. More...
 
static QList< RSplinecreateSplinesFromArc (const RArc &arc)
 
static RSplineProxygetSplineProxy ()
 
static bool hasProxy ()
 
static void setSplineProxy (RSplineProxy *p)
 
- Static Public Member Functions inherited from RShape
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)
 

Public Attributes

QList< RVectorcontrolPoints
 
Getter function for this property: getControlPoints

Setter function for this property: setControlPoints
More...
 
int degree
 
Getter function for this property: getDegree

Setter function for this property: setDegree
More...
 
bool dirty
 
QList< RVectorfitPoints
 
Getter function for this property: getFitPoints

Setter function for this property: setFitPoints
More...
 
QList< double > knotVector
 
Getter function for this property: getKnotVector
More...
 
bool periodic
 Closed periodic flag. More...
 
RVector tangentEnd
 Unit vector end tangent. More...
 
RVector tangentStart
 Unit vector start tangent. More...
 
bool updateInProgress
 
QList< double > weights
 
Getter function for this property: getWeights

Setter function for this property: setWeights
More...
 

Protected Member Functions

void appendToExploded (const RLine &line) const
 
void invalidate () const
 
virtual void print (QDebug dbg) const
 
void updateBoundingBox () const
 Updates the internal bounding box. More...
 
void updateInternal () const
 

Private Attributes

RBox boundingBox
 
ON_NurbsCurve curve
 
QList< QSharedPointer< RShape > > exploded
 
double length
 

Static Private Attributes

static RSplineProxysplineProxy = NULL
 Copyright (c) 2011-2018 by Andrew Mustun. More...
 

Additional Inherited Members

- Public Types inherited from RShape
enum  Type {
  Unknown = -1, Point = 0, Line = 1, Arc = 2,
  Circle = 3, Ellipse = 4, Polyline = 5, Spline = 6,
  Triangle = 7, XLine = 8, Ray = 9
}
 
- Static Protected Attributes inherited from RShape
static int errorCode = 0
 

Detailed Description

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. Low-level mathematical representation of a spline.

The spline may be defined by its control points or by its fit points but not both.

Scriptable:\nThis class is available in script environments.\n
Shared Pointer Support:\nObjects can be used in QSharedPointer.\n
Copyable:\nObjects are cleaned up automatically by the garbage collector of the script engine.\n
Stream Operator:\nObject has a stream operator to present itself as string, for example when using toString() in a script.\n

Constructor & Destructor Documentation

◆ RSpline() [1/3]

RSpline::RSpline ( )

Creates a spline object without controlPoints.

◆ RSpline() [2/3]

RSpline::RSpline ( const RSpline other)

◆ RSpline() [3/3]

RSpline::RSpline ( const QList< RVector > &  controlPoints,
int  degree 
)

Creates a spline object with the given control points and degree.

Member Function Documentation

◆ appendControlPoint()

void RSpline::appendControlPoint ( const RVector point)

Disabled for splines (bad performance).

20120223: Re-enabled, seems to perform OK, needed by some users. Appends a control point.

◆ appendControlPoints()

void RSpline::appendControlPoints ( const QList< RVector > &  points)

Appends the given control points.

◆ appendFitPoint()

void RSpline::appendFitPoint ( const RVector point)

Appends a fit point.

◆ appendKnot()

void RSpline::appendKnot ( double  k)

◆ appendToExploded()

void RSpline::appendToExploded ( const RLine line) const
protected

◆ approximateWithArcs()

RPolyline RSpline::approximateWithArcs ( double  tolerance,
double  radiusLimit = RDEFAULT_MIN1 
) const

◆ clone()

virtual RSpline* RSpline::clone ( ) const
inlinevirtual

Implements RShape.

◆ copySpline()

void RSpline::copySpline ( const RSpline other)

◆ countControlPoints()

int RSpline::countControlPoints ( ) const
Returns
Number of control points.

◆ countFitPoints()

int RSpline::countFitPoints ( ) const
Returns
Number of fit points.

◆ createBezierFromSmallArc()

RSpline RSpline::createBezierFromSmallArc ( double  r,
double  a1,
double  a2 
)
static

Cubic bezier approximation of a circular arc centered at the origin, from (radians) a1 to a2, where a2-a1 < pi/2.

The arc's radius is r.

Returns an spline approximation.

This algorithm is based on the approach described in: A. Riškus, "Approximation of a Cubic Bezier Curve by Circular Arcs and Vice Versa," Information Technology and Control, 35(4), 2006 pp. 371-378.

◆ createSplinesFromArc()

QList< RSpline > RSpline::createSplinesFromArc ( const RArc arc)
static
Returns
List of splines which approximate the given arc.

◆ flipHorizontal()

bool RSpline::flipHorizontal ( )
virtual

Reimplemented from RShape.

◆ flipVertical()

bool RSpline::flipVertical ( )
virtual

Reimplemented from RShape.

◆ getActualKnotVector()

QList< double > RSpline::getActualKnotVector ( ) const

◆ getAngleAt()

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

Reimplemented from RShape.

Reimplemented in RSplineData.

◆ getBezierSegments()

QList< RSpline > RSpline::getBezierSegments ( const RBox queryBox = RDEFAULT_RBOX) const
Returns
List of bezier spline segments which together represent this curve.

◆ getBoolProperties()

QList< bool > RSpline::getBoolProperties ( ) const
virtual

Reimplemented from RShape.

◆ getBoundingBox()

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

Implements RShape.

◆ getCenterPoints()

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

Implements RShape.

◆ getControlPointAt()

RVector RSpline::getControlPointAt ( int  i) const

◆ getControlPoints()

QList< RVector > RSpline::getControlPoints ( ) const
Returns
Control points.

◆ getControlPointsWrapped()

QList< RVector > RSpline::getControlPointsWrapped ( ) const
Returns
Control points of internal spline representation (may be closed).

◆ getDegree()

int RSpline::getDegree ( ) const
Returns
Degree of this spline.

◆ getDirection1()

double RSpline::getDirection1 ( ) const
virtual
Returns
Tangent angle of spline at start point.

Reimplemented from RShape.

Reimplemented in RSplineData.

◆ getDirection2()

double RSpline::getDirection2 ( ) const
virtual
Returns
Tangent angle of spline at end point.

Reimplemented from RShape.

Reimplemented in RSplineData.

◆ getDiscontinuities()

QList< RVector > RSpline::getDiscontinuities ( ) const

◆ getDistanceAtT()

double RSpline::getDistanceAtT ( double  t) const

◆ getDistanceFromStart()

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

Reimplemented from RShape.

◆ getDoubleProperties()

QList< double > RSpline::getDoubleProperties ( ) const
virtual

Reimplemented from RShape.

◆ getEndPoint()

RVector RSpline::getEndPoint ( ) const
virtual

Reimplemented from RShape.

Reimplemented in RSplineData.

◆ getEndPoints()

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

Implements RShape.

◆ getExploded()

QList< QSharedPointer< RShape > > RSpline::getExploded ( int  segments = RDEFAULT_MIN1) const
virtual
Returns
List of RLines describing this spline.

Implements RExplodable.

◆ getExplodedBezier()

QList< QSharedPointer< RShape > > RSpline::getExplodedBezier ( int  segments) const
Returns
exploded spline, treated as one spline segment, typically only used for bezier spline segments (degree+1 control points).

◆ getExplodedWithSegmentLength()

QList< QSharedPointer< RShape > > RSpline::getExplodedWithSegmentLength ( double  segmentLength) const

◆ getFitPointAt()

RVector RSpline::getFitPointAt ( int  i) const

◆ getFitPoints()

QList< RVector > RSpline::getFitPoints ( ) const
Returns
Fit points.

◆ getIntProperties()

QList< int > RSpline::getIntProperties ( ) const
virtual

Reimplemented from RShape.

◆ getKnotVector()

QList< double > RSpline::getKnotVector ( ) const
Returns
Knot vector, internally calculated and updated.

◆ getLength()

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

Implements RShape.

Reimplemented in RSplineData.

◆ getMiddlePoint()

RVector RSpline::getMiddlePoint ( ) const
virtual

Reimplemented from RShape.

◆ getMiddlePoints()

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

Implements RShape.

◆ getOrder()

int RSpline::getOrder ( ) const
Returns
Order of this spline (=degree+1).

◆ getPointAt()

RVector RSpline::getPointAt ( double  t) const
Returns
Point on spline at given position t (0..1).

◆ getPointAtDistance()

RVector RSpline::getPointAtDistance ( double  distance) const

◆ getPointCloud()

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

Implements RShape.

◆ getPointsWithDistanceToEnd()

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

Implements RShape.

◆ getSegments()

QList< RSpline > RSpline::getSegments ( const QList< RVector > &  points) const

◆ getSelfIntersectionPoints()

QList< RVector > RSpline::getSelfIntersectionPoints ( ) const
virtual

Reimplemented from RShape.

◆ getShapeType()

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

Reimplemented from RShape.

◆ getSideOfPoint()

RS::Side RSpline::getSideOfPoint ( const RVector point) const
virtual

Reimplemented from RShape.

◆ getSplineProxy()

static RSplineProxy* RSpline::getSplineProxy ( )
inlinestatic
Non-Scriptable:\nThis function is not available in script environments.\n

◆ getStartPoint()

RVector RSpline::getStartPoint ( ) const
virtual

Reimplemented from RShape.

Reimplemented in RSplineData.

◆ getTangentAtEnd()

RVector RSpline::getTangentAtEnd ( ) const
Returns
The end tangent.

◆ getTangentAtStart()

RVector RSpline::getTangentAtStart ( ) const
Returns
The start tangent.

◆ getTAtDistance()

double RSpline::getTAtDistance ( double  distance) const

◆ getTAtPoint()

double RSpline::getTAtPoint ( const RVector point) const

◆ getTDelta()

double RSpline::getTDelta ( ) const

◆ getTMax()

double RSpline::getTMax ( ) const

◆ getTMin()

double RSpline::getTMin ( ) const

◆ getTransformed()

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

Implements RShape.

◆ getTrimEnd()

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

Reimplemented from RShape.

Reimplemented in RSplineData.

◆ getVectorProperties()

QList< RVector > RSpline::getVectorProperties ( ) const
virtual

Reimplemented from RShape.

◆ getVectorTo()

RVector RSpline::getVectorTo ( const RVector point,
bool  limited = true,
double  strictRange = RMAXDOUBLE 
) const
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.

Implements RShape.

◆ getWeights()

QList< double > RSpline::getWeights ( ) const
Returns
Knot weights, internally calculated and updated.

◆ hasFitPoints()

bool RSpline::hasFitPoints ( ) const
Returns
True if this spline has fit points and is therefore defined by its fit points, false otherwise.

◆ hasProxy()

static bool RSpline::hasProxy ( )
inlinestatic

◆ insertFitPointAt() [1/2]

void RSpline::insertFitPointAt ( const RVector point)

Inserts a fit point at the point on the spline closest to the given position.

◆ insertFitPointAt() [2/2]

void RSpline::insertFitPointAt ( double  t,
const RVector point 
)

◆ invalidate()

void RSpline::invalidate ( ) const
protected

◆ isClosed()

bool RSpline::isClosed ( ) const
Returns
True if this spline is closed, i.e. start point and end point are very close to each other.

◆ isDirected()

virtual bool RSpline::isDirected ( ) const
inlinevirtual

Reimplemented from RShape.

◆ isDirty()

bool RSpline::isDirty ( ) const
inline

◆ isGeometricallyClosed()

bool RSpline::isGeometricallyClosed ( double  tolerance = RS::PointTolerance) const

◆ isInterpolated()

virtual bool RSpline::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 from RShape.

◆ isOnShape()

bool RSpline::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 from RShape.

◆ isPeriodic()

bool RSpline::isPeriodic ( ) const
Returns
True if this spline is periodic, i.e. closed and 'smooth' where start and end connect. The tangents at the start point and end point are nearly identical.

◆ isValid()

bool RSpline::isValid ( ) const

◆ mirror()

bool RSpline::mirror ( const RLine axis)
virtual

Implements RShape.

◆ move()

bool RSpline::move ( const RVector offset)
virtual

Implements RShape.

◆ operator=()

RSpline & RSpline::operator= ( const RSpline other)

◆ prependFitPoint()

void RSpline::prependFitPoint ( const RVector point)

Prepends a fit point.

◆ print()

void RSpline::print ( QDebug  dbg) const
protectedvirtual

Reimplemented from RShape.

◆ removeFirstFitPoint()

void RSpline::removeFirstFitPoint ( )

Removes the first fit point.

◆ removeFitPointAt()

void RSpline::removeFitPointAt ( const RVector point)

◆ removeLastControlPoint()

void RSpline::removeLastControlPoint ( )

Removes the last control point.

Parameters
updUpdate internal spline representation.

◆ removeLastFitPoint()

void RSpline::removeLastFitPoint ( )

Removes the last fit point.

◆ reverse()

bool RSpline::reverse ( )
virtual

Reimplemented from RShape.

Reimplemented in RSplineData.

◆ rotate()

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

Implements RShape.

◆ scale()

bool RSpline::scale ( const RVector scaleFactors,
const RVector center = RDEFAULT_RVECTOR 
)
virtual

Implements RShape.

◆ setControlPoints()

void RSpline::setControlPoints ( const QList< RVector > &  points)

Sets the control points of this spline.

◆ setDegree()

void RSpline::setDegree ( int  d)

Sets the degree of this spline (2 or 3 for control point defined spline, 3 for fit point defined spline).

◆ setEndPoint()

void RSpline::setEndPoint ( const RVector v)

◆ setFitPoints()

void RSpline::setFitPoints ( const QList< RVector > &  points)

Sets the fit points.

◆ setKnotVector()

void RSpline::setKnotVector ( const QList< double > &  knots)

Sets the knot vector manually.

Mainly for importing ready data.

◆ setPeriodic()

void RSpline::setPeriodic ( bool  on)

◆ setSplineProxy()

static void RSpline::setSplineProxy ( RSplineProxy p)
inlinestatic
Non-Scriptable:\nThis function is not available in script environments.\n

◆ setStartPoint()

void RSpline::setStartPoint ( const RVector v)

◆ setTangentAtEnd()

void RSpline::setTangentAtEnd ( const RVector t)

Sets the end tangent.

◆ setTangentAtStart()

void RSpline::setTangentAtStart ( const RVector t)

Sets the start tangent.

◆ setTangents()

void RSpline::setTangents ( const RVector start,
const RVector end 
)

Sets the start and end tangents.

◆ setWeights()

void RSpline::setWeights ( QList< double > &  w)

◆ setZ()

void RSpline::setZ ( double  z)
virtual

Implements RShape.

◆ simplify()

RSpline RSpline::simplify ( double  tolerance)

◆ splitAt()

QList< QSharedPointer< RShape > > RSpline::splitAt ( const QList< RVector > &  points) const
virtual
Returns
New spline that covers this spline from d1 to d2, where d1 and d2 are distances from the start point of this spline.

Reimplemented from RShape.

◆ splitAtParams()

QList< RSpline > RSpline::splitAtParams ( const QList< double > &  params) const

◆ splitAtPoints()

QList< RSpline > RSpline::splitAtPoints ( const QList< RVector > &  points) const

◆ stretch()

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

Reimplemented from RShape.

◆ toPolyline()

RPolyline RSpline::toPolyline ( int  segments) const

◆ trimEndPoint() [1/2]

bool RSpline::trimEndPoint ( const RVector trimPoint,
const RVector clickPoint = RVector::invalid,
bool  extend = false 
)
virtual
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 from RShape.

Reimplemented in RSplineData.

◆ trimEndPoint() [2/2]

virtual bool RSpline::trimEndPoint ( double  trimDist)
inlinevirtual

Reimplemented from RShape.

◆ trimStartPoint() [1/2]

bool RSpline::trimStartPoint ( const RVector trimPoint,
const RVector clickPoint = RVector::invalid,
bool  extend = false 
)
virtual
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 from RShape.

Reimplemented in RSplineData.

◆ trimStartPoint() [2/2]

virtual bool RSpline::trimStartPoint ( double  trimDist)
inlinevirtual

Reimplemented from RShape.

◆ unsetTangentAtEnd()

void RSpline::unsetTangentAtEnd ( )

Clears the valud of the end tangent.

The end tangent is calculated and updated internally if not set manually.

◆ unsetTangentAtStart()

void RSpline::unsetTangentAtStart ( )

Clears the valud of the start tangent.

The start tangent is calculated and updated internally if not set manually.

◆ unsetTangents()

void RSpline::unsetTangents ( )

Clears the valud of the start and end tangents.

The tangents are calculated and updated internally if not set manually.

◆ update()

void RSpline::update ( ) const

◆ updateBoundingBox()

void RSpline::updateBoundingBox ( ) const
protected

Updates the internal bounding box.

◆ updateFromControlPoints()

void RSpline::updateFromControlPoints ( ) const

◆ updateFromFitPoints()

void RSpline::updateFromFitPoints ( ) const

Closes this spline and makes it periodic if it isn't already.

Updates the internal spline data from fitPoints. Degree is always corrected to 3rd degree.

◆ updateInternal()

void RSpline::updateInternal ( ) const
protected

◆ updateTangentsPeriodic()

void RSpline::updateTangentsPeriodic ( )

Updates the tangents at the start and end to make the spline periodic.

Member Data Documentation

◆ boundingBox

RBox RSpline::boundingBox
mutableprivate

◆ controlPoints

QList<RVector> RSpline::controlPoints
mutable


Getter function for this property: getControlPoints

Setter function for this property: setControlPoints

◆ curve

ON_NurbsCurve RSpline::curve
mutableprivate

◆ degree

int RSpline::degree
mutable


Getter function for this property: getDegree

Setter function for this property: setDegree

◆ dirty

bool RSpline::dirty
mutable

◆ exploded

QList<QSharedPointer<RShape> > RSpline::exploded
mutableprivate

◆ fitPoints

QList<RVector> RSpline::fitPoints


Getter function for this property: getFitPoints

Setter function for this property: setFitPoints

◆ knotVector

QList<double> RSpline::knotVector
mutable


Getter function for this property: getKnotVector

◆ length

double RSpline::length
mutableprivate

◆ periodic

bool RSpline::periodic
mutable

Closed periodic flag.

◆ splineProxy

RSplineProxy * RSpline::splineProxy = NULL
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.

◆ tangentEnd

RVector RSpline::tangentEnd
mutable

Unit vector end tangent.

◆ tangentStart

RVector RSpline::tangentStart
mutable

Unit vector start tangent.

◆ updateInProgress

bool RSpline::updateInProgress
mutable

◆ weights

QList<double> RSpline::weights
mutable


Getter function for this property: getWeights

Setter function for this property: setWeights


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