morph threshold comparisons

This commit is contained in:
David Rose 2010-01-11 19:43:54 +00:00
parent 2dd54c37ef
commit 777322003a
9 changed files with 13 additions and 13 deletions

View File

@ -70,7 +70,7 @@ matches_normal(const EggAttributes &other) const {
return true;
}
return (get_normal() == other.get_normal() &&
_dnormals.compare_to(other._dnormals) == 0);
_dnormals.compare_to(other._dnormals, egg_parameters->_normal_threshold) == 0);
}
////////////////////////////////////////////////////////////////////
@ -151,7 +151,7 @@ matches_color(const EggAttributes &other) const {
return true;
}
return (get_color() == other.get_color() &&
_drgbas.compare_to(other._drgbas) == 0);
_drgbas.compare_to(other._drgbas, egg_parameters->_color_threshold) == 0);
}
////////////////////////////////////////////////////////////////////

View File

@ -119,7 +119,7 @@ compare_to(const EggAttributes &other) const {
if (compare != 0) {
return compare;
}
compare = _dnormals.compare_to(other._dnormals);
compare = _dnormals.compare_to(other._dnormals, egg_parameters->_normal_threshold);
if (compare != 0) {
return compare;
}
@ -131,7 +131,7 @@ compare_to(const EggAttributes &other) const {
if (compare != 0) {
return compare;
}
compare = _drgbas.compare_to(other._drgbas);
compare = _drgbas.compare_to(other._drgbas, egg_parameters->_color_threshold);
if (compare != 0) {
return compare;
}

View File

@ -18,7 +18,7 @@
#include "pandabase.h"
#include "eggMorphList.h"
#include "eggParameters.h"
#include "typedObject.h"
#include "luse.h"
#include "pnotify.h"

View File

@ -93,12 +93,12 @@ operator != (const EggMorph<Parameter> &other) const {
////////////////////////////////////////////////////////////////////
template<class Parameter>
INLINE int EggMorph<Parameter>::
compare_to(const EggMorph<Parameter> &other) const {
compare_to(const EggMorph<Parameter> &other, double threshold) const {
int compare = strcmp(get_name().c_str(), other.get_name().c_str());
if (compare != 0) {
return compare;
}
return _offset.compare_to(other._offset);
return _offset.compare_to(other._offset, threshold);
}
////////////////////////////////////////////////////////////////////

View File

@ -40,7 +40,7 @@ public:
INLINE bool operator == (const EggMorph<Parameter> &other) const;
INLINE bool operator != (const EggMorph<Parameter> &other) const;
INLINE int compare_to(const EggMorph<Parameter> &other) const;
INLINE int compare_to(const EggMorph<Parameter> &other, double threshold) const;
INLINE void output(ostream &out, const string &tag,
int num_dimensions) const;

View File

@ -98,12 +98,12 @@ operator < (const EggMorphList<MorphType> &other) const {
////////////////////////////////////////////////////////////////////
template<class MorphType>
int EggMorphList<MorphType>::
compare_to(const EggMorphList<MorphType> &other) const {
compare_to(const EggMorphList<MorphType> &other, double threshold) const {
if (_morphs.size() != other._morphs.size()) {
return (int)_morphs.size() - (int)other._morphs.size();
}
for (size_t i = 0; i < _morphs.size(); i++) {
int compare = _morphs[i].compare_to(other._morphs[i]);
int compare = _morphs[i].compare_to(other._morphs[i], threshold);
if (compare < 0) {
return compare;
}

View File

@ -45,7 +45,7 @@ public:
INLINE bool operator == (const EggMorphList<MorphType> &other) const;
INLINE bool operator != (const EggMorphList<MorphType> &other) const;
INLINE bool operator < (const EggMorphList<MorphType> &other) const;
int compare_to(const EggMorphList<MorphType> &other) const;
int compare_to(const EggMorphList<MorphType> &other, double threshold) const;
INLINE iterator begin();
INLINE const_iterator begin() const;

View File

@ -327,7 +327,7 @@ get_external_index() const {
////////////////////////////////////////////////////////////////////
INLINE bool EggVertex::
sorts_less_than(const EggVertex &other) const {
return compare_to(other) < 0;
return (compare_to(other) < 0);
}

View File

@ -395,7 +395,7 @@ compare_to(const EggVertex &other) const {
if (compare != 0) {
return compare;
}
compare = _dxyzs.compare_to(other._dxyzs);
compare = _dxyzs.compare_to(other._dxyzs, egg_parameters->_pos_threshold);
if (compare != 0) {
return compare;
}