1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
// -*- C++ -*-
// -------------------------------------------------------------------
// MAdLib - Copyright (C) 2008-2009 Universite catholique de Louvain
//
// See the Copyright.txt and License.txt files for license information.
// You should have received a copy of these files along with MAdLib.
// If not, see <http://www.madlib.be/license/>
//
// Please report all bugs and problems to <contrib@madlib.be>
//
// Authors: Olivier Pierard, Gaetan Compere, Jean-Francois Remacle
// -------------------------------------------------------------------
#ifndef _H_EDGESPLITCOLLAPSEOP
#define _H_EDGESPLITCOLLAPSEOP
#include "MAdOperatorBase.h"
namespace MAd {
// -------------------------------------------------------------------
class faceCollapseOp: public MAdOperatorBase
{
public:
faceCollapseOp(pMesh, DiscreteSF *);
faceCollapseOp(const faceCollapseOp &);
~faceCollapseOp() {}
operationType type() const { return MAd_FCOLLAPSE; }
void collapseOnBoundary(bool, double);
void reset(pFace, pEdge, bool);
void getCavity(pPList *) const;
void apply();
private:
bool checkConstraints() const;
bool checkGeometry();
bool evaluateShapes();
bool evaluateShapes2D();
void evaluateLengths() const;
private:
pFace delFace;
pEdge delEdge;
bool clpsOnOppV;
mutable pVertex oppV;
double newVPos[3];
bool constrainBoundary;
bool checkVol;
double dVTol; // tolerance on the relative change of volume
};
// -------------------------------------------------------------------
inline faceCollapseOp::faceCollapseOp(const faceCollapseOp & _fc):
MAdOperatorBase(_fc)
{
delFace = _fc.delFace;
delEdge = _fc.delEdge;
clpsOnOppV = _fc.clpsOnOppV;
oppV = _fc.oppV;
newVPos[0] = _fc.newVPos[0];
newVPos[1] = _fc.newVPos[1];
newVPos[2] = _fc.newVPos[2];
constrainBoundary = _fc.constrainBoundary;
checkVol = _fc.checkVol;
dVTol = _fc.dVTol;
}
// -------------------------------------------------------------------
inline faceCollapseOp::faceCollapseOp(pMesh _m, DiscreteSF * _sf):
MAdOperatorBase(_m,_sf)
{
delFace = NULL;
delEdge = NULL;
clpsOnOppV = true;
oppV = NULL;
newVPos[0] = 0.;
newVPos[1] = 0.;
newVPos[2] = 0.;
constrainBoundary = true;
checkVol = false;
dVTol = MAdTOL;
}
// -------------------------------------------------------------------
// pFace: face which would disapear
// pEdge: Edge which would be split
// clpsOnOppV: Edge collapse type
// True if collapse from SplitEdge to existing vertex
// False if collapse from existing vertex to SplitEdge
// -------------------------------------------------------------------
inline void faceCollapseOp::reset(pFace face, pEdge edge,
bool typeClps)
{
delFace = face;
delEdge = edge;
clpsOnOppV = typeClps;
double Exyz[2][3];
V_coord(E_vertex(delEdge,0),Exyz[0]);
V_coord(E_vertex(delEdge,1),Exyz[1]);
for(int i=0; i<3; i++) {
newVPos[i] = 0.5 * ( Exyz[0][i] + Exyz[1][i] );
}
}
// -------------------------------------------------------------------
inline void faceCollapseOp::collapseOnBoundary(bool cob, double tolerance)
{
constrainBoundary = !cob;
dVTol = tolerance;
}
// -------------------------------------------------------------------
}
#endif
|