gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
discreteFace.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef DISCRETE_FACE_H
7 #define DISCRETE_FACE_H
8 
9 #include <algorithm>
10 #include "GModel.h"
11 #include "GFace.h"
12 #include "MTriangle.h"
13 #include "SBoundingBox3d.h"
14 #include "rtree.h"
15 
16 class MElementOctree;
17 
18 class discreteFace : public GFace {
19 private:
20  class param {
21  public:
24  std::vector<std::pair<MTriangle *, MTriangle *> *> rtree3dData;
25  std::vector<MVertex> v2d;
26  std::vector<MVertex> v3d;
27  std::vector<MTriangle> t2d;
28  std::vector<MTriangle> t3d;
29  std::vector<SVector3> CURV;
30  double umin, umax, vmin, vmax;
32  param() : oct(nullptr), umin(-1), umax(1), vmin(-1), vmax(1) {}
33  ~param();
34  bool empty() const { return t2d.empty(); }
35  void clear();
36  bool checkPlanar();
37  };
40  void _computeSTLNormals();
41  void _debugParametrization(bool uv);
42 
43 public:
44  discreteFace(GModel *model, int num);
46  virtual ~discreteFace() {}
47  using GFace::point;
48  GPoint point(double par1, double par2) const;
49  SPoint2 parFromPoint(const SPoint3 &p, bool onSurface = true,
50  bool convTestXYZ = false) const;
51  Range<double> parBounds(int i) const;
52  bool containsParam(const SPoint2 &pt);
53  SBoundingBox3d bounds(bool fast = false);
54  GPoint closestPoint(const SPoint3 &queryPoint, double maxDistance,
55  SVector3 *normal = nullptr) const;
56  GPoint closestPoint(const SPoint3 &queryPoint,
57  const double initialGuess[2]) const;
58  SVector3 normal(const SPoint2 &param) const;
59  double curvatureMax(const SPoint2 &param) const;
60  double curvatures(const SPoint2 &param, SVector3 &dirMax, SVector3 &dirMin,
61  double &curvMax, double &curvMin) const;
63  virtual Pair<SVector3, SVector3> firstDer(const SPoint2 &param) const;
64  virtual void secondDer(const SPoint2 &param, SVector3 &dudu, SVector3 &dvdv,
65  SVector3 &dudv) const;
66  int createGeometry();
67  virtual bool haveParametrization() { return !_param.empty(); }
68  virtual void mesh(bool verbose);
69  int trianglePosition(double par1, double par2, double &u, double &v) const;
70  GPoint intersectionWithCircle(const SVector3 &n1, const SVector3 &n2,
71  const SVector3 &p, const double &R,
72  double uv[2]);
73  bool writeParametrization(FILE *fp, bool binary);
74  bool readParametrization(FILE *fp, bool binary);
75  virtual void resetMeshAttributes();
76 };
77 
78 #endif
discreteFace::trianglePosition
int trianglePosition(double par1, double par2, double &u, double &v) const
Definition: discreteFace.cpp:112
MTriangle.h
discreteFace::secondDer
virtual void secondDer(const SPoint2 &param, SVector3 &dudu, SVector3 &dvdv, SVector3 &dudv) const
Definition: discreteFace.cpp:410
discreteFace::curvatures
double curvatures(const SPoint2 &param, SVector3 &dirMax, SVector3 &dirMin, double &curvMax, double &curvMin) const
Definition: discreteFace.cpp:333
GFace.h
GFace
Definition: GFace.h:33
discreteFace::haveParametrization
virtual bool haveParametrization()
Definition: discreteFace.h:67
GEntity::model
GModel * model() const
Definition: GEntity.h:277
SPoint2
Definition: SPoint2.h:12
discreteFace::discreteFace
discreteFace(GModel *model, int num)
Definition: discreteFace.cpp:99
discreteFace::param::rtree3dData
std::vector< std::pair< MTriangle *, MTriangle * > * > rtree3dData
Definition: discreteFace.h:24
discreteFace::param::CURV
std::vector< SVector3 > CURV
Definition: discreteFace.h:29
discreteFace::_param
param _param
Definition: discreteFace.h:38
SPoint3
Definition: SPoint3.h:14
discreteFace::param::clear
void clear()
Definition: discreteFace.cpp:34
discreteFace::param::umax
double umax
Definition: discreteFace.h:30
GFace::point
virtual GPoint point(double par1, double par2) const =0
SVector3
Definition: SVector3.h:16
discreteFace::createGeometry
int createGeometry()
Definition: discreteFace.cpp:557
discreteFace::curvatureMax
double curvatureMax(const SPoint2 &param) const
Definition: discreteFace.cpp:322
discreteFace::containsParam
bool containsParam(const SPoint2 &pt)
Definition: discreteFace.cpp:286
GPoint
Definition: GPoint.h:13
discreteFace::mesh
virtual void mesh(bool verbose)
Definition: discreteFace.cpp:686
rtree.h
discreteFace::closestPoint
GPoint closestPoint(const SPoint3 &queryPoint, double maxDistance, SVector3 *normal=nullptr) const
Definition: discreteFace.cpp:210
discreteFace::param::oct
MElementOctree * oct
Definition: discreteFace.h:22
discreteFace::_debugParametrization
void _debugParametrization(bool uv)
Definition: discreteFace.cpp:416
discreteFace::resetMeshAttributes
virtual void resetMeshAttributes()
Definition: discreteFace.cpp:906
RTree
Definition: rtree.h:100
Range
Definition: Range.h:10
discreteFace::param::~param
~param()
Definition: discreteFace.cpp:29
discreteFace::writeParametrization
bool writeParametrization(FILE *fp, bool binary)
Definition: discreteFace.cpp:805
discreteFace::param::checkPlanar
bool checkPlanar()
Definition: discreteFace.cpp:48
discreteFace::param::v2d
std::vector< MVertex > v2d
Definition: discreteFace.h:25
SBoundingBox3d.h
discreteFace::param::v3d
std::vector< MVertex > v3d
Definition: discreteFace.h:26
discreteFace::~discreteFace
virtual ~discreteFace()
Definition: discreteFace.h:46
discreteFace::point
GPoint point(double par1, double par2) const
Definition: discreteFace.cpp:148
GModel
Definition: GModel.h:44
discreteFace::intersectionWithCircle
GPoint intersectionWithCircle(const SVector3 &n1, const SVector3 &n2, const SVector3 &p, const double &R, double uv[2])
Definition: discreteFace.cpp:692
MElementOctree
Definition: MElementOctree.h:15
discreteFace::param::t2d
std::vector< MTriangle > t2d
Definition: discreteFace.h:27
discreteFace::param::umin
double umin
Definition: discreteFace.h:30
discreteFace::parFromPoint
SPoint2 parFromPoint(const SPoint3 &p, bool onSurface=true, bool convTestXYZ=false) const
Definition: discreteFace.cpp:271
discreteFace::param::empty
bool empty() const
Definition: discreteFace.h:34
GEntity::GeomType
GeomType
Definition: GEntity.h:88
GEntity::DiscreteSurface
@ DiscreteSurface
Definition: GEntity.h:117
discreteFace::parBounds
Range< double > parBounds(int i) const
Definition: discreteFace.cpp:278
discreteFace::param::t3d
std::vector< MTriangle > t3d
Definition: discreteFace.h:28
discreteFace::_createGeometryFromSTL
void _createGeometryFromSTL()
Definition: discreteFace.cpp:624
discreteFace::geomType
GEntity::GeomType geomType() const
Definition: discreteFace.h:62
discreteFace::readParametrization
bool readParametrization(FILE *fp, bool binary)
Definition: discreteFace.cpp:848
discreteFace::param::vmin
double vmin
Definition: discreteFace.h:30
Pair
Definition: Pair.h:10
discreteFace::normal
SVector3 normal(const SPoint2 &param) const
Definition: discreteFace.cpp:299
discreteFace::param::param
param()
Definition: discreteFace.h:32
discreteFace::param::vmax
double vmax
Definition: discreteFace.h:30
GModel.h
discreteFace::param::bbox
SBoundingBox3d bbox
Definition: discreteFace.h:31
discreteFace::bounds
SBoundingBox3d bounds(bool fast=false)
Definition: discreteFace.cpp:293
SBoundingBox3d
Definition: SBoundingBox3d.h:21
discreteFace::param::rtree3d
RTree< std::pair< MTriangle *, MTriangle * > *, double, 3 > rtree3d
Definition: discreteFace.h:23
discreteFace::firstDer
virtual Pair< SVector3, SVector3 > firstDer(const SPoint2 &param) const
Definition: discreteFace.cpp:366
discreteFace::param
Definition: discreteFace.h:20
discreteFace::_computeSTLNormals
void _computeSTLNormals()
Definition: discreteFace.cpp:600
discreteFace
Definition: discreteFace.h:18