int main()
{
    int i,f;
    while(scanf("%d%d",&n,&r),n+r)
    {
        chu();
        k=((2*r+1)*(2*r+1)+1)/2;
        MAX=-1;
        for(i=1;i<=n;i++)
        {
            for(f=1;f<=n;f++)
            {
                inn(old[i][f]);
                old[i][f]++;
                if(old[i][f]>MAX)
                {
                    MAX=old[i][f];
                }
            }
        }
        fun();
        for(i=r+1;i<=n-r;i++)
        {
            for(f=r+1;f<=n-r;f++)
            {
                 out(neww[i][f]-1);
                 printf(" ");
            }
            printf("\n");
        }            
    }
    return 0;
}
Ejemplo n.º 2
0
void Design::paint(Graphics::ManagedSurface *surface, Patterns &patterns, int x, int y) {
	bool needRender = false;

	if (_surface == NULL) {
		_boundsCalculationMode = true;
		_bounds->debugPrint(4, "Internal bounds:");
		render(patterns);
		_boundsCalculationMode = false;
		if (_bounds->right == -10000) {
			_bounds->left = _bounds->top = _bounds->right = _bounds->bottom = 0;
		}
		_bounds->debugPrint(4, "Calculated bounds:");

		_surface = new Graphics::ManagedSurface;
		_surface->create(_bounds->width(), _bounds->height(), Graphics::PixelFormat::createFormatCLUT8());

		_surface->clear(kColorGreen);

		needRender = true;
	}

	_bounds->debugPrint(4, "Using bounds:");
#if 0
	PlotData pd(_surface, &patterns, 8, 1, this);
	int x1 = 50, y1 = 50, x2 = 200, y2 = 200, borderThickness = 30;
	Common::Rect inn(x1-5, y1-5, x2+5, y2+5);
	drawRoundRect(inn, 6, kColorGray, false, drawPixelPlain, &pd);

	drawThickLine(x1, y1, x2-borderThickness, y1, borderThickness, kColorBlack, drawPixel, &pd);
	drawThickLine(x2-borderThickness, y1, x2-borderThickness, y2, borderThickness, kColorBlack, drawPixel, &pd);
	drawThickLine(x2-borderThickness, y2-borderThickness, x1, y2-borderThickness, borderThickness, kColorBlack, drawPixel, &pd);
	drawThickLine(x1, y2-borderThickness, x1, y1, borderThickness, kColorBlack, drawPixel, &pd);
	drawThickLine(x2+10, y2+10, x2+100, y2+100, borderThickness, kColorBlack, drawPixel, &pd);

	g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, _surface->w, _surface->h);

	while (true) {
		((WageEngine *)g_engine)->processEvents();
		g_system->updateScreen();
		g_system->delayMillis(50);
	}
	return;
