Commit fae720e1 authored by Kevin Tew's avatar Kevin Tew

Added computeDartMiddlePositions to topoRender

parent 8e42adeb
......@@ -383,6 +383,14 @@ public:
template<typename MAP>
void drawColoredDarts(MAP& map);
/**
* Get back middle position of drawn darts
* @param map the map
* @param posExpl the output positions
*/
template<typename PFP>
void computeDartMiddlePositions(typename PFP::MAP& map, DartAttribute< typename PFP::VEC3, typename PFP::MAP>& posExpl);
};
......
......@@ -641,6 +641,23 @@ Dart TopoRender::raySelection(MAP& map, const Geom::Vec3f& rayA, const Geom::Vec
return dFinal;
}
template <typename PFP>
void TopoRender::computeDartMiddlePositions( typename PFP::MAP& map, DartAttribute< typename PFP::VEC3, typename PFP::MAP>& posExpl)
{
DartAttribute<unsigned int, typename PFP::MAP> attIndex = map.template getAttribute<unsigned int, DART, typename PFP::MAP>(m_nameIndex);
if (!attIndex.isValid())
attIndex = map.template addAttribute<unsigned int, DART, typename PFP::MAP>(m_nameIndex);
for (Dart d = map.begin(); d != map.end(); map.next(d))
{
const Geom::Vec3f& P = m_bufferDartPosition[attIndex[d]];
const Geom::Vec3f& Q = m_bufferDartPosition[attIndex[d]+1];
posExpl[d] = (P + Q)*0.5f;
}
}
} // namespace GL2
} // namespace Algo
......
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