Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

RS_Spline Class Reference

Class for a spline entity. More...

#include <rs_spline.h>

Inheritance diagram for RS_Spline:

RS_EntityContainer RS_Entity RS_Undoable RS_Flags List of all members.

Public Member Functions

 RS_Spline (RS_EntityContainer *parent, const RS_SplineData &d)
 Constructor.
virtual RS_Entityclone ()
virtual ~RS_Spline ()
 Destructor.
virtual RS2::EntityType rtti () const
virtual bool isEdge () const
RS_SplineData getData () const
void setDegree (int deg)
 Sets the splines degree (1-3).
int getDegree ()
int getNumberOfKnots ()
int getNumberOfControlPoints ()
bool isClosed ()
void setClosed (bool c)
 Sets the closed falg of this spline.
virtual RS_VectorSolutions getRefPoints ()
 Must be overwritten to get all reference points of the entity.
virtual RS_Vector getNearestRef (const RS_Vector &coord, double *dist=NULL)
 Must be overwritten to get the nearest reference point for this entity.
virtual RS_Vector getNearestSelectedRef (const RS_Vector &coord, double *dist=NULL)
 Gets the nearest reference point of this entity if it is selected.
void update ()
 Sets the endpoint.
virtual RS_Vector getNearestEndpoint (const RS_Vector &coord, double *dist=NULL)
virtual RS_Vector getNearestCenter (const RS_Vector &coord, double *dist=NULL)
 Must be overwritten to get the (nearest) center point to the given coordinate for this entity.
virtual RS_Vector getNearestMiddle (const RS_Vector &coord, double *dist=NULL)
 Must be overwritten to get the (nearest) middle point to the given coordinate for this entity.
virtual RS_Vector getNearestDist (double distance, const RS_Vector &coord, double *dist=NULL)
 Must be overwritten to get the nearest point with a given distance to the endpoint to the given coordinate for this entity.
virtual void addControlPoint (const RS_Vector &v)
 Appends the given point to the control points.
virtual void removeLastControlPoint ()
 Removes the control point that was last added.
virtual void move (const RS_Vector &offset)
 Implementations must move the entity by the given vector.
virtual void rotate (const RS_Vector &center, double angle)
 Implementations must rotate the entity by the given angle around the given center.
virtual void scale (const RS_Vector &center, const RS_Vector &factor)
 Implementations must scale the entity by the given factors.
virtual void mirror (const RS_Vector &axisPoint1, const RS_Vector &axisPoint2)
 Implementations must mirror the entity by the given axis.
virtual void moveRef (const RS_Vector &ref, const RS_Vector &offset)
 Implementations must drag the reference point(s) of all (sub-)entities that are very close to ref by offset.
virtual void draw (RS_Painter *painter, RS_GraphicView *view, double patternOffset=0.0)
 Implementations must draw the entity on the given device.
RS_ValueList< RS_VectorgetControlPoints ()
virtual void calculateBorders ()
 Recalculates the borders of this entity container.

Static Public Member Functions

static void rbasis (int c, double t, int npts, int x[], double h[], double r[])
 Generates rational B-spline basis functions for an open knot vector.
static void knot (int num, int order, int knotVector[])
 Generates B-Spline open knot vector with multiplicity equal to the order at the ends.
static void rbspline (int npts, int k, int p1, double b[], double h[], double p[])
 Generates a rational B-spline curve using a uniform open knot vector.
static void knotu (int num, int order, int knotVector[])
static void rbsplinu (int npts, int k, int p1, double b[], double h[], double p[])

Protected Attributes

RS_SplineData data

Friends

std::ostream & operator<< (std::ostream &os, const RS_Spline &l)
 Dumps the spline's data to stdout.

Detailed Description

Class for a spline entity.

Author:
Andrew Mustun


Member Function Documentation

RS_ValueList< RS_Vector > RS_Spline::getControlPoints  ) 
 

Returns:
The reference points of the spline.

