本文整理汇总了C++中ScalarField::normalize_in_01方法的典型用法代码示例。如果您正苦于以下问题:C++ ScalarField::normalize_in_01方法的具体用法?C++ ScalarField::normalize_in_01怎么用?C++ ScalarField::normalize_in_01使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScalarField
的用法示例。
在下文中一共展示了ScalarField::normalize_in_01方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_t_labels
DANI_INLINE
void EpsTrimesh::set_t_labels(const std::vector<double> labels_sdf)
{
#ifdef CINOLIB
assert (labels_sdf.size() == num_triangles());
double min_value = FLT_MAX;
std::vector<float> labels ;//= labels_sdf;
for (uint tid = 0; tid < num_triangles(); tid++)
{
labels.push_back(labels_sdf.at(tid));
}
ScalarField values (labels);
values.normalize_in_01();
for (uint tid = 0; tid < num_triangles(); tid++)
{
double value = values[tid]; //.at(tid);
if (value < min_value)
min_value = labels.at(tid);
}
std::cout << "Minimum value from double to integer..." << std::endl;
int factor = 1;
int int_value = (int) min_value;
double delta = 0.0; // used to handle minimum values equal to 0
if (min_value == 0.0)
{
delta = 1e-5;
min_value += delta;
}
while (int_value <= 10)
{
factor *= 10;
min_value = (min_value * factor);
int_value = (int) min_value;
std::cout << min_value << " -- " << int_value << std::endl;
}
//(std::cout << std::endl << " Min value " << min_value << " -- integer : " << int_value << std::endl;
std::cout << "Associating triangle labels ..." << std::endl;
for (uint tid = 0; tid < num_triangles(); tid++)
{
double value = values[tid] ;
//int_labels.push_back( (int) (value *factor));
set_t_label(tid, (int) (value *10000));
}
//set_t_labels (int_labels);
#else
std::cerr << "[ERROR] Cinolib required to run this operation. " << std::endl;
exit(1);
#endif
}