Commit aff22ee0 authored by Sylvain Thery's avatar Sylvain Thery

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