当前位置: 首页>>代码示例>>C++>>正文


C++ ImageView::getYMin方法代码示例

本文整理汇总了C++中ImageView::getYMin方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageView::getYMin方法的具体用法?C++ ImageView::getYMin怎么用?C++ ImageView::getYMin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageView的用法示例。


在下文中一共展示了ImageView::getYMin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addTo

    double PhotonArray::addTo(ImageView<T> target) const
    {
        Bounds<int> b = target.getBounds();

        if (!b.isDefined())
            throw std::runtime_error("Attempting to PhotonArray::addTo an Image with"
                                     " undefined Bounds");

        // Factor to turn flux into surface brightness in an Image pixel
        dbg<<"In PhotonArray::addTo\n";
        dbg<<"bounds = "<<b<<std::endl;

        double addedFlux = 0.;
#ifdef DEBUGLOGGING
        double totalFlux = 0.;
        double lostFlux = 0.;
        int nx = target.getXMax()-target.getXMin()+1;
        int ny = target.getYMax()-target.getYMin()+1;
        std::vector<std::vector<double> > posFlux(nx,std::vector<double>(ny,0.));
        std::vector<std::vector<double> > negFlux(nx,std::vector<double>(ny,0.));
#endif
        for (int i=0; i<int(size()); i++) {
            int ix = int(floor(_x[i] + 0.5));
            int iy = int(floor(_y[i] + 0.5));
#ifdef DEBUGLOGGING
            totalFlux += _flux[i];
            xdbg<<"  photon: ("<<_x[i]<<','<<_y[i]<<")  f = "<<_flux[i]<<std::endl;
#endif
            if (b.includes(ix,iy)) {
#ifdef DEBUGLOGGING
                if (_flux[i] > 0.) posFlux[ix-target.getXMin()][iy-target.getXMin()] += _flux[i];
                else negFlux[ix-target.getXMin()][iy-target.getXMin()] -= _flux[i];
#endif
                target(ix,iy) += _flux[i];
                addedFlux += _flux[i];
            } else {
#ifdef DEBUGLOGGING
                xdbg<<"lost flux at ix = "<<ix<<", iy = "<<iy<<" with flux = "<<_flux[i]<<std::endl;
                lostFlux += _flux[i];
#endif
            }
        }
#ifdef DEBUGLOGGING
        dbg<<"totalFlux = "<<totalFlux<<std::endl;
        dbg<<"addedlFlux = "<<addedFlux<<std::endl;
        dbg<<"lostFlux = "<<lostFlux<<std::endl;
        for(int ix=0;ix<nx;++ix) {
            for(int iy=0;iy<ny;++iy) {
                double pos = posFlux[ix][iy];
                double neg = negFlux[ix][iy];
                double tot = pos + neg;
                if (tot > 0.) {
                    xdbg<<"eta("<<ix+target.getXMin()<<','<<iy+target.getXMin()<<") = "<<
                        neg<<" / "<<tot<<" = "<<neg/tot<<std::endl;
                }
            }
        }
#endif

        return addedFlux;
    }
开发者ID:esheldon,项目名称:GalSim,代码行数:61,代码来源:PhotonArray.cpp


注:本文中的ImageView::getYMin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。