QCAD Application Framework
CAD Application Development and Automation.
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
RSpline.h
Go to the documentation of this file.
1
#ifndef RSPLINE_H
2
#define RSPLINE_H
3
4
#include <QPainterPath>
5
6
#include "
RBox.h
"
7
#include "
RDirected.h
"
8
#include "
RExplodable.h
"
9
#include "
RShape.h
"
10
#include "
RVector.h
"
11
12
#ifndef RNOOPENNURBS
13
#include "opennurbs/opennurbs.h"
14
#endif
15
27
class
RSpline
:
public
RShape
,
public
RExplodable
,
public
RDirected
{
28
public
:
29
RSpline
();
30
RSpline
(
const
QList<RVector>&
controlPoints
,
int
degree
);
31
virtual
~RSpline
();
32
33
virtual
RSpline
*
clone
()
const
{
34
return
new
RSpline
(*
this
);
35
}
36
37
virtual
void
to2D
();
38
39
virtual
bool
isInterpolated
()
const
{
40
return
true
;
41
}
42
43
//virtual RVector getClosestPointOnShape(const RVector& p, bool limited) const;
44
45
void
appendControlPoint
(
const
RVector
& point);
46
void
removeLastControlPoint
(
bool
upd=
true
);
47
void
setControlPoints
(
const
QList<RVector>& points);
48
QList<RVector>
getControlPoints
()
const
;
49
QList<RVector>
getControlPointsWrapped
()
const
;
50
int
countControlPoints
()
const
;
51
52
void
appendFitPoint
(
const
RVector
& point);
53
void
removeLastFitPoint
(
bool
upd=
true
);
54
void
setFitPoints
(
const
QList<RVector>& points);
55
QList<RVector>
getFitPoints
()
const
;
56
int
countFitPoints
()
const
;
57
bool
hasFitPoints
()
const
;
58
59
QList<double>
getKnotVector
()
const
;
60
void
setKnotVector
(
const
QList<double>& knots);
61
QList<double>
getWeights
()
const
;
62
63
void
setDegree
(
int
d);
64
int
getDegree
()
const
;
65
66
int
getOrder
()
const
;
67
68
void
setPeriodic
(
bool
on);
69
//bool isClosedPeriodic() const;
70
71
bool
isClosed
()
const
;
72
bool
isPeriodic
()
const
;
73
74
virtual
double
getDirection1
()
const
;
75
virtual
double
getDirection2
()
const
;
76
77
virtual
RVector
getStartPoint
()
const
;
78
virtual
RVector
getEndPoint
()
const
;
79
80
void
setStartPoint
(
const
RVector
& v);
81
void
setEndPoint
(
const
RVector
& v);
82
83
void
setTangents
(
const
RVector
& start,
const
RVector
& end);
84
void
unsetTangents
();
85
86
void
setTangentAtStart
(
const
RVector
& t);
87
RVector
getTangentAtStart
()
const
;
88
void
unsetTangentAtStart
();
89
void
setTangentAtEnd
(
const
RVector
& t);
90
RVector
getTangentAtEnd
()
const
;
91
void
unsetTangentAtEnd
();
92
93
void
updateTangentsPeriodic
();
94
95
virtual
RBox
getBoundingBox
()
const
;
96
97
virtual
double
getLength
()
const
;
98
RVector
getPointAt
(
double
t)
const
;
99
100
virtual
QList<RVector>
getEndPoints
()
const
;
101
RVector
getMiddlePoint
()
const
;
102
virtual
QList<RVector>
getMiddlePoints
()
const
;
103
virtual
QList<RVector>
getCenterPoints
()
const
;
104
virtual
QList<RVector>
getPointsWithDistanceToEnd
(
105
double
distance,
RS::From
from =
RS::FromAny
)
const
;
106
107
virtual
RVector
getVectorTo
(
const
RVector
& point,
108
bool
limited =
true
)
const
;
109
110
virtual
bool
move
(
const
RVector
& offset);
111
virtual
bool
rotate
(
double
rotation,
const
RVector
& center =
RDEFAULT_RVECTOR
);
112
virtual
bool
scale
(
const
RVector
& scaleFactors,
const
RVector
& center =
RDEFAULT_RVECTOR
);
113
virtual
bool
mirror
(
const
RLine
& axis);
114
virtual
bool
flipHorizontal
();
115
virtual
bool
flipVertical
();
116
virtual
bool
reverse
();
117
118
virtual
RS::Ending
getTrimEnd
(
const
RVector
& coord,
const
RVector
& trimPoint);
119
virtual
void
trimStartPoint
(
const
RVector
& p);
120
virtual
void
trimEndPoint
(
const
RVector
& p);
121
122
virtual
QList<QSharedPointer<RShape> >
getExploded
()
const
;
123
// virtual bool isInterpolated() const {
124
// return true;
125
// }
126
127
QList<RSpline>
getBezierSegments
()
const
;
128
129
bool
isValid
()
const
;
130
double
getTDelta
()
const
;
131
double
getTMin
()
const
;
132
double
getTMax
()
const
;
133
134
//void close();
135
//RSpline getSubSpline(double d1, double d2) const;
136
137
protected
:
138
void
invalidate
();
139
void
updateInternal
();
140
void
updateBoundingBox
();
141
142
private
:
143
void
updateFromControlPoints
();
144
void
updateFromFitPoints
(
bool
useTangents =
false
);
145
146
public
:
151
QList<RVector>
controlPoints
;
152
156
QList<double>
knotVector
;
157
162
QList<RVector>
fitPoints
;
163
168
int
degree
;
169
173
RVector
tangentStart
;
174
178
RVector
tangentEnd
;
179
183
bool
periodic
;
184
185
protected
:
186
virtual
void
print
(QDebug dbg)
const
;
187
188
private
:
189
#ifndef RNOOPENNURBS
190
mutable
ON_NurbsCurve
curve
;
191
#endif
192
mutable
RBox
boundingBox
;
193
mutable
QList<QSharedPointer<RShape> >
exploded
;
194
};
195
196
Q_DECLARE_METATYPE
(
const
RSpline
*)
197
Q_DECLARE_METATYPE
(
RSpline
*)
198
Q_DECLARE_METATYPE
(
RSpline
)
199
Q_DECLARE_METATYPE
(QList<
RSpline
>)
200
Q_DECLARE_METATYPE
(QSharedPointer<
RSpline
>)
201
Q_DECLARE_METATYPE
(QSharedPointer<
RSpline
>*)
202
203
#endif
src
math
RSpline.h
Generated on Tue Jun 26 2012 18:41:08 for QCAD Application Framework by
1.8.1.1