Commit aff22ee0 authored by Sylvain Thery's avatar Sylvain Thery
Browse files

topo/topo3 Renders use now faceCentroidELWgit add include/Algo/Render/GL2/topoRender.hpp

parent 92c348c6
...@@ -83,7 +83,7 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const VertexAttribute< ...@@ -83,7 +83,7 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const VertexAttribute<
CellMarker<VOLUME> cmv(mapx); CellMarker<VOLUME> cmv(mapx);
VolumeAutoAttribute<VEC3> centerVolumes(mapx, "centerVolumes"); VolumeAutoAttribute<VEC3> centerVolumes(mapx, "centerVolumes");
Algo::Volume::Geometry::Parallel::computeCentroidVolumes<PFP>(mapx, positions, centerVolumes, allDarts,3); Algo::Volume::Geometry::Parallel::computeCentroidELWVolumes<PFP>(mapx, positions, centerVolumes, allDarts,3);
// debut phi1 // debut phi1
...@@ -123,27 +123,21 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const VertexAttribute< ...@@ -123,27 +123,21 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const VertexAttribute<
float okv = 1.0f - kv; float okv = 1.0f - kv;
VEC3 vc = centerVolumes[d]; VEC3 vc = centerVolumes[d];
VEC3 centerFace(0, 0, 0);
VEC3 centerFace = Algo::Surface::Geometry::faceCentroidELW<PFP>(mapx,d,positions)*kv +vc*okv;
//shrink the face
float okf = 1.0f - kf;
Dart dd = d; Dart dd = d;
do do
{ {
VEC3 P = positions[dd]; VEC3 P = centerFace*okf + (vc*okv + positions[dd]*kv)*kf;
P = vc*okv + P*kv;
vecPos.push_back(P); vecPos.push_back(P);
centerFace += P;
dd = mapx.phi1(dd); dd = mapx.phi1(dd);
} while (dd != d); } while (dd != d);
centerFace /= REAL(vecPos.size());
//shrink the face
unsigned int nb = vecPos.size(); unsigned int nb = vecPos.size();
float okf = 1.0f - kf;
for (unsigned int i = 0; i < nb; ++i)
{
vecPos[i] = centerFace*okf + vecPos[i]*kf;
}
vecPos.push_back(vecPos.front()); // copy the first for easy computation on next loop vecPos.push_back(vecPos.front()); // copy the first for easy computation on next loop
// compute position of points to use for drawing topo // compute position of points to use for drawing topo
...@@ -338,7 +332,7 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const VertexAttribute ...@@ -338,7 +332,7 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const VertexAttribute
// compute center of each volumes // compute center of each volumes
VolumeAutoAttribute<VEC3> centerVolumes(mapx, "centerVolumes"); VolumeAutoAttribute<VEC3> centerVolumes(mapx, "centerVolumes");
Algo::Volume::Geometry::Parallel::computeCentroidVolumes<PFP>(mapx, positions, centerVolumes, good); Algo::Volume::Geometry::Parallel::computeCentroidELWVolumes<PFP>(mapx, positions, centerVolumes, good);
// beta1 // beta1
DartAutoAttribute<VEC3> fv1(mapx); DartAutoAttribute<VEC3> fv1(mapx);
...@@ -379,27 +373,22 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const VertexAttribute ...@@ -379,27 +373,22 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const VertexAttribute
float okv = 1.0f - kv; float okv = 1.0f - kv;
VEC3 vc = centerVolumes[d]; VEC3 vc = centerVolumes[d];
VEC3 centerFace(0, 0, 0);
VEC3 centerFace = Algo::Surface::Geometry::faceCentroidELW<PFP>(mapx,d,positions)*kv +vc*okv;
//shrink the face
float okf = 1.0f - kf;
Dart dd = d; Dart dd = d;
do do
{ {
VEC3 P = positions[dd]; VEC3 P = centerFace*okf + (vc*okv + positions[dd]*kv)*kf;
P = vc*okv + P*kv;
vecPos.push_back(P); vecPos.push_back(P);
centerFace += P;
dd = mapx.phi1(dd); dd = mapx.phi1(dd);
} while (dd != d); } while (dd != d);
centerFace /= REAL(vecPos.size());
//shrink the face
unsigned int nb = vecPos.size(); unsigned int nb = vecPos.size();
float okf = 1.0f - kf;
for (unsigned int i = 0; i < nb; ++i)
{
vecPos[i] = centerFace*okf + vecPos[i]*kf;
}
vecPos.push_back(vecPos.front()); // copy the first for easy computation on next loop vecPos.push_back(vecPos.front()); // copy the first for easy computation on next loop
// compute position of points to use for drawing topo // compute position of points to use for drawing topo
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "Topology/gmap/embeddedGMap2.h" #include "Topology/gmap/embeddedGMap2.h"
#include "Geometry/distances.h" #include "Geometry/distances.h"
#include "Algo/Geometry/centroid.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -117,30 +119,21 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const VertexAttribute<ty ...@@ -117,30 +119,21 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const VertexAttribute<ty
Dart d = *id; Dart d = *id;
if (!mf.isMarked(d)) if (!mf.isMarked(d))
{ {
vecPos.clear(); vecPos.clear();
// store the face & center VEC3 center = Algo::Surface::Geometry::faceCentroidELW<PFP>(mapx,d,positions);
VEC3 center(0.0f,0.0f,0.0f);
float k = 1.0f - kf;
Dart dd = d; Dart dd = d;
do do
{ {
const VEC3& P = positions[d]; vecPos.push_back(center*k + positions[dd]*kf);
vecPos.push_back(P); dd = map.phi1(dd);
center += P; } while (dd != d);
Dart e = map.phi1(d);
d = e;
} while (d != dd);
center /= REAL(vecPos.size());
//shrink the face
unsigned int nb = vecPos.size(); unsigned int nb = vecPos.size();
float k = 1.0f - kf;
for (unsigned int i = 0; i < nb; ++i)
{
vecPos[i] = center*k + vecPos[i]*kf;
}
vecPos.push_back(vecPos.front()); // copy the first for easy computation on next loop vecPos.push_back(vecPos.front()); // copy the first for easy computation on next loop
k = 1.0f - ke; k = 1.0f - ke;
for (unsigned int i = 0; i < nb; ++i) for (unsigned int i = 0; i < nb; ++i)
{ {
...@@ -266,25 +259,17 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const VertexAttribute<t ...@@ -266,25 +259,17 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const VertexAttribute<t
if (!mf.isMarked(d)) if (!mf.isMarked(d))
{ {
vecPos.clear(); vecPos.clear();
// store the face & center VEC3 center = Algo::Surface::Geometry::faceCentroidELW<PFP>(mapx,d,positions);
VEC3 center(0.0f,0.0f,0.0f);
float k = 1.0f - kf;
Dart dd = d; Dart dd = d;
do do
{ {
const VEC3& P = positions[d]; vecPos.push_back(center*k + positions[dd]*kf);
vecPos.push_back(P); dd = map.phi1(dd);
center += P; } while (dd != d);
d = map.phi1(d);
} while (d != dd);
center /= REAL(vecPos.size());
//shrink the face
unsigned int nb = vecPos.size(); unsigned int nb = vecPos.size();
float k = 1.0f - kf;
for (unsigned int i = 0; i < nb; ++i)
{
vecPos[i] = center*k + vecPos[i]*kf;
}
vecPos.push_back(vecPos.front()); // copy the first for easy computation on next loop vecPos.push_back(vecPos.front()); // copy the first for easy computation on next loop
k = 1.0f - ke; k = 1.0f - ke;
......
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