本文整理汇总了C++中ConvexPolygon::smallestX方法的典型用法代码示例。如果您正苦于以下问题:C++ ConvexPolygon::smallestX方法的具体用法?C++ ConvexPolygon::smallestX怎么用?C++ ConvexPolygon::smallestX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConvexPolygon
的用法示例。
在下文中一共展示了ConvexPolygon::smallestX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qstart
/**
* Rebin the input quadrilateral to the output grid
* @param inputQ The input polygon
* @param inputWS The input workspace containing the input intensity values
* @param i The index in the vertical axis direction that inputQ references
* @param j The index in the horizontal axis direction that inputQ references
* @param outputWS A pointer to the output workspace that accumulates the data
* @param verticalAxis A vector containing the output vertical axis bin boundaries
*/
void Rebin2D::rebinToFractionalOutput(const Geometry::Quadrilateral & inputQ,
MatrixWorkspace_const_sptr inputWS,
const size_t i, const size_t j,
RebinnedOutput_sptr outputWS,
const std::vector<double> & verticalAxis)
{
const MantidVec & X = outputWS->readX(0);
size_t qstart(0), qend(verticalAxis.size()-1), en_start(0), en_end(X.size() - 1);
if( !getIntersectionRegion(outputWS, verticalAxis, inputQ, qstart, qend, en_start, en_end)) return;
for( size_t qi = qstart; qi < qend; ++qi )
{
const double vlo = verticalAxis[qi];
const double vhi = verticalAxis[qi+1];
for( size_t ei = en_start; ei < en_end; ++ei )
{
const V2D ll(X[ei], vlo);
const V2D lr(X[ei+1], vlo);
const V2D ur(X[ei+1], vhi);
const V2D ul(X[ei], vhi);
const Quadrilateral outputQ(ll, lr, ur, ul);
double yValue = inputWS->readY(i)[j];
if (boost::math::isnan(yValue))
{
continue;
}
try
{
ConvexPolygon overlap = intersectionByLaszlo(outputQ, inputQ);
const double weight = overlap.area()/inputQ.area();
yValue *= weight;
double eValue = inputWS->readE(i)[j] * weight;
const double overlapWidth = overlap.largestX() - overlap.smallestX();
// Don't do the overlap removal if already RebinnedOutput.
// This wreaks havoc on the data.
if(inputWS->isDistribution() && inputWS->id() != "RebinnedOutput")
{
yValue *= overlapWidth;
eValue *= overlapWidth;
}
eValue *= eValue;
PARALLEL_CRITICAL(overlap)
{
outputWS->dataY(qi)[ei] += yValue;
outputWS->dataE(qi)[ei] += eValue;
outputWS->dataF(qi)[ei] += weight;
}
}
catch(Geometry::NoIntersectionException &)
{}
}
}
}