本文整理汇总了C++中FileLoader::getMinRange方法的典型用法代码示例。如果您正苦于以下问题:C++ FileLoader::getMinRange方法的具体用法?C++ FileLoader::getMinRange怎么用?C++ FileLoader::getMinRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileLoader
的用法示例。
在下文中一共展示了FileLoader::getMinRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generate
void SimpleVolumeGenerator::generate( const FileLoader &loader,
const FieldSelector &selector,
CoordinateAdjuster &adjuster,
const ColorMap &colormap
) {
if( selector.getFieldNum() < 4 ) {
throw std::runtime_error("SimpleVolumeGenerator::4 indeces is needed at least.");
}
volume_->clear();
// setting coordinates range
const FileLoader::DataType &max_range = loader.getMaxRange();
const FileLoader::DataType &min_range = loader.getMinRange();
const double min_x = selector.getField( min_range, 0);
const double min_y = selector.getField( min_range, 1);
const double min_z = selector.getField( min_range, 2);
const double dist_x = selector.getField( max_range, 0) - min_x;
const double dist_y = selector.getField( max_range, 1) - min_y;
const double dist_z = selector.getField( max_range, 2) - min_z;
const double dist = std::max( dist_x, std::max( dist_y, dist_z ) );
const double max_x = min_x + dist;
const double max_y = min_y + dist;
const double max_z = min_z + dist;
adjuster.setRangeX( max_x, min_x );
adjuster.setRangeY( max_y, min_y );
adjuster.setRangeZ( max_z, min_z );
// setting volume data
for( FileLoader::DataContainerType::const_iterator it = loader.begin();
it != loader.end();
++it ) {
const FileLoader::DataType &data = *it;
const double raw_x = selector.getField( data, 0 );
const double raw_y = selector.getField( data, 1 );
const double raw_z = selector.getField( data, 2 );
const double x = adjuster.x(raw_x) * ( getVolume()->sizex() );
const double y = adjuster.y(raw_y) * ( getVolume()->sizey() );
const double z = adjuster.z(raw_z) * ( getVolume()->sizez() );
double r, g, b, a;
colormap.getColor( adjuster.x(raw_x), &r, &g, &b, &a );
setVolumeElement
(
x, y, z,
r * 255, g * 255, b * 255, a * 255);
}
}