RS_SplineData RS_Spline::getData  )  const [inline]
 

Returns:
Copy of data that defines the spline.

int RS_Spline::getDegree  )  [inline]
 

Returns:
Degree of this spline curve (1-3).

RS_Vector RS_Spline::getNearestCenter const RS_Vector coord,
double *  dist = NULL
[virtual]
 

Must be overwritten to get the (nearest) center point to the given coordinate for this entity.

Parameters:
coord Coordinate (typically a mouse coordinate)
dist Pointer to a value which will contain the measured distance between 'coord' and the closest center point. The passed pointer can also be NULL in which case the distance will be lost.
Returns:
The closest center point.

Reimplemented from RS_EntityContainer.

RS_Vector RS_Spline::getNearestDist double  distance,
const RS_Vector coord,
double *  dist = NULL
[virtual]
 

Must be overwritten to get the nearest point with a given distance to the endpoint to the given coordinate for this entity.

Parameters:
distance Distance to endpoint.
coord Coordinate (typically a mouse coordinate)
dist Pointer to a value which will contain the measured distance between 'coord' and the closest point. The passed pointer can also be NULL in which case the distance will be lost.
Returns:
The closest point with the given distance to the endpoint.

Reimplemented from RS_EntityContainer.

RS_Vector RS_Spline::getNearestEndpoint const RS_Vector coord,
double *  dist = NULL
[virtual]
 

Returns:
The angle of the line (from end to startpoint).

Reimplemented from RS_EntityContainer.

RS_Vector RS_Spline::getNearestMiddle const RS_Vector coord,
double *  dist = NULL
[virtual]
 

Must be overwritten to get the (nearest) middle point to the given coordinate for this entity.

Parameters:
coord Coordinate (typically a mouse coordinate)
dist Pointer to a value which will contain the measured distance between 'coord' and the closest middle point. The passed pointer can also be NULL in which case the distance will be lost.
Returns:
The closest middle point.

Reimplemented from RS_EntityContainer.

RS_Vector RS_Spline::getNearestRef const RS_Vector coord,
double *  dist = NULL
[virtual]
 

Must be overwritten to get the nearest reference point for this entity.

Parameters:
coord Coordinate (typically a mouse coordinate)
dist Pointer to a value which will contain the measured distance between 'coord' and the closest point. The passed pointer can also be NULL in which case the distance will be lost.
Returns:
The closest point with the given distance to the endpoint.

Reimplemented from RS_EntityContainer.

RS_Vector RS_Spline::getNearestSelectedRef const RS_Vector coord,
double *  dist = NULL
[virtual]
 

Gets the nearest reference point of this entity if it is selected.

Containers re-implement this method to return the nearest reference point of a selected sub entity.

Parameters:
coord Coordinate (typically a mouse coordinate)
dist Pointer to a value which will contain the measured distance between 'coord' and the closest point. The passed pointer can also be NULL in which case the distance will be lost.
Returns:
The closest point with the given distance to the endpoint.

Reimplemented from RS_EntityContainer.

int RS_Spline::getNumberOfControlPoints  )  [inline]
 

Returns:
Number of control points.

int RS_Spline::getNumberOfKnots  )  [inline]
 

Returns:
0.

bool RS_Spline::isClosed  )  [inline]
 

Return values:
true if the spline is closed.
false otherwise.

virtual bool RS_Spline::isEdge  )  const [inline, virtual]
 

Returns:
false

Reimplemented from RS_Entity.

virtual RS2::EntityType RS_Spline::rtti  )  const [inline, virtual]
 

Returns:
RS2::EntitySpline

Reimplemented from RS_EntityContainer.

void RS_Spline::update  )  [virtual]
 

Sets the endpoint.

Called when the spline or it's data, position, .. changes.

Reimplemented from RS_EntityContainer.


The documentation for this class was generated from the following files:
Generated on Sat Jan 6 13:48:23 2007 for qcadlib by  doxygen 1.4.4