FacePoint.h
Go to the documentation of this file.
1 #pragma once
2 #include "RichModel.h"
3 #include <fstream>
4 using namespace std;
5 struct FacePoint
6 {
7  int faceID;
8  double lamda1, lamda2, lamda3;
9 
11  FacePoint(int faceID, double lamda1, double lamda2)
12  : faceID(faceID), lamda1(lamda1), lamda2(lamda2)
13  {
14  lamda3 = 1 - lamda1 - lamda2;
15  }
16 
17  CPoint3D Get3DPoint(const CRichModel& model) const
18  {
19  return lamda1 * model.GetShiftVertex(model.Face(faceID)[0])
20  + lamda2 * model.GetShiftVertex(model.Face(faceID)[1])
21  + lamda3 * model.GetShiftVertex(model.Face(faceID)[2]);
22  }
23  pair<double, double> Get2DCoord(const CRichModel& model, int edgeIndex) const
24  {
25  double x, y;
26  if (model.Edge(edgeIndex).indexOfLeftVert == model.Face(faceID)[0])
27  {
28  x = lamda1 * 0 + lamda2 * model.Edge(edgeIndex).length + lamda3 * model.Edge(edgeIndex).coordOfOppositeVert.first;
29  y = lamda1 * 0 + lamda2 * 0 + lamda3 * model.Edge(edgeIndex).coordOfOppositeVert.second;
30  }
31  else if (model.Edge(edgeIndex).indexOfLeftVert == model.Face(faceID)[1])
32  {
33  x = lamda2 * 0 + lamda3 * model.Edge(edgeIndex).length + lamda1 * model.Edge(edgeIndex).coordOfOppositeVert.first;
34  y = lamda2 * 0 + lamda3 * 0 + lamda1 * model.Edge(edgeIndex).coordOfOppositeVert.second;
35  }
36  else
37  {
38  x = lamda3 * 0 + lamda1 * model.Edge(edgeIndex).length + lamda2 * model.Edge(edgeIndex).coordOfOppositeVert.first;
39  y = lamda3 * 0 + lamda1 * 0 + lamda2 * model.Edge(edgeIndex).coordOfOppositeVert.second;
40  }
41  return make_pair(x, y);
42  }
43 };
FacePoint(int faceID, double lamda1, double lamda2)
Definition: FacePoint.h:11
FacePoint()
Definition: FacePoint.h:10
pair< double, double > coordOfOppositeVert
Definition: RichModel.h:30
CPoint3D Get3DPoint(const CRichModel &model) const
Definition: FacePoint.h:17
const CEdge & Edge(int edgeIndex) const
Definition: RichModel.cpp:669
double lamda3
Definition: FacePoint.h:8
pair< double, double > Get2DCoord(const CRichModel &model, int edgeIndex) const
Definition: FacePoint.h:23
CPoint3D GetShiftVertex(int indexOfVert) const
Definition: BaseModel.cpp:544
const CFace & Face(int faceIndex) const
Definition: BaseModel.h:100
int faceID
Definition: FacePoint.h:7


co_scan
Author(s):
autogenerated on Mon Feb 28 2022 23:00:41