mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-04-29 18:05:21 +00:00
typeid comparison fix, changed distance metric space to [0,1], lots of noisy debugging enabled.
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@1229 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -12,10 +12,10 @@ void PipelineMerger::MergePipelines(const Pipeline & a, const Pipeline & b, Pipe
|
||||
out.screenDecay =lerp( b.screenDecay, a.screenDecay, ratio);
|
||||
out.drawables.clear();
|
||||
|
||||
RenderItemMatcher::MatchResults results = matcher(a.drawables, b.drawables);
|
||||
RenderItemMatcher::MatchResults results = matcher(a.drawables, b.drawables);
|
||||
for (int i = 0; i < a.drawables.size();i++)
|
||||
for (int j = 0; j < b.drawables.size();j++)
|
||||
std::cerr << "[" << i << "][" << j << "]" << matcher.weight(i,j);
|
||||
std::cerr << "[" << i << "][" << j << "]" << matcher.weight(i,j) << std::endl;
|
||||
|
||||
for (std::vector<RenderItem*>::const_iterator pos = a.drawables.begin();
|
||||
pos != a.drawables.end(); ++pos)
|
||||
|
||||
@ -6,5 +6,8 @@
|
||||
*/
|
||||
|
||||
#include "RenderItemDistanceMetric.hpp"
|
||||
|
||||
// Assumes [0, 1] distance space because it's easy to manage with overflow
|
||||
// Underflow is obviously possible though.
|
||||
const double RenderItemDistanceMetric::NOT_COMPARABLE_VALUE
|
||||
(std::numeric_limits<double>::max());
|
||||
(1.0);
|
||||
|
||||
@ -30,7 +30,7 @@ template <class R1, class R2>
|
||||
class RenderItemDistance : public RenderItemDistanceMetric {
|
||||
|
||||
protected:
|
||||
// Override to create your own distance metric for your specified custom types.
|
||||
// Override to create your own distance fmetric for your specified custom types.
|
||||
virtual double computeDistance(const R1 * r1, const R2 * r2) const = 0;
|
||||
|
||||
public:
|
||||
@ -65,10 +65,15 @@ public:
|
||||
|
||||
protected:
|
||||
virtual inline double computeDistance(const RenderItem * lhs, const RenderItem * rhs) const {
|
||||
if (typeid(lhs) == typeid(rhs))
|
||||
if (typeid(*lhs) == typeid(*rhs)) {
|
||||
std::cerr << typeid(*lhs).name() << " and " << typeid(*rhs).name() << "are comparable" << std::endl;
|
||||
|
||||
return 0.0;
|
||||
else
|
||||
}
|
||||
else {
|
||||
std::cerr << typeid(*lhs).name() << " and " << typeid(*rhs).name() << "not comparable" << std::endl;
|
||||
return NOT_COMPARABLE_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -120,8 +125,9 @@ protected:
|
||||
metric = _distanceMetricMap[pair];
|
||||
} else { // Failing that, use rtti && shape distance if its a shape type
|
||||
|
||||
/// @bug This is a non elegant approach to supporting shape distance
|
||||
const double rttiError = _rttiDistance(lhs,rhs);
|
||||
|
||||
/// @bug This is a non elegant approach to supporting shape distance
|
||||
if (rttiError == 0 && _shapeXYDistance.supported(lhs,rhs))
|
||||
return _shapeXYDistance(lhs, rhs);
|
||||
else return rttiError;
|
||||
|
||||
Reference in New Issue
Block a user