libsurf
Programmer's Documentation

abstractcurve.h (r6227/r6192)
1 
2 /* Copyright (C) 2015 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_ABSTRACTCURVE_H
16 #define SURF_ABSTRACTCURVE_H
17 
18 #include "forward.h"
19 #include <genua/trafo.h>
20 #include <genua/xmlelement.h>
21 
31 class AbstractCurve : public RFrame
32 {
33 public:
34 
36  explicit AbstractCurve(const std::string & s = "") : ids(s) {}
37 
39  virtual ~AbstractCurve() {}
40 
42  void rename(const std::string & s) {ids = s;}
43 
45  const std::string & name() const {return ids;}
46 
48  virtual AbstractCurve *clone() const = 0;
49 
51  virtual Vct3 eval(Real t) const = 0;
52 
54  virtual Vct3 derive(Real t, uint k) const = 0;
55 
57  virtual void apply() = 0;
58 
60  virtual void tgline(Real t, Vct3 & c, Vct3 & dc) const;
61 
63  virtual Real curvature(Real t) const;
64 
66  virtual void initGrid(Vector & t) const;
67 
69  virtual uint discretize(const DcMeshCritBase &mcrit, Vector &t) const;
70 
72  virtual void tessellate(CgMesh & cgr) const;
73 
75  virtual bool project(const Vct3 &pt, Real & s,
76  Real stol=gmepsilon, Real ttol=1e-6) const;
77 
79  virtual bool pierce(const Vct3 &pn, Real dp, Real &s, Real stol=gmepsilon) const;
80 
82  virtual XmlElement toXml(bool share = false) const;
83 
85  virtual void fromXml(const XmlElement & xe);
86 
88  virtual int toIges(IgesFile & file, int tfi = 0) const;
89 
91  virtual bool fromIges(const IgesFile & file, const IgesDirEntry & dir);
92 
94  static AbstractCurvePtr createFromXml(const XmlElement & xe);
95 
97  static AbstractCurvePtr createFromIges(const IgesFile & file,
98  const IgesDirEntry & entry);
99 
101  static void gridFromKnots(uint n, const Vector & kts, Vector & t,
102  Real tstart=0.0, Real tend=1.0);
103 
108  static uint arclenParamet(const AbstractCurveArray & cpa, Vector & vp);
109 
111  //static AbstractCurvePtr joinCurves(AbstractCurveArray &crv);
112 
113 protected:
114 
116  void setIgesName(const IgesFile & file, const IgesEntity & e);
117 
119  void setIgesTransform(const IgesFile & file, const IgesDirEntry & entry);
120 
121 protected:
122 
124  std::string ids;
125 };
126 
127 #endif // ABSTRACTCURVE_H
virtual Real curvature(Real t) const
compute curvature at t
Definition: abstractcurve.cpp:98
virtual uint discretize(const DcMeshCritBase &mcrit, Vector &t) const
discretization based on simple criteria
Definition: abstractcurve.cpp:210
Base class for all curve objects.
Definition: abstractcurve.h:31
void rename(const std::string &s)
change name
Definition: abstractcurve.h:42
void setIgesName(const IgesFile &file, const IgesEntity &e)
find curves that fit together and create a composite curve, decimate list
Definition: abstractcurve.cpp:364
virtual void tgline(Real t, Vct3 &c, Vct3 &dc) const
compute point and first derivative in one sweep
Definition: abstractcurve.cpp:41
virtual Vct3 derive(Real t, uint k) const =0
compute kth derivative
Base class for entities in IGES files.
Definition: igesentity.h:32
const std::string & name() const
return name
Definition: abstractcurve.h:45
Base class for mesh quality criteria.
Definition: dcmeshcrit.h:30
static AbstractCurvePtr createFromXml(const XmlElement &xe)
create curve from any xml representation
Definition: abstractcurve.cpp:258
Data in each directory entry of an IGES file.
Definition: igesdirentry.h:31
static void gridFromKnots(uint n, const Vector &kts, Vector &t, Real tstart=0.0, Real tend=1.0)
discretization from spline knot vector
Definition: abstractcurve.cpp:156
Main interface to IGES files.
Definition: igesfile.h:32
virtual void initGrid(Vector &t) const
generate a reasonable discretization
Definition: abstractcurve.cpp:116
AbstractCurve(const std::string &s="")
unamed curve
Definition: abstractcurve.h:36
virtual bool pierce(const Vct3 &pn, Real dp, Real &s, Real stol=gmepsilon) const
compute intersection of curve with plane (pn,dp), return success
Definition: abstractcurve.cpp:80
static AbstractCurvePtr createFromIges(const IgesFile &file, const IgesDirEntry &entry)
create curve from IGES entity
Definition: abstractcurve.cpp:312
virtual int toIges(IgesFile &file, int tfi=0) const
write curve to iges file
Definition: abstractcurve.cpp:146
virtual Vct3 eval(Real t) const =0
evaluate spline curve
virtual bool project(const Vct3 &pt, Real &s, Real stol=gmepsilon, Real ttol=1e-6) const
project point onto curve, starting at t
Definition: abstractcurve.cpp:48
virtual AbstractCurve * clone() const =0
create a clone
virtual bool fromIges(const IgesFile &file, const IgesDirEntry &dir)
extract curve from iges file
Definition: abstractcurve.cpp:151
virtual void apply()=0
apply hard transformation
static uint arclenParamet(const AbstractCurveArray &cpa, Vector &vp)
Parametrization of curve sets.
Definition: abstractcurve.cpp:407
virtual ~AbstractCurve()
virtual destructor
Definition: abstractcurve.h:39
void setIgesTransform(const IgesFile &file, const IgesDirEntry &entry)
extract referenced transformation matrix from IGES file, apply
Definition: abstractcurve.cpp:390
virtual void fromXml(const XmlElement &xe)
XML input.
Definition: abstractcurve.cpp:144
virtual void tessellate(CgMesh &cgr) const
discretized for visualization based on default grid
Definition: abstractcurve.cpp:122
std::string ids
curve object name
Definition: abstractcurve.h:124
virtual XmlElement toXml(bool share=false) const
XML output.
Definition: abstractcurve.cpp:138
Generated on Mon Jan 24 2022 03:03:15 for libsurf by   doxygen 1.8.5