#endif

	if (needRender)
		render(patterns);

	if (_bounds->width() && _bounds->height()) {
		const int padding = 3;
		Common::Rect from(padding, padding, _bounds->width() - 2 * padding, _bounds->height() - 2 * padding);
		Common::Rect to(from);
		to.moveTo(x, y);
		surface->transBlitFrom(*_surface, from, to, kColorGreen);
	}
}
void akGeometryDeformer::DLBAntipodalitySkinningNoScaling(
    const btAlignedObjectArray<akMatrix4>* mpalette,
    const btAlignedObjectArray<akDualQuat>* dqpalette,
    const UTsize vtxCount,
    const float*     weights, const UTsize weightsStride,
    const UTuint8*   indices, const UTsize indicesStride,
    const akVector3* vtxSrc,  const UTsize vtxSrcStride,
    akVector3*       vtxDst,  const UTsize vtxDstStride,
    const akVector3* normSrc, const UTsize normSrcStride,
    akVector3*       normDst, const UTsize normDstStride)
{
    const btAlignedObjectArray<akMatrix4>& matrices = *mpalette;
    const btAlignedObjectArray<akDualQuat>& dquats = *dqpalette;

    for(unsigned int i=0; i<vtxCount; i++)
    {
        akDualQuat dq0 = dquats[indices[0]];
        akDualQuat dq1 = dquats[indices[1]];
        akDualQuat dq2 = dquats[indices[2]];
        akDualQuat dq3 = dquats[indices[3]];

        if( dot(dq0.n, dq1.n) < 0.0) dq1 *= -1.0;
        if( dot(dq0.n, dq2.n) < 0.0) dq2 *= -1.0;
        if( dot(dq0.n, dq3.n) < 0.0) dq3 *= -1.0;

        akDualQuat dq = dq0 * weights[0];
        if (weights[1]) dq += dq1 * weights[1];
        if (weights[2]) dq += dq2 * weights[2];
        if (weights[3]) dq += dq3 * weights[3];

        dq /= length(dq.n);

        akVector3 ndxyz(dq.n.getXYZ());
        akVector3 dxyz(dq.d.getXYZ());

        //position
        akVector3 in(*vtxSrc);
        *vtxDst = in + 2.0 * cross( ndxyz, cross(ndxyz, in) + dq.n.getW() * in ) +
                  2.0 * ( dq.n.getW() * dxyz - dq.d.getW() * ndxyz + cross(ndxyz, dxyz) );

        // normal
        akVector3 inn(*normSrc);
        *normDst = inn + 2.0 * cross( ndxyz, cross(ndxyz, inn) + dq.n.getW() * inn );

        akAdvancePointer(normSrc, normSrcStride);
        akAdvancePointer(normDst, normDstStride);
        akAdvancePointer(weights, weightsStride);
        akAdvancePointer(indices, indicesStride);
        akAdvancePointer(vtxSrc, vtxSrcStride);
        akAdvancePointer(vtxDst, vtxDstStride);
    }
}
Ejemplo n.º 4
0
main(){
int t;
scanf("%d",&t);
while(t--){
    p1.get();
    p2.get();
    r1.get();
    r2.get();
    if(r1.x>r2.x){
        r1.x+=r2.x;
        r2.x=r1.x-r2.x;
        r1.x-=r2.x;
    }
    if(r1.y>r2.y){
        r1.y+=r2.y;
        r2.y=r1.y-r2.y;
        r1.y-=r2.y;
    }
    r3.x=r1.x,r3.y=r2.y;
    r4.x=r2.x,r4.y=r1.y;
    puts((ins(r1,r3) || ins(r1,r4) || ins (r3,r2) || ins(r2,r4)
    || inn(p1) || inn(p2))?"T":"F");
}
}
Ejemplo n.º 5
0
void DialogGeItem::showInfo()
{
    QString title, text;

    const auto id = getId();
    const auto isIdValid = Utils::Main::isAutoIncrIdIsValid(id);

    if (isIdValid) {
        if (m_deliverers) {
            title = tr("Информация о сдатчике");
            try {
                const auto data = m_deliverers->getDeliverer(id);
                text = QString("Сдатчик %1: inn = %2, address = %3, phoneNumber = %4.")
                        .arg(data.name()).arg(data.inn()).arg(data.address()).arg(data.phoneNumber());
            } catch (const QString &errDescr) {
                QMessageBox::warning(this, title,
                                     tr("Ошибка получения данных о сдатчике: ") + errDescr);
            }
        } else if (m_localities) {
            title = tr("Информация о населенном пункте");
            try {
                const auto locality = m_localities->getLocality(id);
                text = QString::fromUtf8("%1: описание = %2.").
                        arg(locality.name()).arg(locality.description());
            } catch (const QString &errDescr) {
                QMessageBox::warning(this, title,
                                     tr("Ошибка получения данных о населенном пункте: ") + errDescr);
            }
        } else if (m_milkPoints) {
            title = tr("Информация о молокопункте");
            try {
                const auto mp = m_milkPoints->getMilkPoint(id);
                text = QString::fromUtf8("Молочный пункт %1: описание = %2").arg(mp.name()).arg(mp.description());
            } catch (const QString &errDescr) {
                QMessageBox::warning(this, title,
                                     tr("Ошибка получения данных о молокопункте: ") + errDescr);
            }
        }

        QMessageBox::information(this, title, text);
    } else {
        QMessageBox::warning(this, tr(""), tr("Выбор пуст. Невозможно отобразить информацию"));
    }
}