void CBC_QRCoderMatrixUtil::BuildMatrix( CBC_QRCoderBitVector* dataBits, CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t version, int32_t maskPattern, CBC_CommonByteMatrix* matrix, int32_t& e) { if (!matrix) { e = BCExceptionNullPointer; return; } ClearMatrix(matrix, e); if (e != BCExceptionNO) return; EmbedBasicPatterns(version, matrix, e); if (e != BCExceptionNO) return; EmbedTypeInfo(ecLevel, maskPattern, matrix, e); if (e != BCExceptionNO) return; MaybeEmbedVersionInfo(version, matrix, e); if (e != BCExceptionNO) return; EmbedDataBits(dataBits, maskPattern, matrix, e); if (e != BCExceptionNO) return; }
void WrapMatrixBasis (TomVM& vm) { ClearMatrix (); matrix [15] = 1; ReadArray (vm.Data (), vm.GetIntParam (3), vmValType (VTP_REAL, 1, 1, true), &matrix [0], 4); ReadArray (vm.Data (), vm.GetIntParam (2), vmValType (VTP_REAL, 1, 1, true), &matrix [4], 4); ReadArray (vm.Data (), vm.GetIntParam (1), vmValType (VTP_REAL, 1, 1, true), &matrix [8], 4); ReturnMatrix (vm); }
cRegArchValue::~cRegArchValue() { mYt.Delete(); ClearMatrix(mXt) ; mMt.Delete() ; mHt.Delete() ; mUt.Delete() ; mEpst.Delete() ; MESS_DESTR("cRegArchValue") ; }
// Destruktor CKerNamesMain::~CKerNamesMain() { CKerNameList *p=Names, *p2; ClearMatrix(); while(p) { p2=p; p=p->next; delete p2->name; } delete HashTable; }
void cRegArchValue::ReAllocValue(uint theSize, bool theDataValueExists) { if (theSize > 0) { if (!theDataValueExists) { mYt.ReAlloc(theSize) ; ClearMatrix(mXt) ; } mMt.ReAlloc(theSize) ; mHt.ReAlloc(theSize) ; mUt.ReAlloc(theSize) ; mEpst.ReAlloc(theSize) ; } else { mYt.Delete() ; ClearMatrix(mXt) ; mMt.Delete() ; mHt.Delete() ; mUt.Delete() ; mEpst.Delete() ; } }
cRegArchValue::cRegArchValue(uint theSampleSize, cDMatrix* theXt) { if (theSampleSize > 0) { mYt.ReAlloc(theSampleSize) ; if ( (theXt == NULL) || (theXt->GetMat() == NULL) ) ClearMatrix(mXt) ; else mXt = *theXt ; mMt.ReAlloc(theSampleSize) ; mHt.ReAlloc(theSampleSize) ; mUt.ReAlloc(theSampleSize) ; mEpst.ReAlloc(theSampleSize) ; } else { mYt.Delete(); ClearMatrix(mXt) ; mMt.Delete() ; mHt.Delete() ; mUt.Delete() ; mEpst.Delete() ; } MESS_CREAT("cRegArchValue") ; }
cRegArchValue::cRegArchValue(cDVector* theYt, cDMatrix* theXt) // Xt T rows, p columns { if (theYt == NULL) { mYt.Delete() ; ClearMatrix(mXt) ; mMt.Delete() ; mHt.Delete() ; mUt.Delete() ; mEpst.Delete() ; } else { mYt = *theYt ; uint mySampleSize = mYt.GetSize() ; mMt.ReAlloc(mySampleSize) ; mHt.ReAlloc(mySampleSize) ; mUt.ReAlloc(mySampleSize) ; mEpst.ReAlloc(mySampleSize) ; if (theXt == NULL) ClearMatrix(mXt) ; else mXt = *theXt ; } MESS_CREAT("cRegArchValue") ; }
void cRegArchValue::ReAllocValue(cDVector& theYt) { int mySize = (int)theYt.GetSize() ; ClearMatrix(mXt) ; if (mySize > 0) { mYt = theYt ; mMt.ReAlloc(mySize) ; mHt.ReAlloc(mySize) ; mUt.ReAlloc(mySize) ; mEpst.ReAlloc(mySize) ; } else { mYt.Delete() ; mMt.Delete() ; mHt.Delete() ; mUt.Delete() ; mEpst.Delete() ; } }
void cRegArchValue::ReAllocValue(cDVector& theYt, cDMatrix& theXt) // Xt T rows, p columns { uint mySize = theYt.GetSize() ; if ( (mySize > 0)&& (mySize == theXt.GetNRow()) ) { mYt = theYt ; mXt = theXt ; mMt.ReAlloc(mySize) ; mHt.ReAlloc(mySize) ; mUt.ReAlloc(mySize) ; mEpst.ReAlloc(mySize) ; } else { mYt.Delete(); ClearMatrix(mXt) ; mMt.Delete() ; mHt.Delete() ; mUt.Delete() ; mEpst.Delete() ; throw cRegArchError("incompatibility beetwen Yt and Xt") ; } }
// Vytvori Matici // Matice = Pole o velikosti MatrixSize (=Numbers+1) pointeru na ruzne velka pole charu // Slouzi k rychlemu porovnani dvou jmen // Kdyz jsou jmena ve stejnych komponentach, tak informace o jejich vztahu bude v // Matrix[jm1->numer][jm2->MatrixPos]. Viz Funkce Compare void CKerNamesMain::CreateMatrix() { int f; CKerNameList *p; CKerName *root; int size; ClearMatrix(); MatrixSize=Numbers+1; // vytvorim prvni rozmer matice Matrix = new char*[MatrixSize]; for (f=0;f<MatrixSize;f++) Matrix[f]=0; // Smazu informaci o komponente u vsech jmen p=Names; while (p) { p->name->Component=0; p=p->next; } p=Names; // pro vsechny jmena while (p) { root = p->name; if (root->Component==0) { // jmeno dosud nebylo v zadne komponente. Najdu tuto komponenu. // spocitam jeji velikost, jmenum priradim poradova cisla a pridam je do komponenty size = 0; FindComponent(root,root,size); root->matrixsize=size; // nastavim velikost komponenty } else size = root->Component->matrixsize; // prectu si velikost komponenty Matrix[root->number] = new char[size]; // pridam sloupec do matice for (f=0;f<size;f++) Matrix[root->number][f] = 0; SearchDown(root,Matrix[root->number]); SearchUp(root,Matrix[root->number]); // a spocitam jeho hodnoty p=p->next; } MatrixesCalculated = 1; FindMethodsAndParams(); }
void plPXPhysical::Read(hsStream* stream, hsResMgr* mgr) { plPhysical::Read(stream, mgr); ClearMatrix(fCachedLocal2World); PhysRecipe recipe; recipe.mass = stream->ReadLEScalar(); recipe.friction = stream->ReadLEScalar(); recipe.restitution = stream->ReadLEScalar(); recipe.bounds = (plSimDefs::Bounds)stream->ReadByte(); recipe.group = (plSimDefs::Group)stream->ReadByte(); recipe.reportsOn = stream->ReadLE32(); fLOSDBs = stream->ReadLE16(); //hack for swim regions currently they are labeled as static av blockers if(fLOSDBs==plSimDefs::kLOSDBSwimRegion) { recipe.group=plSimDefs::kGroupMax; } // recipe.objectKey = mgr->ReadKey(stream); recipe.sceneNode = mgr->ReadKey(stream); recipe.worldKey = mgr->ReadKey(stream); mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPhysRefSndGroup), plRefFlags::kActiveRef); hsPoint3 pos; hsQuat rot; pos.Read(stream); rot.Read(stream); rot.MakeMatrix(&recipe.l2s); recipe.l2s.SetTranslate(&pos); fProps.Read(stream); if (recipe.bounds == plSimDefs::kSphereBounds) { recipe.radius = stream->ReadLEScalar(); recipe.offset.Read(stream); } else if (recipe.bounds == plSimDefs::kBoxBounds) { recipe.bDimensions.Read(stream); recipe.bOffset.Read(stream); } else { // Read in the cooked mesh plPXStream pxs(stream); if (recipe.bounds == plSimDefs::kHullBounds) recipe.convexMesh = plSimulationMgr::GetInstance()->GetSDK()->createConvexMesh(pxs); else recipe.triMesh = plSimulationMgr::GetInstance()->GetSDK()->createTriangleMesh(pxs); } Init(recipe); hsAssert(!fProxyGen, "Already have proxy gen, double read?"); hsColorRGBA physColor; float opac = 1.0f; if (fGroup == plSimDefs::kGroupAvatar) { // local avatar is light purple and transparent physColor.Set(.2f, .1f, .2f, 1.f); opac = 0.4f; } else if (fGroup == plSimDefs::kGroupDynamic) { // Dynamics are red physColor.Set(1.f,0.f,0.f,1.f); } else if (fGroup == plSimDefs::kGroupDetector) { if(!fWorldKey) { // Detectors are blue, and transparent physColor.Set(0.f,0.f,1.f,1.f); opac = 0.3f; } else { // subworld Detectors are green physColor.Set(0.f,1.f,0.f,1.f); opac = 0.3f; } } else if (fGroup == plSimDefs::kGroupStatic) { if (GetProperty(plSimulationInterface::kPhysAnim)) // Statics that are animated are more reddish? physColor.Set(1.f,0.6f,0.2f,1.f); else // Statics are yellow physColor.Set(1.f,0.8f,0.2f,1.f); // if in a subworld... slightly transparent if(fWorldKey) opac = 0.6f; } else { // don't knows are grey physColor.Set(0.6f,0.6f,0.6f,1.f); } fProxyGen = new plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac); fProxyGen->Init(this); }
void WrapMatrixZero (TomVM& vm) { ClearMatrix (); ReturnMatrix (vm); }