VMTK
Loading...
Searching...
No Matches
vtkvmtkPolyDataFVFELaplaceBeltramiStencil.cxx
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: VMTK
4 Module: $RCSfile: vtkvmtkPolyDataFVFELaplaceBeltramiStencil.cxx,v $
5 Language: C++
6 Date: $Date: 2006/04/06 16:46:44 $
7 Version: $Revision: 1.4 $
8
9 Copyright (c) Luca Antiga, David Steinman. All rights reserved.
10 See LICENSE file for details.
11
12 Portions of this code are covered under the VTK copyright.
13 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm
14 for details.
15
16 This software is distributed WITHOUT ANY WARRANTY; without even
17 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 PURPOSE. See the above copyright notices for more information.
19
20=========================================================================*/
21
23#include "vtkvmtkMath.h"
24#include "vtkMath.h"
25#include "vtkObjectFactory.h"
26
27#include "vtkvmtkConstants.h"
28
29
31
36
37void vtkvmtkPolyDataFVFELaplaceBeltramiStencil::ComputeArea(vtkPolyData *data, vtkIdType pointId)
38 {
39 double point[3], point1[3], point2[3];
40 vtkIdType j, numberOfTriangles;
41 int triangleObtusity;
42
43 data->GetPoint(pointId,point);
44 this->Area = 0.0;
45
46 if (!this->IsBoundary)
47 numberOfTriangles = this->NPoints;
48 else
49 numberOfTriangles = this->NPoints-1;
50
51 for (j=0; j<numberOfTriangles; j++)
52 {
53 data->GetPoint(this->PointIds[j],point1);
54
55 data->GetPoint(this->PointIds[(j+1)%this->NPoints],point2);
56
57 triangleObtusity = vtkvmtkMath::IsTriangleObtuse(point2,point,point1);
58
59 if (triangleObtusity==VTK_VMTK_NON_OBTUSE)
60 this->Area += vtkvmtkMath::VoronoiSectorArea(point2,point,point1);
61 else if (triangleObtusity==VTK_VMTK_OBTUSE_IN_POINT)
62 this->Area += vtkvmtkMath::TriangleArea(point2,point,point1)/2.0;
63 else if (triangleObtusity==VTK_VMTK_OBTUSE_NOT_IN_POINT)
64 this->Area += vtkvmtkMath::TriangleArea(point2,point,point1)/4.0;
65 }
66 }
67
69 {
70// this->ScaleWithAreaFactor(1.0);
71 this->ScaleWithAreaFactor(1.0/3.0);
72 }
73
74
static double VoronoiSectorArea(double point0[3], double point1[3], double point2[3])
static int IsTriangleObtuse(double point0[3], double point1[3], double point2[3])
static double TriangleArea(double point0[3], double point1[3], double point2[3])
Apply finite-volume, finite-element LB weighting to the neighborhood connections of a surface.
#define VTK_VMTK_OBTUSE_NOT_IN_POINT
Definition vtkvmtkMath.h:35
#define VTK_VMTK_NON_OBTUSE
Definition vtkvmtkMath.h:33
#define VTK_VMTK_OBTUSE_IN_POINT
Definition vtkvmtkMath.h:34
vtkStandardNewMacro(vtkvmtkPolyDataFVFELaplaceBeltramiStencil)