Commit a55f60bf authored by untereiner's avatar untereiner

modifying subdivision filters

parent 411513f7
......@@ -156,6 +156,8 @@ public:
*/
void embedHexaGrid(float x, float y, float z);
void embedHexaGrid(typename PFP::VEC3 origin, float x, float y, float z);
/**
* Create a 3D grid
* @param nx nb of cubes in x
......
......@@ -37,14 +37,14 @@ template <typename PFP>
Dart Primitive3D<PFP>::HexaGrid1Topo(unsigned int nx)
{
// first cube
Dart d0 = createHexahedron<PFP>(m_map);
Dart d0 = createHexahedron<PFP>(m_map,false);
m_tableVertDarts.push_back(d0);
Dart d1 = m_map.template phi<2112>(d0);
for (unsigned int i = 1; i < nx; ++i)
{
Dart d2 = createHexahedron<PFP>(m_map);
Dart d2 = createHexahedron<PFP>(m_map,false);
m_tableVertDarts.push_back(d2);
m_map.sewVolumes(d1, d2, false);
d1 = m_map.template phi<2112>(d2);
......@@ -183,6 +183,37 @@ void Primitive3D<PFP>::embedHexaGrid(float x, float y, float z)
}
}
template <typename PFP>
void Primitive3D<PFP>::embedHexaGrid(typename PFP::VEC3 origin, float x, float y, float z)
{
if (m_kind != HEXAGRID)
{
CGoGNerr << "Warning try to embedHexaGrid something that is not a grid of hexahedron"<<CGoGNendl;
return;
}
float dx = x/float(m_nx);
float dy = y/float(m_ny);
float dz = z/float(m_nz);
unsigned int nbs = (m_nx+1)*(m_ny+1);
for(unsigned int i = 0; i <= m_nz; ++i)
{
for(unsigned int j = 0; j <= m_ny; ++j)
{
for(unsigned int k = 0; k <= m_nx; ++k)
{
typename PFP::VEC3 pos(-x/2.0f + dx*float(k), -y/2.0f + dy*float(j), -z/2.0f + dz*float(i));
Dart d = m_tableVertDarts[ i*nbs+j*(m_nx+1)+k ];
m_map.template setOrbitEmbeddingOnNewCell<VERTEX>(d);
m_positions[d] = origin + pos;
}
}
}
}
template <typename PFP>
void Primitive3D<PFP>::transform(const Geom::Matrix44f& matrice)
{
......
......@@ -133,7 +133,16 @@ public:
m_map.incCurrentLevel() ;
Dart midF = m_map.phi1(m_map.phi1(d));
m_position[midF] += vf + ef ;
if(filtering)
{
std::cout << "sans +=" << std::endl;
m_position[midF] = vf + ef ;
}
else
{
std::cout << "avec +=" << std::endl;
m_position[midF] += vf + ef ;
}
m_map.decCurrentLevel() ;
}
......@@ -146,7 +155,16 @@ public:
m_map.incCurrentLevel() ;
Dart midV = m_map.phi1(d) ;
m_position[midV] += ve;
if(filtering)
{
std::cout << "sans +=" << std::endl;
m_position[midV] = ve;
}
else
{
std::cout << "avec +=" << std::endl;
m_position[midV] += ve;
}
m_map.decCurrentLevel() ;
}
}
......@@ -251,9 +269,15 @@ public:
ev *= 2 * m_a;
if(filtering)
{
std::cout << "sans +=" << std::endl;
m_position[db] = ev;
}
else
{
std::cout << "avec +=" << std::endl;
m_position[db] += ev;
}
}
else
{
......@@ -276,9 +300,15 @@ public:
ev /= count;
ev *= 4 * m_a;
if(filtering)
m_position[d] = fv;// + ev;
{
std::cout << "sans +=" << std::endl;
m_position[d] = fv + ev;
}
else
{
std::cout << "avec +=" << std::endl;
m_position[d] += fv + ev;
}
}
}
......@@ -306,9 +336,15 @@ public:
m_map.incCurrentLevel() ;
Dart midF = m_map.phi1(d);
if(filtering)
m_position[midF] += fe;
{
std::cout << "sans +=" << std::endl;
m_position[midF] = fe;
}
else
{
std::cout << "avec +=" << std::endl;
m_position[midF] += fe;
}
m_map.decCurrentLevel() ;
}
}
......
......@@ -90,6 +90,11 @@ public:
first = false;
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -118,6 +123,11 @@ public:
first = false;
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -144,6 +154,11 @@ public:
m_map.decCurrentLevel() ;
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -192,6 +207,11 @@ public:
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -244,6 +264,11 @@ public:
m_map.decCurrentLevel() ;
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -277,6 +302,11 @@ public:
m_map.decCurrentLevel() ;
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -310,6 +340,11 @@ public:
m_map.decCurrentLevel() ;
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -364,6 +399,11 @@ public:
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -411,6 +451,10 @@ public:
m_position[m_map.phi2(m_map.phi1(d))] = m_position[m_map.phi2(m_map.phi1(d))] - v - e ;
m_map.decCurrentLevel() ;
}
}
void operator() (bool filtering)
{
}
} ;
......@@ -439,6 +483,11 @@ public:
m_map.decCurrentLevel() ;
}
}
void operator() (bool filtering)
{
}
} ;
} // namespace Filters
......
......@@ -99,6 +99,11 @@ public:
m_map.decCurrentLevel() ;
}
}
void operator() (bool filtering)
{
}
};
// Tri/quad refinement
......@@ -156,6 +161,11 @@ public:
m_map.decCurrentLevel() ;
}
}
void operator() (bool filtering)
{
}
};
/*********************************************************************************
......@@ -214,6 +224,11 @@ public:
m_map.decCurrentLevel() ;
}
}
void operator() (bool filtering)
{
}
};
// Tri/quad refinement
......@@ -271,6 +286,11 @@ public:
}
}
}
void operator() (bool filtering)
{
}
};
} // namespace Filters
......
......@@ -121,6 +121,11 @@ public:
m_map.decCurrentLevel() ;
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -143,6 +148,11 @@ public:
m_position[d] -= p ;
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -168,6 +178,11 @@ public:
m_position[d] /= n ;
}
}
void operator() (bool filtering)
{
}
} ;
/*********************************************************************************
......@@ -200,6 +215,11 @@ public:
m_map.decCurrentLevel() ;
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -222,6 +242,11 @@ public:
m_position[d] += p ;
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -247,6 +272,11 @@ public:
m_position[d] *= n ;
}
}
void operator() (bool filtering)
{
}
} ;
} // namespace Filters
......
......@@ -80,6 +80,11 @@ public:
}
}
void operator() (bool filtering)
{
}
} ;
......
......@@ -141,6 +141,11 @@ public:
m_map.decCurrentLevel() ;
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -225,6 +230,11 @@ public:
}
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -275,6 +285,11 @@ public:
}
}
void operator() (bool filtering)
{
}
} ;
template <typename PFP>
......@@ -312,6 +327,11 @@ public:
}
}
void operator() (bool filtering)
{
}
} ;
/*********************************************************************************
......
......@@ -258,18 +258,24 @@ void Map2MR<PFP>::synthesis()
{
assert(m_map.getCurrentLevel() < m_map.getMaxLevel() || !"synthesis : called on max level") ;
for(unsigned int i = 0; i < synthesisFilters.size(); ++i)
(*synthesisFilters[i])() ;
// for(unsigned int i = 0; i < synthesisFilters.size(); ++i)
// {
// if((filter == F_LowPass && m_map.getCurrentLevel() <= thresholdHigh) ||
// (filter == F_HighPass && m_map.getCurrentLevel() >= thresholdLow) ||
// (filter == F_BandPass && (thresholdLow >= m_map.getCurrentLevel() && m_map.getCurrentLevel() <= thresholdHigh)))
// (*synthesisFilters[i])(true) ;
// else
// (*synthesisFilters[i])(false) ;
// }
// (*synthesisFilters[i])() ;
for(unsigned int i = 0; i < synthesisFilters.size(); ++i)
{
if((filter == F_LowPass && m_map.getCurrentLevel() <= thresholdHigh) ||
(filter == F_HighPass && m_map.getCurrentLevel() >= thresholdLow) ||
(filter == F_BandPass && (thresholdLow >= m_map.getCurrentLevel() && m_map.getCurrentLevel() <= thresholdHigh)))
{
std::cout << "without details" << std::endl;
(*synthesisFilters[i])(true) ;
}
else
{
std::cout << "with details" << std::endl;
(*synthesisFilters[i])(false) ;
}
}
m_map.incCurrentLevel() ;
}
......
......@@ -67,8 +67,8 @@ public:
void operator() ()
{
TraversorE<typename PFP::MAP> trav(m_map) ;
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
TraversorE<typename PFP::MAP> travE(m_map) ;
for (Dart d = travE.begin(); d != travE.end(); d = travE.next())
{
typename PFP::VEC3 p = (m_position[d] + m_position[m_map.phi2(d)]) * typename PFP::REAL(0.5);
......@@ -80,8 +80,8 @@ public:
m_map.decCurrentLevel() ;
}
TraversorF<typename PFP::MAP> trav(m_map) ;
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
TraversorF<typename PFP::MAP> travF(m_map) ;
for (Dart d = travF.begin(); d != travF.end(); d = travF.next())
{
typename PFP::VEC3 p = Algo::Geometry::faceCentroid<PFP>(m_map, d, m_position);
......@@ -94,8 +94,8 @@ public:
}
TraversorW<typename PFP::MAP> trav(m_map) ;
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
TraversorW<typename PFP::MAP> travW(m_map) ;
for (Dart d = travW.begin(); d != travW.end(); d = travW.next())
{
if(!Algo::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,d) && !Algo::Modelisation::isPrism<PFP>(m_map,d) && !Algo::Modelisation::isPyra<PFP>(m_map,d))
{
......
......@@ -43,7 +43,7 @@ public:
Filter() {}
virtual ~Filter() {}
virtual void operator() () = 0 ;
//virtual void operator() (bool filtering) = 0 ;
virtual void operator() (bool filtering) { }
} ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment