Exemplo n.º 1
0
void CClassifyGrid::NotifyCCSClassified( int ix, int iy )
{
	for ( int x = MinBound( ix ); x <= MaxBound( ix ); x++ )
		for ( int y = MinBound( iy ); y <= MaxBound( iy ); y++ ) {

			bool bAllClassified = true;

			for ( int xx = MinBound( x ); xx <= MaxBound( x ) && bAllClassified; xx++ )
				for ( int yy = MinBound( y ); yy <= MaxBound( y ) && bAllClassified; yy++ ) {
					if ( InBound( xx, yy ) && CheckCCSClassified( Index( xx, yy ) ) == false ) {
						bAllClassified = false;
					}
				}

			if ( bAllClassified ) {
				RefineChunk( m_vecPointer[ Index( x, y ) ] );
			}
		}
}
Exemplo n.º 2
0
void B9SupportAttachmentData::CenterGeometry()
{
    unsigned int t,v;
    Triangle3D* cTri = NULL;
    QVector3D MinBound(999999,999999,999999);
    QVector3D MaxBound(-999999,-9999999,-999999);
    QVector3D Center;

    for(t = 0; t < triList.size(); t++)
    {
        cTri = &triList[t];

        if(cTri->maxBound.x() > MaxBound.x())
            MaxBound.setX(cTri->maxBound.x());
        if(cTri->maxBound.y() > MaxBound.y())
            MaxBound.setY(cTri->maxBound.y());
        if(cTri->maxBound.z() > MaxBound.z())
            MaxBound.setZ(cTri->maxBound.z());

        if(cTri->minBound.x() < MinBound.x())
            MinBound.setX(cTri->minBound.x());
        if(cTri->minBound.y() < MinBound.y())
            MinBound.setY(cTri->minBound.y());
        if(cTri->minBound.z() < MinBound.z())
            MinBound.setZ(cTri->minBound.z());
    }

    Center = (MaxBound + MinBound)*0.5;

    //now we need to move all the triangles...
    for(t = 0; t < triList.size(); t++)
    {
        for(v=0;v<3;v++)
        {
            triList[t].vertex[v] -= Center;
        }
        triList[t].UpdateBounds(); // since we are moving every triangle, we need to update their bounds too.
    }
}