libsurf
Programmer's Documentation

polysplinecurve.h (r6227/r5962)
1 
2 /* Copyright (C) 2017 David Eller <david@larosterna.com>
3  *
4  * Commercial License Usage
5  * Licensees holding valid commercial licenses may use this file in accordance
6  * with the terms contained in their respective non-exclusive license agreement.
7  * For further information contact david@larosterna.com .
8  *
9  * GNU General Public License Usage
10  * Alternatively, this file may be used under the terms of the GNU General
11  * Public License version 3.0 as published by the Free Software Foundation and
12  * appearing in the file gpl.txt included in the packaging of this file.
13  */
14 
15 #ifndef SURF_POLYSPLINECURVE_H
16 #define SURF_POLYSPLINECURVE_H
17 
18 #include <genua/splinebasis.h>
19 #include "abstractcurve.h"
20 
21 class StepFile;
22 class StepEntity;
24 class IgesFile;
25 struct IgesDirEntry;
26 
37 {
38 public:
39 
41  PolySplineCurve(const std::string & s = "")
42  : AbstractCurve(s), kfront(0.0), kback(1.0), tstart(0.0), tend(1.0) {}
43 
45  Vector createPolyline(const PointList3d &pts);
46 
48  void createPolyline(const Vector &upar, const PointList3d &pts);
49 
51  const SplineBasis &basis() const {return ub;}
52 
54  Vct3 eval(Real u) const;
55 
57  Vct3 derive(Real u, uint du) const;
58 
60  void tgline(Real t, Vct3 & c, Vct3 & dc) const;
61 
63  void apply();
64 
66  void initGrid(Vector &t) const;
67 
69  XmlElement toXml(bool share=false) const;
70 
72  void fromXml(const XmlElement & xe);
73 
75  bool fromStep(const StepFile & file, const StepBSplineCurveWithKnots *ep);
76 
78  bool fromIges(const IgesFile & file, const IgesDirEntry & entry);
79 
81  int toIges(IgesFile & file, int tfi = 0) const;
82 
84  size_t writeGCode(std::ostream &os) const;
85 
87  PolySplineCurve *clone() const;
88 
89 protected:
90 
92  Real tmap(Real tx) const {return tstart + tx*(tend - tstart);}
93 
94 protected:
95 
98 
101 
103  Real kfront, kback;
104 
106  Real tstart, tend;
107 };
108 
109 #endif // POLYSPLINECURVE_H
void tgline(Real t, Vct3 &c, Vct3 &dc) const
compute point and first derivative in one sweep
Definition: polysplinecurve.cpp:91
Base class for all curve objects.
Definition: abstractcurve.h:31
Real tmap(Real tx) const
remap parameter value
Definition: polysplinecurve.h:92
Definition: step_ap203.h:5290
Data in each directory entry of an IGES file.
Definition: igesdirentry.h:31
Real kfront
original knot value range (defined by IGES import)
Definition: polysplinecurve.h:103
Real tstart
define knot region mapped by [0,1]
Definition: polysplinecurve.h:106
Main interface to IGES files.
Definition: igesfile.h:32
Vct3 derive(Real u, uint du) const
derive at (u,v)
Definition: polysplinecurve.cpp:71
int toIges(IgesFile &file, int tfi=0) const
append to IGES file and return the directory entry index, if implemented
Definition: polysplinecurve.cpp:218
XmlElement toXml(bool share=false) const
XML output.
Definition: polysplinecurve.cpp:129
Polynomial spline curve.
Definition: polysplinecurve.h:36
PointList< 3 > cp
control point list
Definition: polysplinecurve.h:100
Vct3 eval(Real u) const
evaluation interface
Definition: polysplinecurve.cpp:54
void initGrid(Vector &t) const
discretization
Definition: polysplinecurve.cpp:122
bool fromIges(const IgesFile &file, const IgesDirEntry &entry)
extract from IGES entity 126
Definition: polysplinecurve.cpp:170
SplineBasis ub
spline basis
Definition: polysplinecurve.h:97
void apply()
coordinate transformation
Definition: polysplinecurve.cpp:114
void fromXml(const XmlElement &xe)
XML input.
Definition: polysplinecurve.cpp:147
Vector createPolyline(const PointList3d &pts)
create a polyline (spline curve with order 1), return parameter vector
Definition: polysplinecurve.cpp:26
Common base class for all STEP entities.
Definition: stepentity.h:31
PolySplineCurve * clone() const
generate a clone
Definition: polysplinecurve.cpp:295
bool fromStep(const StepFile &file, const StepBSplineCurveWithKnots *ep)
extract from STEP entity id
Definition: polysplinecurve.cpp:266
const SplineBasis & basis() const
curve basis
Definition: polysplinecurve.h:51
STEP File.
Definition: stepfile.h:44
PolySplineCurve(const std::string &s="")
create empty spline curve
Definition: polysplinecurve.h:41
size_t writeGCode(std::ostream &os) const
write NC blocks, return number of blocks written
Definition: polysplinecurve.cpp:239
Generated on Mon Jan 24 2022 03:03:16 for libsurf by   doxygen 1.8.5