libsurf
Programmer's Documentation

slavedwake.h (r6227/r5765)
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_SLAVEDWAKE_H
16 #define SURF_SLAVEDWAKE_H
17 
18 #include "forward.h"
19 #include "surface.h"
20 
39 class SlavedWake : public Surface
40 {
41 public:
42 
45 
47  SlavedWake(SurfacePtr parent, const Vct3 &udr)
48  : Surface("SlavedWake-"+parent->name()), m_parent(parent), m_udr(udr) {}
49 
51  SlavedWake(SurfacePtr parent, SurfacePtr wplus)
52  : Surface("SlavedWake-"+parent->name()), m_parent(parent), m_wplus(wplus) {}
53 
55  virtual ~SlavedWake() {}
56 
58  void init(SurfacePtr parent, const Vct3 &udr) {
59  m_parent = parent;
60  m_udr = udr;
61  m_wplus.reset();
62  }
63 
65  void init(SurfacePtr parent, SurfacePtr wplus) {
66  m_parent = parent;
67  m_wplus = wplus;
68  }
69 
71  void initRuledBezier(SurfacePtr parent,
72  const Vct3 &edgeDistance,
73  const Vct3 &farTangent,
74  Real compression = 0.2);
75 
77  void initRuled(SurfacePtr parent, CurvePtr c0, CurvePtr c1);
78 
85  static CurvePtr cubicGuide(SurfacePtr parent, Real v,
86  const Vct3 &edgeDistance,
87  const Vct3 &farTangent,
88  Real compression = 0.2);
89 
96  static CurvePtr guideCurve(SurfacePtr body, const Vct2 &uvi, const Vct3 &panchor,
97  const Vct3 &edgeDistance,
98  const Vct3 &farTangent, Real vend = 1.0);
99 
101  static Vct3 findIntersection(SurfacePtr wing, SurfacePtr body,
102  Real vlo = 0.0, Real vhi = 1.0);
103 
105  Vct3 eval(Real u, Real v) const {
106  if (m_wplus == nullptr)
107  return m_parent->eval(0.0, v) + u*m_udr;
108  else {
109  Vct3 shift = m_parent->eval(0.0, v) - m_wplus->eval(0.0, v);
110  return shift + m_wplus->eval(u, v);
111  }
112  }
113 
115  Vct3 derive(Real u, Real v, uint du, uint dv) const;
116 
118  void plane(Real u, Real v, Vct3 &S, Vct3 &Su, Vct3 &Sv) const;
119 
121  Vct3 normal(Real, Real v) const;
122 
124  void apply();
125 
127  SlavedWake *clone() const {return new SlavedWake(*this);}
128 
130  XmlElement toXml(bool share) const;
131 
133  void fromXml(const XmlElement &xe);
134 
136  int toIges(IgesFile & igfile, int tfi = 0) const;
137 
138 private:
139 
141  SurfacePtr m_parent;
142 
144  SurfacePtr m_wplus;
145 
147  Vct3 m_udr;
148 };
149 
150 #endif // SLAVEDWAKE_H
void apply()
coordinate transformation disabled
Definition: slavedwake.cpp:229
void fromXml(const XmlElement &xe)
XML import/export disabled.
Definition: slavedwake.cpp:240
static Vct3 findIntersection(SurfacePtr wing, SurfacePtr body, Real vlo=0.0, Real vhi=1.0)
find approximate intersection of wing TE and body
Definition: slavedwake.cpp:189
void init(SurfacePtr parent, const Vct3 &udr)
initialize simple surface from parent surface and direction
Definition: slavedwake.h:58
void initRuledBezier(SurfacePtr parent, const Vct3 &edgeDistance, const Vct3 &farTangent, Real compression=0.2)
construct a linear/cubic-Bezier-based wake surface
Definition: slavedwake.cpp:22
void init(SurfacePtr parent, SurfacePtr wplus)
initialize complex wake surface
Definition: slavedwake.h:65
Main interface to IGES files.
Definition: igesfile.h:32
const std::string & name() const
return name
Definition: surface.h:82
Vct3 m_udr
default wake is just a straight segment
Definition: slavedwake.h:147
static CurvePtr cubicGuide(SurfacePtr parent, Real v, const Vct3 &edgeDistance, const Vct3 &farTangent, Real compression=0.2)
Compute cubic wake guide.
Definition: slavedwake.cpp:203
virtual ~SlavedWake()
virtual destruction
Definition: slavedwake.h:55
Vct3 eval(Real u, Real v) const
evaluate wake
Definition: slavedwake.h:105
SlavedWake()
undefined wake
Definition: slavedwake.h:44
SurfacePtr m_parent
parent wing segment where wake is attached
Definition: slavedwake.h:141
int toIges(IgesFile &igfile, int tfi=0) const
dump wake surface to iges when defined
Definition: slavedwake.cpp:245
SlavedWake * clone() const
clone object
Definition: slavedwake.h:127
static CurvePtr guideCurve(SurfacePtr body, const Vct2 &uvi, const Vct3 &panchor, const Vct3 &edgeDistance, const Vct3 &farTangent, Real vend=1.0)
Compute wake guide curve for tubular body.
Definition: slavedwake.cpp:140
XmlElement toXml(bool share) const
XML import/export disabled.
Definition: slavedwake.cpp:234
Surface interface.
Definition: surface.h:37
void plane(Real u, Real v, Vct3 &S, Vct3 &Su, Vct3 &Sv) const
tangent plane
Definition: slavedwake.cpp:105
Vct3 normal(Real, Real v) const
normal direction
Definition: slavedwake.cpp:127
A wake surface which autmatically attaches to a parent wing TE.
Definition: slavedwake.h:39
SurfacePtr m_wplus
optionally, a more complex surface which is added to the parent&#39;s TE
Definition: slavedwake.h:144
Vct3 derive(Real u, Real v, uint du, uint dv) const
derivatives
Definition: slavedwake.cpp:73
SlavedWake(SurfacePtr parent, const Vct3 &udr)
create simple wake surface
Definition: slavedwake.h:47
SlavedWake(SurfacePtr parent, SurfacePtr wplus)
create a general wake surface defined by means of the added geometry
Definition: slavedwake.h:51
void initRuled(SurfacePtr parent, CurvePtr c0, CurvePtr c1)
construct a wake by defining two end curves which yield (0,0,0) at the TE
Definition: slavedwake.cpp:66
Generated on Wed Jan 19 2022 03:03:15 for libsurf by   doxygen 1.8.5