/*! Returns a random policy, given the possible actions for each state. * */ uvec create_random_policy(const vector<uvec> & possible_actions){ size_t nstates = possible_actions.size(); uvec pol(nstates); for(auto state : range(nstates)){ pol(state) = possible_actions[state](randint(possible_actions[state].size())); } return pol; }
void operator()( int id ) const { rml::MemPoolPolicy pol(CrossThreadGetMem, CrossThreadPutMem); const int objLen = 10*id; pool_create_v1(id, &pol, &pool[id]); obj[id] = (char*)pool_malloc(pool[id], objLen); ASSERT(obj[id], NULL); memset(obj[id], id, objLen); { const size_t lrgSz = 2*16*1024; void *ptrLarge = pool_malloc(pool[id], lrgSz); ASSERT(ptrLarge, NULL); memset(ptrLarge, 1, lrgSz); // consume all small objects while (pool_malloc(pool[id], 5*1024)) ; // releasing of large object can give a chance to allocate more pool_free(pool[id], ptrLarge); ASSERT(pool_malloc(pool[id], 5*1024), NULL); } barrier.wait(); int myPool = number_of_threads-id-1; for (int i=0; i<10*myPool; i++) ASSERT(myPool==obj[myPool][i], NULL); pool_free(pool[myPool], obj[myPool]); pool_destroy(pool[myPool]); }
// single pool shared by different threads void TestSharedPool() { rml::MemPoolPolicy pol(getMallocMem, putMallocMem); rml::MemoryPool *pool; pool_create_v1(0, &pol, &pool); void **crossThread = new void*[MaxThread * SharedPoolRun::OBJ_CNT]; void **afterTerm = new void*[MaxThread * SharedPoolRun::OBJ_CNT]; for (int p=MinThread; p<=MaxThread; p++) { SharedPoolRun::init(p, pool, crossThread, afterTerm); SharedPoolRun thr; void *hugeObj = pool_malloc(pool, 10*1024*1024); ASSERT(hugeObj, NULL); NativeParallelFor( p, thr ); pool_free(pool, hugeObj); for (int i=0; i<p*SharedPoolRun::OBJ_CNT; i++) pool_free(pool, afterTerm[i]); } delete []afterTerm; delete []crossThread; pool_destroy(pool); ASSERT(!liveRegions, "Expected all regions were released."); }
bool Zone2DPolygon::setParameters(QDomNode ¶ms) { while( !params.isNull() ) { QDomElement f = params.toElement(); if( !f.isNull() ) { if( f.tagName() == "OutlineList" ) { QSharedPointer< polygon2D<int> > pol(new polygon2D<int>()); outline = pol; QDomNode p = params.firstChild(); while( !p.isNull() ) { QDomElement g = p.toElement(); if( !g.isNull() ) { if( g.tagName() == "Point" ) { point2D<int> point; point.x = g.attribute("X","0").toInt(); point.y = g.attribute("Y","0").toInt(); pol->points.push_back(point); } } p = p.nextSibling(); } } } params = params.nextSibling(); } return true; }
bool ZoneHPolygon::setParameters(QDomNode ¶ms, homography_matrix h_matrix) { while( !params.isNull() ) { QDomElement f = params.toElement(); if( !f.isNull() ) { if( f.tagName() == "OutlineList" ) { QSharedPointer< polygon2D<double> > pol(new polygon2D<double>()); outline2D = pol; QDomNode p = params.firstChild(); while( !p.isNull() ) { QDomElement g = p.toElement(); if( !g.isNull() ) { if( g.tagName() == "Point" ) { point2D<double> point; point.x = g.attribute("X","0").toDouble(); point.y = g.attribute("Y","0").toDouble(); pol->points.push_back(point); } } p = p.nextSibling(); } outline = pol->projectImagePolygon2D(h_matrix); } } params = params.nextSibling(); } return true; }
static void TestEntries() { const int SZ = 4; const int ALGN = 4; size_t size[SZ] = {8, 8000, 9000, 100*1024}; size_t algn[ALGN] = {8, 64, 4*1024, 8*1024*1024}; rml::MemPoolPolicy pol(getGranMem, putGranMem); currGranularity = 1; // not check granularity in the test rml::MemoryPool *pool; pool_create_v1(0, &pol, &pool); for (int i=0; i<SZ; i++) for (int j=0; j<ALGN; j++) { char *p = (char*)pool_aligned_malloc(pool, size[i], algn[j]); ASSERT(p && 0==((uintptr_t)p & (algn[j]-1)), NULL); memset(p, j, size[i]); size_t curr_algn = algn[rand() % ALGN]; size_t curr_sz = size[rand() % SZ]; char *p1 = (char*)pool_aligned_realloc(pool, p, curr_sz, curr_algn); ASSERT(p1 && 0==((uintptr_t)p1 & (curr_algn-1)), NULL); ASSERT(memEqual(p1, min(size[i], curr_sz), j), NULL); memset(p1, j+1, curr_sz); size_t curr_sz1 = size[rand() % SZ]; char *p2 = (char*)pool_realloc(pool, p1, curr_sz1); ASSERT(p2, NULL); ASSERT(memEqual(p2, min(curr_sz1, curr_sz), j+1), NULL); pool_free(pool, p2); } pool_destroy(pool); }
double chi2_pol(bvec par,double *x,bvec y) { double c2=0; for(int i=0;i<y.nel;i++) c2+=sqr((y[i]-pol(par,x[i])).med()/y[i].err()); return c2; }
void TestFixedBufferPool() { void *ptrs[7]; rml::MemPoolPolicy pol(fixedBufGetMem, NULL, 0, /*fixedSizePool=*/true, /*keepMemTillDestroy=*/false); rml::MemoryPool *pool; pool_create_v1(0, &pol, &pool); void *largeObj = pool_malloc(pool, 7*1024*1024); ASSERT(largeObj, NULL); pool_free(pool, largeObj); for (int i=0; i<7; i++) { ptrs[i] = pool_malloc(pool, 1024*1024); ASSERT(ptrs[i], NULL); } for (int i=0; i<7; i++) pool_free(pool, ptrs[i]); largeObj = pool_malloc(pool, 7*1024*1024); ASSERT(largeObj, NULL); pool_free(pool, largeObj); pool_destroy(pool); }
void CFilterer::filterPortalsIntoTree(){ return; for(int i=0;i<portalPNo;i++){ portalCurrentlyFilter = i; CPolygon pol((*portalPolygons)[i]->getVertices()); filterPortalIntoTree(rootNode, &pol); } }
Parallelogram::Parallelogram(const Vec2& tl, double width, double height, const Arg& arg1, Arg arg2, Color color):Object(color) { if(dist(arg2, 0.0) < 1.0e-6) arg2 = arg1-PI_2; vh = pol(width, arg1); vv = pol(height, arg2); this->tl = tl; tr = tl+vh; bl = tl-vv; br = tl+vh-vv; p = (tl+br)/2; this->height = height; this->width = width; this->arg1 = arg1; this->arg2 = arg2; }
// buffer is too small to pool be created, but must not leak resourses void TestTooSmallBuffer() { poolSpace = new PoolSpace(8*1024); rml::MemPoolPolicy pol(CrossThreadGetMem, CrossThreadPutMem); rml::MemoryPool *pool; pool_create_v1(0, &pol, &pool); pool_destroy(pool); ASSERT(!poolSpace[0].regions, "No leaks."); delete poolSpace; }
/* test that pools in small space are either usable or not created (i.e., exception raised) */ void TestSmallFixedSizePool() { char *buf; bool allocated = false; for (size_t sz = 0; sz < 64*1024; sz = sz? 3*sz : 3) { buf = (char*)malloc(sz); #if TBB_USE_EXCEPTIONS try { tbb::fixed_pool pool(buf, sz); /* Check that pool is usable, i.e. such an allocation exists, that can be fulfilled from the pool. 16B allocation fits in 16KB slabs, so it requires at least 16KB. Requirement of 9KB allocation is more modest. */ allocated = pool.malloc( 16 ) || pool.malloc( 9*1024 ); ASSERT(allocated, "If pool created, it must be useful."); } catch (std::bad_alloc) { } catch (...) { ASSERT(0, "wrong exception type; expected bad_alloc"); } #else /* Do not test high-level pool interface because pool ctor emit exception on creation failure. Instead test same functionality via low-level interface. TODO: add support for configuration with disabled exceptions to pools. */ rml::MemPoolPolicy pol(fixedBufGetMem, NULL, 0, /*fixedSizePool=*/true, /*keepMemTillDestroy=*/false); rml::MemoryPool *pool; FixedPool fixedPool(buf, sz); rml::MemPoolError ret = pool_create_v1((intptr_t)&fixedPool, &pol, &pool); if (ret == rml::POOL_OK) { allocated = pool_malloc(pool, 16) || pool_malloc(pool, 9*1024); ASSERT(allocated, "If pool created, it must be useful."); pool_destroy(pool); } else ASSERT(ret == rml::NO_MEMORY, "Expected that pool either valid " "or have no memory to be created"); #endif free(buf); } ASSERT(allocated, "Maximal buf size should be enough to create working fixed_pool"); #if TBB_USE_EXCEPTIONS try { tbb::fixed_pool pool(NULL, 10*1024*1024); ASSERT(0, "Useless allocator with no memory must not be created"); } catch (std::bad_alloc) { } catch (...) { ASSERT(0, "wrong exception type; expected bad_alloc"); } #endif }
HighPrecisionComplexPolynom HighPrecisionComplexPolynom::calcDerivative() { int len = length-1; if (length < 1) len = 1; HighPrecisionComplexPolynom pol(len, DIGIT); char* xxxStr = new char[1000]; for (int I=0; I<length-1; I++) { snprintf(xxxStr,1000,"%d.0e+0_%d",I+1, DIGIT); cln::cl_F f = xxxStr; cln::cl_N fac = complex(f, ZERO); pol.setCoeff(I, fac*coeff[I+1]); } delete[] xxxStr; return pol; }
rectActions OnMonitorRectItem::getMode(const QPointF &pos) { // Item mapped coordinates QPolygonF pol(rect().normalized()); QPainterPath top(pol.at(0)); top.lineTo(pol.at(1)); QPainterPath bottom(pol.at(2)); bottom.lineTo(pol.at(3)); QPainterPath left(pol.at(0)); left.lineTo(pol.at(3)); QPainterPath right(pol.at(1)); right.lineTo(pol.at(2)); QPainterPath mouseArea; qreal xsize = 12; qreal ysize = 12; if (getView()) { xsize /= m_view->matrix().m11(); ysize /= m_view->matrix().m22(); } mouseArea.addRect(pos.x() - xsize / 2, pos.y() - ysize / 2, xsize, ysize); // Check for collisions between the mouse and the borders if (mouseArea.contains(pol.at(0))) return ResizeTopLeft; else if (mouseArea.contains(pol.at(2))) return ResizeBottomRight; else if (mouseArea.contains(pol.at(1))) return ResizeTopRight; else if (mouseArea.contains(pol.at(3))) return ResizeBottomLeft; else if (top.intersects(mouseArea)) return ResizeTop; else if (bottom.intersects(mouseArea)) return ResizeBottom; else if (right.intersects(mouseArea)) return ResizeRight; else if (left.intersects(mouseArea)) return ResizeLeft; else if (rect().normalized().contains(pos)) return Move; else return NoAction; }
static void TestPoolGranularity() { rml::MemPoolPolicy pol(getGranMem, putGranMem); const size_t grans[] = {4*1024, 2*1024*1024, 6*1024*1024, 10*1024*1024}; for (unsigned i=0; i<sizeof(grans)/sizeof(grans[0]); i++) { pol.granularity = currGranularity = grans[i]; rml::MemoryPool *pool; pool_create_v1(0, &pol, &pool); for (int sz=500*1024; sz<16*1024*1024; sz+=101*1024) { void *p = pool_malloc(pool, sz); ASSERT(p, "Can't allocate memory in pool."); pool_free(pool, p); } pool_destroy(pool); } }
static void TestPoolKeepTillDestroy() { const int ITERS = 50*1024; void *ptrs[2*ITERS+1]; rml::MemPoolPolicy pol(getMemPolicy, putMemPolicy); rml::MemoryPool *pool; // 1st create default pool that returns memory back to callback, // then use keepMemTillDestroy policy for (int keep=0; keep<2; keep++) { getMemCalls = putMemCalls = 0; if (keep) pol.keepAllMemory = 1; pool_create_v1(0, &pol, &pool); for (int i=0; i<2*ITERS; i+=2) { ptrs[i] = pool_malloc(pool, 7*1024); ptrs[i+1] = pool_malloc(pool, 10*1024); } ptrs[2*ITERS] = pool_malloc(pool, 8*1024*1024); ASSERT(!putMemCalls, NULL); for (int i=0; i<2*ITERS; i++) pool_free(pool, ptrs[i]); pool_free(pool, ptrs[2*ITERS]); size_t totalPutMemCalls = putMemCalls; if (keep) ASSERT(!putMemCalls, NULL); else { ASSERT(putMemCalls, NULL); putMemCalls = 0; } size_t currGetCalls = getMemCalls; pool_malloc(pool, 8*1024*1024); if (keep) ASSERT(currGetCalls == getMemCalls, "Must not lead to new getMem call"); size_t currPuts = putMemCalls; pool_reset(pool); ASSERT(currPuts == putMemCalls, "Pool is not releasing memory during reset."); pool_destroy(pool); ASSERT(putMemCalls, NULL); totalPutMemCalls += putMemCalls; ASSERT(getMemCalls == totalPutMemCalls, "Memory leak detected."); } }
void GxFreeLayout::Arrange(GxRecti rect) { int dx = rect.x + myMargin.l; int dy = rect.y + myMargin.t; for(int i=0; i<myItems.Size(); ++i) { GxWidget* w = myItems[i].widget; GxSizePolicyResult pol(w); GxVec2i pos = myItems[i].pos; GxRecti r(dx + pos.x, dy + pos.y, 0, 0); r.w = GxClamp(pol.hint.x, pol.min.x, pol.max.x); r.h = GxClamp(pol.hint.y, pol.min.y, pol.max.y); w->SetRect(r); } }
void DistViewGUI::fold(bool folded) { if (folded) { // fold GGDBGM(type << " folding" << endl); // let the controller know we do not need our image representation emit unsubscribeRepresentation(this, type); // fold GUI and set size policy for proper arrangement ui->gv->setHidden(true); ui->topBar->fold(); frame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); // reset title setTitle(type); // TODO: send signals that will destroy unused data! // TODO: let viewport clean itself up! //(*binsets)->clear(); // clear the vector, not re-create shareddata! //viewport->shuffleIdx.clear(); //viewport->vb.destroy(); emit foldingStateChanged(type, true); } else { // unfold GGDBGM(type << " unfolding" << endl); emit needBinning(type); // let the controller know we need our image representation emit subscribeRepresentation(this, type); // unfold GUI and set size policy for proper arrangement ui->gv->setVisible(true); ui->topBar->unfold(); QSizePolicy pol(QSizePolicy::Preferred, QSizePolicy::Expanding); pol.setVerticalStretch(1); frame->setSizePolicy(pol); emit foldingStateChanged(type, false); // TODO: trigger calculation of data? } }
std::string transponder::description() { char buf[128] = {0}; char *f, *s, *m, *f2; if (CFrontend::isSat(feparams.delsys)) { CFrontend::getDelSys(feparams.delsys, getFEParams()->fec_inner, getFEParams()->modulation, f, s, m); snprintf(buf, sizeof(buf), "%d %c %d %s %s %s ", getFEParams()->frequency/1000, pol(getFEParams()->polarization), getFEParams()->symbol_rate/1000, f, s, m); } else if (CFrontend::isCable(feparams.delsys)) { CFrontend::getDelSys(feparams.delsys, getFEParams()->fec_inner, getFEParams()->modulation, f, s, m); snprintf(buf, sizeof(buf), "%d %d %s %s %s ", getFEParams()->frequency/1000, getFEParams()->symbol_rate/1000, f, s, m); } else if (CFrontend::isTerr(feparams.delsys)) { CFrontend::getDelSys(feparams.delsys, getFEParams()->code_rate_HP, getFEParams()->modulation, f, s, m); CFrontend::getDelSys(feparams.delsys, getFEParams()->code_rate_LP, getFEParams()->modulation, f2, s, m); snprintf(buf, sizeof(buf), "%d %d %s %s %s ", getFEParams()->frequency, CFrontend::getFEBandwidth(getFEParams()->bandwidth)/1000, f, f2, m); } return std::string(buf); }
void FilterButton::paintEvent(QPaintEvent *e){ QPainter p(this); p.setRenderHint(p.Antialiasing); QColor fg; if (this->isChecked()){ QColor c1,c2; QLinearGradient lg1(0,0,0,this->height()); c1.setRgb(54,102,164); c2.setRgb(102,157,206); p.setPen(c1); lg1.setColorAt(0,c2); lg1.setColorAt(1,c1); p.setBrush(lg1); p.drawRect(0,0,this->width(),this->height()); fg.setRgb(255,255,255); } else fg.setRgb(60,60,60); /* QPen p1; p1.setColor(fg); p1.setWidth(4); p1.setCapStyle(Qt::RoundCap); p.setBrush(Qt::transparent); p.setPen(p1);*/ int xc,yc; xc=this->width()/2; yc=this->height()/2; QPolygon pol(6); pol.setPoint(0,xc-8,yc-6); pol.setPoint(1,xc+8,yc-6); pol.setPoint(2,xc+2,yc+2); pol.setPoint(3,xc+2,yc+7); pol.setPoint(4,xc-2,yc+7); pol.setPoint(5,xc-2,yc+2); p.setBrush(fg); p.setPen(Qt::transparent); p.drawPolygon(pol); e->accept(); }
void TestBackend() { rml::MemPoolPolicy pol(getMallocMem, putMallocMem); rml::MemoryPool *mPool; pool_create_v1(0, &pol, &mPool); rml::internal::ExtMemoryPool *ePool = &((rml::internal::MemoryPool*)mPool)->extMemPool; rml::internal::Backend *backend = &ePool->backend; for( int p=MaxThread; p>=MinThread; --p ) { TestBackendWork::initBarrier(p); NativeParallelFor( p, TestBackendWork(backend) ); } BlockI *block = backend->getSlabBlock(1); ASSERT(block, "Memory was not allocated"); backend->putSlabBlock(block); pool_destroy(mPool); }
void Simplex::lagrangePolynomials(Function::Polynomial<Real>* res, const std::size_t n, const std::size_t np, const std::size_t nsc) const { // Computes Sylvester's polynomials. std::vector<Function::Polynomial<Real>> pol(n+1); for (std::size_t i = 0; i < (n + 1); i++) { pol[i] = silvesterPol(i,n); } // Computes Lagrange's polynomials. for (std::size_t i = 0; i < np; i++) { for (std::size_t j = 0; j < nsc; j++) { if (j == 0) { res[i] = pol[nodeIndex(i,j)]; } else { res[i] ^= pol[nodeIndex(i,j)]; } } } }
void TestPoolReset() { rml::MemPoolPolicy pol(getMallocMem, putMallocMem); rml::MemoryPool *pool; pool_create_v1(0, &pol, &pool); for (int i=0; i<100; i++) { ASSERT(pool_malloc(pool, 8), NULL); ASSERT(pool_malloc(pool, 50*1024), NULL); } int regionsBeforeReset = liveRegions; pool_reset(pool); for (int i=0; i<100; i++) { ASSERT(pool_malloc(pool, 8), NULL); ASSERT(pool_malloc(pool, 50*1024), NULL); } ASSERT(regionsBeforeReset == liveRegions, "Expected no new regions allocation."); pool_destroy(pool); ASSERT(!liveRegions, "Expected all regions were released."); }
void BalloonGoo::paint(QPainter &p){ //not active status if (!active){ p.setBrush(color); p.setPen(color); p.drawEllipse(toPoint(body->GetPosition()),getRadius(),getRadius()); if (selected || dragging ){ p.setPen(QPen(Qt::yellow,3,(dragging==true ? Qt::SolidLine : Qt::DashLine))); p.setBrush(Qt::transparent); p.drawEllipse(toPoint(body->GetPosition()), getRadius()+10,getRadius()+10); } } //active status else{ p.setPen(color); p.setBrush(color); p.drawEllipse(QPoint(body->GetPosition().x*10,body->GetPosition().y*10-(getRadius()/2+ry)), getRadius() + rx, getRadius() + ry ); p.save(); p.translate(body->GetPosition().x*10,body->GetPosition().y*10-(getRadius()/2+ry)); QPolygon pol(3); pol<<QPoint(radius+rx-12,radius-qAbs(rx)-qAbs(ry*2/3))<<QPoint(0,radius+ry+10)<<QPoint(-radius-rx+11,radius-qAbs(rx)-qAbs(ry*2/3)); p.drawPolygon(pol); p.restore(); if(selected){ p.setPen(QPen(Qt::yellow,3,Qt::DotLine)); p.setBrush(Qt::transparent); int r=(rx>ry? getRadius()+rx : getRadius()+ry); p.drawEllipse(QPoint(body->GetPosition().x*10,body->GetPosition().y*10-(getRadius()/2+ry)),r+10,r+10); } } }
void JSDomainListView::updateDomainListLegacy(const QStringList &domainConfig) { domainSpecificLV->clear(); JSPolicies pol(config,group,false); pol.defaults(); for (QStringList::ConstIterator it = domainConfig.begin(); it != domainConfig.end(); ++it) { QString domain; KHTMLSettings::KJavaScriptAdvice javaAdvice; KHTMLSettings::KJavaScriptAdvice javaScriptAdvice; KHTMLSettings::splitDomainAdvice(*it, domain, javaAdvice, javaScriptAdvice); if (javaScriptAdvice != KHTMLSettings::KJavaScriptDunno) { QListViewItem *index = new QListViewItem( domainSpecificLV, domain, i18n(KHTMLSettings::adviceToStr(javaScriptAdvice)) ); pol.setDomain(domain); pol.setFeatureEnabled(javaScriptAdvice != KHTMLSettings::KJavaScriptReject); domainPolicies[index] = new JSPolicies(pol); } } }
void editDialog::set_data(int item_i) { QString s_start, s_stop; this->item = item_i; base_pol pol("pol.txt"); pol.load_data(); polaczenie at = pol.get_item(item_i); base_city city("city.txt"); city.load_data(); s_start = city.find_name(at.get_start()); s_stop = city.find_name(at.get_stop()); a_time->Edit->setText(QString::number(at.get_a_time())); b_time->Edit->setText(QString::number(at.get_b_time())); cost->Edit->setText(QString::number(at.get_cost())); op->Edit->setText(at.get_op()); from->Edit->setText(s_start); to->Edit->setText(s_stop); }
void editDialog::add() { // Zmienne poczatkowe QString s_start, s_stop; int from_n, to_n, typ; //Wczytanie danych if(samochod->isChecked()) typ=0; if(pociag->isChecked()) typ=1; if(samolot->isChecked()) typ=2; if(autobus->isChecked()) typ=4; s_start = from->Edit->text(); s_stop = to->Edit->text(); from_n =0; to_n=0; //odczyt bazy miast i znalezienie/dodanie rekordu base_city city("city.txt"); city.load_data(); from_n = city.insert(s_start); to_n = city.insert(s_stop); city.save_data(); //Tworzenie obiektu polaczenie // polaczenie *p; // p = new p_bus(from, to, cost, a_time, b_time, op, typ); polaczenie p(from_n, to_n, cost->get_value(), a_time->get_value(), b_time->get_value(), op->get_value(), typ); //polaczenie(from, to, cost, a_time, b_time, op, typ); //Zapisanie obiektu base_pol pol("pol.txt"); pol.load_data(); pol.del(item); pol.insert(p); pol.save_data(); emit end(); this->close(); }
void GxFreeLayout::Adjust() { GxVec2i dim(0, 0); for(int i=0; i<myItems.Size(); ++i) { GxWidget* w = myItems[i].widget; w->Adjust(); if(w->IsUnarranged()) continue; GxSizePolicyResult pol(w); GxVec2i pos = myItems[i].pos; dim.x = GxMax(dim.x, pos.x + pol.hint.x); dim.y = GxMax(dim.y, pos.y + pol.hint.y); } dim.x += myMargin.l + myMargin.r; dim.y += myMargin.t + myMargin.b; myPreferredSize = dim; myMinimumSize = dim; }
void ImplicitMesher::ImpSurfToMeshMarCub(KW_Mesh& Mesh) { // //transfer data from inside of class to global // RadialBasisFunc::CopyRadialBasisFunction(this->Weights,this->PolyNom,this->InterpoPoints); // // MarCubRBF McRbf; // Polygonizer pol(&McRbf,.05, 30);//.05, 30 // pol.march(false, 0.,0.,0.);//dotet //// pol.march(true, this->InterpoPoints.front().x(),this->InterpoPoints.front().y(), //// this->InterpoPoints.front().z());//dotet //transfer data from inside of class to global HermiteRBF::CopyHRBF(this->WeightsAlpha,this->WeightsBeta,this->PolyNomA,this->PolyNomB,this->InterpoPoints); MarCubHRBF McHRbf; Polygonizer pol(&McHRbf,.05, 30);//.05, 30 pol.march(false, 0.,0.,0.);//dotet // pol.march(true, this->InterpoPoints.front().x(),this->InterpoPoints.front().y(), // this->InterpoPoints.front().z());//dotet Convert_MarCubPoly_To_CGALPoly<HalfedgeDS> triangle(&pol); Mesh.delegate(triangle); }
/*! Find the bounding rect for the label. The coordinates of the rect are relative to spacing + ticklength from the backbone in direction of the tick. \param font Font used for painting \param value Value */ QRect QwtScaleDraw::labelRect(const QFont &font, double value) const { QwtText lbl = tickLabel(font, value); if ( lbl.isEmpty() ) return QRect(0, 0, 0, 0); const QPoint pos = labelPosition(value); QSize labelSize = lbl.textSize(font); if ( labelSize.height() % 2 ) { labelSize.setHeight(labelSize.height() + 1); } const QwtMatrix m = labelMatrix(pos, labelSize); #if 0 QRect br = QwtMetricsMap::translate(m, QRect(QPoint(0, 0), labelSize)); #else QwtPolygon pol(4); pol.setPoint(0, 0, 0); pol.setPoint(1, 0, labelSize.height() - 1 ); pol.setPoint(2, labelSize.width() - 1, 0); pol.setPoint(3, labelSize.width() - 1, labelSize.height() - 1 ); pol = QwtMetricsMap::translate(m, pol); QRect br = pol.boundingRect(); #endif #if QT_VERSION < 0x040000 br.moveBy(-pos.x(), -pos.y()); #else br.translate(-pos.x(), -pos.y()); #endif return br; }