本文整理汇总了C++中PointBuffer::applyScaling方法的典型用法代码示例。如果您正苦于以下问题:C++ PointBuffer::applyScaling方法的具体用法?C++ PointBuffer::applyScaling怎么用?C++ PointBuffer::applyScaling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointBuffer
的用法示例。
在下文中一共展示了PointBuffer::applyScaling方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outputDetail
void Delta::outputDetail(PointBuffer& source_data,
IndexedPointBuffer& candidate_data,
std::map<Point, Point> *points) const
{
Schema const& candidate_schema = candidate_data.getSchema();
Dimension const& cDimX = candidate_schema.getDimension("X");
Dimension const& cDimY = candidate_schema.getDimension("Y");
Dimension const& cDimZ = candidate_schema.getDimension("Z");
Schema const& source_schema = source_data.getSchema();
Dimension const& sDimX = source_schema.getDimension("X");
Dimension const& sDimY = source_schema.getDimension("Y");
Dimension const& sDimZ = source_schema.getDimension("Z");
bool bWroteHeader(false);
std::ostream& ostr = m_outputStream ? *m_outputStream : std::cout;
candidate_data.build(m_3d);
boost::uint32_t count(std::min(source_data.getNumPoints(), candidate_data.getNumPoints()));
for (boost::uint32_t i = 0; i < count; ++i)
{
double sx = source_data.applyScaling(sDimX, i);
double sy = source_data.applyScaling(sDimY, i);
double sz = source_data.applyScaling(sDimZ, i);
std::vector<std::size_t> ids = candidate_data.neighbors(sx, sy, sz, 1);
if (!ids.size())
{
std::ostringstream oss;
oss << "unable to find point for id '" << i <<"'";
throw app_runtime_error(oss.str() );
}
std::size_t id = ids[0];
double cx = candidate_data.applyScaling(cDimX, id);
double cy = candidate_data.applyScaling(cDimY, id);
double cz = candidate_data.applyScaling(cDimZ, id);
Point s(sx, sy, sz, id);
Point c(cx, cy, cz, id);
double xd = sx - cx;
double yd = sy - cy;
double zd = sz - cz;
if (!bWroteHeader)
{
writeHeader(ostr, m_3d);
bWroteHeader = true;
}
ostr << i << ",";
boost::uint32_t precision = Utils::getStreamPrecision(cDimX.getNumericScale());
ostr.setf(std::ios_base::fixed, std::ios_base::floatfield);
ostr.precision(precision);
ostr << xd << ",";
precision = Utils::getStreamPrecision(cDimY.getNumericScale());
ostr.precision(precision);
ostr << yd;
if (m_3d)
{
ostr << ",";
precision = Utils::getStreamPrecision(cDimZ.getNumericScale());
ostr.precision(precision);
ostr << zd;
}
ostr << std::endl;
}
if (m_outputStream)
{
FileUtils::closeFile(m_outputStream);
}
}