libsurf
Programmer's Documentation

symsurf.h (r6227/r5337)
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_SYMSURF_H
16 #define SURF_SYMSURF_H
17 
18 #include <genua/plane.h>
19 #include "curve.h"
20 #include "surface.h"
21 
39 class SymSurf : public Surface
40 {
41  public:
42 
44  SymSurf(const std::string & name);
45 
47  SymSurf(const SymSurf & s) : Surface(s.ids) { init(*s.psf); }
48 
50  void init(const Surface & srf);
51 
53  void init(const SurfacePtr & psrf) {psf = psrf;}
54 
56  void setMirrorPlane(const Vct3 & orig, const Vct3 & nrm) {
57  mipo = orig;
58  mipn = nrm;
59  }
60 
62  SurfacePtr baseSurface() const {return psf;}
63 
65  Vct3 eval(Real u, Real v) const;
66 
68  Vct3 derive(Real u, Real v, uint du, uint dv) const;
69 
71  void plane(Real u, Real v, Vct3 & S, Vct3 & Su, Vct3 & Sv) const;
72 
74  Vct3 normal(Real u, Real v) const;
75 
77  void apply();
78 
80  void initGridPattern(Vector & up, Vector & vp) const;
81 
83  void initGrid(Real lmax, Real lmin, Real phimax, PointGrid<2> & pts) const;
84 
86  void initMesh(const DnRefineCriterion & c, DnMesh & gnr) const;
87 
89  XmlElement toXml(bool share=false) const;
90 
92  void fromXml(const XmlElement & xe);
93 
95  int toIges(IgesFile & file, int tfi=0) const;
96 
98  SymSurf *clone() const {return new SymSurf(*this);}
99 
100  protected:
101 
103  void mirror(const Vct3 & p, Vct3 & mp) const {
104  mp = p - 2.0*dot( (p-mipo), mipn )*mipn;
105  }
106 
107  private:
108 
110  SurfacePtr psf;
111 
113  Vct3 mipo, mipn;
114 };
115 
116 #endif
SurfacePtr baseSurface() const
access base surface, that is, the one half
Definition: symsurf.h:62
SymSurf(const SymSurf &s)
copy construction
Definition: symsurf.h:47
SurfacePtr psf
the right wing surface which is mirrored
Definition: symsurf.h:110
Mesh generation engine.
Definition: dnmesh.h:47
void apply()
coordinate transformation
Definition: symsurf.cpp:89
void mirror(const Vct3 &p, Vct3 &mp) const
compute the mirror image
Definition: symsurf.h:103
void fromXml(const XmlElement &xe)
XML input.
Definition: symsurf.cpp:160
Main interface to IGES files.
Definition: igesfile.h:32
const std::string & name() const
return name
Definition: surface.h:82
Vct3 normal(Real u, Real v) const
compute normal vector
Definition: symsurf.cpp:80
Vct3 mipo
mirror plane (default: xz-plane)
Definition: symsurf.h:113
SymSurf(const std::string &name)
named construction
Definition: symsurf.cpp:25
void setMirrorPlane(const Vct3 &orig, const Vct3 &nrm)
change the mirror plane
Definition: symsurf.h:56
SymSurf * clone() const
generate a clone
Definition: symsurf.h:98
int toIges(IgesFile &file, int tfi=0) const
write IGES entities and mirror them
Definition: symsurf.cpp:174
void init(const SurfacePtr &psrf)
initialize with surface to mirror (shallow copy)
Definition: symsurf.h:53
Symmetric surface.
Definition: symsurf.h:39
std::string ids
string identifier
Definition: surface.h:196
Vct3 derive(Real u, Real v, uint du, uint dv) const
derive at (u,v)
Definition: symsurf.cpp:50
void plane(Real u, Real v, Vct3 &S, Vct3 &Su, Vct3 &Sv) const
compute point and tangent derivatives at (u,v), for efficiency
Definition: symsurf.cpp:65
void init(const Surface &srf)
initialize with surface to mirror (clones)
Definition: symsurf.cpp:34
Surface interface.
Definition: surface.h:37
void initGrid(Real lmax, Real lmin, Real phimax, PointGrid< 2 > &pts) const
create an unconstrained point grid as initialization for mesh generator
Definition: symsurf.cpp:115
XmlElement toXml(bool share=false) const
XML output.
Definition: symsurf.cpp:149
Vct3 eval(Real u, Real v) const
evaluation interface
Definition: symsurf.cpp:39
Simplest mesh refinement criterion.
Definition: dnrefine.h:43
void initMesh(const DnRefineCriterion &c, DnMesh &gnr) const
initialize mesh generator (marks kink edges)
Definition: symsurf.cpp:136
void initGridPattern(Vector &up, Vector &vp) const
derive a grid pattern from mirrored surface
Definition: symsurf.cpp:103
Generated on Wed Jan 19 2022 03:03:15 for libsurf by   doxygen 1.8.5