• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ smooth函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中smooth函数的典型用法代码示例。如果您正苦于以下问题:C++ smooth函数的具体用法?C++ smooth怎么用?C++ smooth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: ny

 void GenProcessor::procSmooth(quint8 *dst, const quint8 **src, quint8 index, quint8 octave) {
     quint8 t = 1 << octave;
     const quint8 y[3] = {ny(index - t), ny(index), ny(index + t)};
     quint32 count = m_size >> octave;
     quint32 x[3] = {m_size - t, 0, t};
     dst[0] = smooth(src, x, y);
     x[0] = x[1]; x[1] = x[2]; x[2] += t;
     for (quint32 i = 0; i < count; i++) {
         m_mutex.lock();
         dst[x[1]] = smooth(src, x, y);
         for (quint8 k = 0; k < t; k++) {
             if (octave != 0 && k != 0) {
                 dst[x[0] + k] = interpolate(dst[x[0]], dst[x[1]], m_steps[k << (5 - octave)]);
             }
             if (m_releasing != -1) {
                 m_semaphores[m_releasing].release();
             }
             m_iter++;
         }
         x[0] = x[1]; x[1] = x[2];
         if (i != count - 3) {
             x[2] += t;
         } else {
             x[2] = 0;
         }
         m_mutex.unlock();
     }
 }
开发者ID:DKeaton,项目名称:NoiseHeart,代码行数:28,代码来源:GenProcessor.cpp


示例2: dsmooth

RankTwoTensor
TensorMechanicsPlasticTensile::dyieldFunction_dstress(const RankTwoTensor & stress,
                                                      Real /*intnl*/) const
{
  Real mean_stress = stress.trace() / 3.0;
  RankTwoTensor dmean_stress = stress.dtrace() / 3.0;
  Real sin3Lode = stress.sin3Lode(_lode_cutoff, 0);
  if (sin3Lode <= _sin3tt)
  {
    // the non-edge-smoothed version
    std::vector<Real> eigvals;
    std::vector<RankTwoTensor> deigvals;
    stress.dsymmetricEigenvalues(eigvals, deigvals);
    Real denom = std::sqrt(smooth(stress) + Utility::pow<2>(eigvals[2] - mean_stress));
    return dmean_stress + (0.5 * dsmooth(stress) * dmean_stress +
                           (eigvals[2] - mean_stress) * (deigvals[2] - dmean_stress)) /
                              denom;
  }
  else
  {
    // the edge-smoothed version
    Real kk = _aaa + _bbb * sin3Lode + _ccc * Utility::pow<2>(sin3Lode);
    RankTwoTensor dkk = (_bbb + 2.0 * _ccc * sin3Lode) * stress.dsin3Lode(_lode_cutoff);
    Real sibar2 = stress.secondInvariant();
    RankTwoTensor dsibar2 = stress.dsecondInvariant();
    Real denom = std::sqrt(smooth(stress) + sibar2 * Utility::pow<2>(kk));
    return dmean_stress + (0.5 * dsmooth(stress) * dmean_stress +
                           0.5 * dsibar2 * Utility::pow<2>(kk) + sibar2 * kk * dkk) /
                              denom;
  }
}
开发者ID:aashiquear,项目名称:moose,代码行数:31,代码来源:TensorMechanicsPlasticTensile.C


示例3: smooth

void ShaderEffectSource::bind()
{
    GLint filtering = smooth() ? GL_LINEAR : GL_NEAREST;
    GLuint hwrap = (m_wrapMode == Repeat || m_wrapMode == RepeatHorizontally) ? GL_REPEAT : GL_CLAMP_TO_EDGE;
    GLuint vwrap = (m_wrapMode == Repeat || m_wrapMode == RepeatVertically) ? GL_REPEAT : GL_CLAMP_TO_EDGE;

    QOpenGLContext *context = QOpenGLContext::currentContext();
    QOpenGLFunctions *f = context->functions();
    if (!context->isOpenGLES())
        f->glEnable(GL_TEXTURE_2D);

    if (m_fbo && m_fbo->isValid()) {
        f->glBindTexture(GL_TEXTURE_2D, m_fbo->texture());
    } else {
        m_dirtyTexture = true;
        emit repaintRequired();
        markSourceItemDirty();
        f->glBindTexture(GL_TEXTURE_2D, 0);
    }

    f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
    f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, smooth() ? GL_LINEAR : GL_NEAREST);
    f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, hwrap);
    f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, vwrap);
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:25,代码来源:shadereffectsource.cpp


示例4: noise2d_get

static float noise2d_get(Noise2DContext* const ctx, const float x, const float y)
{
  Vec2 p = { x, y };
  
  // Cheap trick since inputs will always be [0, MAX_INT]
  const int x0 = (int)x;
  const int y0 = (int)y;
  const int x1 = x0 + 1;
  const int y1 = y0 + 1;
  const float x0f = (float)x0;
  const float y0f = (float)y0;

  const Vec2 grad0 = get_gradient(ctx, x0, y0);
  const Vec2 grad1 = get_gradient(ctx, x1, y0);
  const Vec2 grad2 = get_gradient(ctx, x0, y1);
  const Vec2 grad3 = get_gradient(ctx, x1, y1);

  const Vec2 origin0 = { x0f, y0f };
  const Vec2 origin1 = { x0f + 1.0f, y0f };
  const Vec2 origin2 = { x0f, y0f + 1.0f };
  const Vec2 origin3 = { x0f + 1.0f, y0f + 1.0f };
  
  float v0 = gradient(origin0, grad0, p);
  float v1 = gradient(origin1, grad1, p);
  float v2 = gradient(origin2, grad2, p);
  float v3 = gradient(origin3, grad3, p);

  float fx = smooth(x - origin0.x);
  float vx0 = lerp(v0, v1, fx);
  float vx1 = lerp(v2, v3, fx);
  float fy = smooth(y - origin0.y);
  return lerp (vx0, vx1, fy);
}
开发者ID:vonmoltke,项目名称:pnoise,代码行数:33,代码来源:test.c


示例5: __attribute__

// This ISR will execute whenever Timer1 has a compare match.
// it kicks off the periodic execution of user code and performs I/O
// Min period: 10msec due to X,Y switch time for touchscreen
void __attribute__((interrupt, auto_psv)) _T1Interrupt(void) {
  IFS0bits.T1IF = 0; // clear interrupt flag

  if(start == 1)
    deadline_miss++;

  if (select == X_DIM) {
    // DONE: read 5 samples from X-dimension and set Xpos as the median
    int i = 0;
    for (i = 0; i<N; i ++){
        xVal[i] = smooth(touch_adc(1), TOUCH_MAX_X, TOUCH_MIN_X,xPrevVal);
//        xVal[i] = touch_adc(1);//cap(touch_adc(1), TOUCH_MAX_X, TOUCH_MIN_X);
    }
    Xpos = median(xVal,N);
    xPrevVal = Xpos;
    touch_select_dim(Y_DIM);
    select = Y_DIM;
  }
  else {
    // DONE: read 5 samples from Y-dimension and set Ypos as the median
    int i = 0;
    for (i = 0; i<N; i ++){
        yVal[i] = smooth(touch_adc(2), TOUCH_MAX_Y, TOUCH_MIN_Y,yPrevVal);
//         yVal[i] = touch_adc(2);//cap(touch_adc(2), TOUCH_MAX_Y, TOUCH_MIN_Y);
    }

    Ypos = median(yVal,N);
    yPrevVal = Ypos;
    touch_select_dim(X_DIM);
    select = X_DIM;
  }
  start = 1;
}
开发者ID:ericmeyers12,项目名称:Embedded_Systems_dsPIC_MCU_Work,代码行数:36,代码来源:main.c


示例6: loop

void loop()
{
  
  while (digitalRead(DRDY) == LOW);

  temp_in = read_register16(TEMP);
  //temp_in = temp_in * 0.05;
  //temp_in = ((1.8) *temp_in) + 32;

  pressure_msb = read_register(PRESSURE);
  pressure_msb &= B00000111;
  pressure_lsb = read_register16(PRESSURE_LSB);
  pressure = UBLB19(pressure_msb, pressure_lsb);
  //pressure /= 4;
  //pressure = pressure*4;
  if (i==0) {
    smoothedVal = pressure;
    i = 1;
  }
  
  smoothedVal =  smooth(pressure, filterVal, smoothedVal);   // second parameter determines smoothness  - 0 is off,  .9999 is max smooth 
  //Serial.println(16250-smoothedVal);
  //Serial.print(14280-smoothedVal); Serial.print("     ");
  Serial.print(smoothedVal); Serial.print("     ");
  
  tempPressure = pressure * 0.25;
  //altitude = map(tempPressure, 101352.784, 98319.0955, 0, 820);
  tempAltitude = map(tempPressure, 101840, 98806, 0, 820);
  altitude = smooth(tempAltitude, filterVal, smoothedAlt);
  Serial.print(tempPressure); Serial.print("     "); Serial.println(altitude);
}
开发者ID:smooker,项目名称:ebrequad,代码行数:31,代码来源:SCP1000_SMOOTH.c


示例7: QPoint

void
CurveGroup::smooth(int key, int v0, int v1, int rad)
{
  QPoint cen = QPoint(v0, v1);

  if (m_cg.contains(key))
    {
      int ic = getActiveCurve(key, v0, v1);
      if (ic >= 0)
	{
	  QList<Curve*> curves = m_cg.values(key);
	  // replace pts with the smooth version
	  curves[ic]->pts = smooth(curves[ic]->pts,
				   cen,
				   rad,
				   curves[ic]->closed);

	  m_pointsDirtyBit = true;
	}
    }
  int mc = getActiveMorphedCurve(key, v0, v1);
  if (mc >= 0)
    {
      Curve c = m_mcg[mc].value(key);
      QVector<QPoint> w;
      w = smooth(c.pts,
		 cen,
		 rad,
		 c.closed);
      c.pts = w; // replace pts with the smooth version
      m_mcg[mc].insert(key, c);
    }
}
开发者ID:imclab,项目名称:drishti,代码行数:33,代码来源:curvegroup.cpp


示例8: smooth

void smooth(node *p)
{ /* go through tree getting new branch lengths and views */
  if (p->tip)
    return;
  update(p);
  smooth(p->next->back);
  smooth(p->next->next->back);
}  /* smooth */
开发者ID:Chrisss50,项目名称:ViralToolBox,代码行数:8,代码来源:contml.c


示例9: smooth

void CGenerator::smoothing(int from , int to)
{
	for(int i = from ; i < to ; i++)
	{
		smooth(i,1);
		smooth(i,1);
		smooth(i,1);
	}
}
开发者ID:Dreakii,项目名称:OpenWorld,代码行数:9,代码来源:CGenerator.cpp


示例10: insert_

void insert_(node *p, node *q)
{ /* put p and q together and iterate info. on resulting tree */
  long i;

  hookup(p->next->next, q->back);
  hookup(p->next, q);
  for (i = 1; i <= smoothings; i++) {
    smooth(p);
    smooth(p->back);
  }
}  /* insert_ */
开发者ID:Chrisss50,项目名称:ViralToolBox,代码行数:11,代码来源:contml.c


示例11: CkAbort

void CkQuadView::render(double alpha,CkView *v_old) {
#ifndef CMK_LIVEVIZ3D_CLIENT
	CkAbort("CkQuadView::render should never be called on server!\n");
#else
	glEnable(GL_TEXTURE_2D);
	CkQuadView *old=(CkQuadView *)v_old; // FIXME: what if he's not a quadview?
	
	if (old==NULL || old->nCorners!=nCorners || alpha>0.99) 
	{ /* just draw us */
		glColor4f(1.0,1.0,1.0,1.0);
		render();
	} 
	else 
	{ /* have old, and need to blend with him. */
#if 0 /* use multitexture: needs to have same corners (which sucks) */
		c_tex->bind(); // we're in texture unit 0
		glActiveTextureARB(GL_TEXTURE1_ARB);
		old->c_tex->bind(); // he's in texture unit 1
		glEnable(GL_TEXTURE_2D);
		oglTextureCombineLinear(1.0-alpha);
		glBegin (nCorners==4?GL_QUADS:GL_TRIANGLE_STRIP);
		for (int i=0;i<nCorners;i++) {
			glMultiTexCoord2dvARB(GL_TEXTURE0_ARB,texCoord[i]); 
			glMultiTexCoord2dvARB(GL_TEXTURE1_ARB,old->texCoord[i]);
			glVertex3dv(alpha*corners[i]+(1-alpha)*old->corners[i]); 
		}
		glEnd();
		glDisable(GL_TEXTURE_2D);
		glActiveTextureARB(GL_TEXTURE0_ARB);
#else /* draw two copies: first him, then me. */
		double separation=1.3;
		float of=smooth(separation*(1-alpha));
		glColor4f(of,of,of,of);
		old->render();
		
		float nf=smooth(separation*alpha);
		glColor4f(nf,nf,nf,nf);
		render();
		
		glColor4f(1.0,1.0,1.0,1.0);
#endif
	}
	
	
	if (oglToggles['f']) 
	{ // Draw a little frame around this texture
		glDisable(GL_TEXTURE_2D);
		for (int i=0;i<nCorners;i++)
			oglLine(corners[i],corners[(i+1)%nCorners]);
		glEnable(GL_TEXTURE_2D);
	}
#endif
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:53,代码来源:ckviewable.cpp


示例12: processdata

int DATAPROCESS::ExtracSample(double *Lrawd, double *Rrawd, double *Lfiltd, double *Rfiltd, Throld throld, 
	int len, BpNetdata *pb, Processdata *prod , int winlen)
{
	//first process data.
	double *datasetL = new double[len];
	double *datasetR = new double[len];
	double *newdataL = new double[len];
	double *newdataR = new double[len];
	//BpNetdata data;
	Processdata psd;
	int Sampleblock = 0;
	for (int i = 0; i < len; i++)
	{
		if (i + winlen + 1 >= len)
		{
			psd = processdata(Lrawd + i, Rrawd + i, Lfiltd + i, Rfiltd + i, len - i - 1, throld);
		}
		else
			psd = processdata(Lrawd + i, Rrawd + i, Lfiltd + i, Rfiltd + i, winlen + 1, throld);
		datasetL[i] = psd.lmaxmin;
		datasetR[i] = psd.rmaxmin;
		newdataL[i] = psd.stdlval;
		newdataR[i] = psd.stdrval;
	}

	int smoothlen = 0;
	smooth(smoothlen, &newdataL, len);
	smooth(smoothlen, &newdataR, len);
	int distance = 0;
	for (int i = 0; i<len; i++)
	{
		if (newdataL[i]>0 || newdataR[i] > 0)
			distance++;
		else if (distance > 0)
		{
			pb[Sampleblock] = extractnetdata(datasetL + i - distance + 1, datasetR + i - distance + 1, distance, throld);
			pb[Sampleblock].sp = i - distance;
			pb[Sampleblock].ep = i;
			prod[Sampleblock].lmaxmin = prod[Sampleblock].rmaxmin = 0;
			prod[Sampleblock].stdlval = mean(newdataL + i - distance + 1, distance);
			prod[Sampleblock].stdrval = mean(datasetR + i - distance + 1, distance);
			Sampleblock++;
			distance = 0;
		}
	}
	delete newdataR;
	delete newdataL;
	delete datasetL;
	delete datasetR;
	return Sampleblock;
}
开发者ID:SproutOrc,项目名称:BiteProc,代码行数:51,代码来源:DataProcess.cpp


示例13: connect

QMenu* Scene_polylines_item::contextMenu() 
{
    const char* prop_name = "Menu modified by Scene_polylines_item.";

    QMenu* menu = Scene_item::contextMenu();

    // Use dynamic properties:
    // http://doc.qt.io/qt-5/qobject.html#property
    bool menuChanged = menu->property(prop_name).toBool();

    if(!menuChanged) {
        menu->addSeparator();
        // TODO: add actions to display corners
        QAction* action = menu->addAction(tr("Display corners with radius..."));
        connect(action, SIGNAL(triggered()),
                this, SLOT(change_corner_radii()));

        QAction* actionSmoothPolylines =
                menu->addAction(tr("Smooth polylines"));
        actionSmoothPolylines->setObjectName("actionSmoothPolylines");
        connect(actionSmoothPolylines, SIGNAL(triggered()),this, SLOT(smooth()));
        menu->setProperty(prop_name, true);
    }
    return menu;
}
开发者ID:NobodyZhou,项目名称:cgal,代码行数:25,代码来源:Scene_polylines_item.cpp


示例14: main

int main(int argc, char **argv){
  if(argc!=2){
    std::cerr << "Usage: " << argv[0] << " mesh_file" << std::endl;
  }

  Mesh *mesh = new Mesh(argv[1]);

  Quality q = mesh->get_mesh_quality();

  std::cout << "Initial quality:\n"
            << "Quality mean:  " << q.mean << std::endl
            << "Quality min:   " << q.min << std::endl;

  double time = get_wtime();
  smooth(mesh, 200);
  double time_smooth = get_wtime() - time;

  q = mesh->get_mesh_quality();

  std::cout<<"After smoothing:\n"
           << "Quality mean:  " << q.mean << std::endl
           << "Quality min:   " << q.min << std::endl;

  if((q.mean>0.90)&&(q.min>0.55))
    std::cout << "Test passed"<< std::endl;
  else
    std::cout << "Test failed"<< std::endl;

  std::cout<<"BENCHMARK: " << time_smooth << "s" << std::endl;

  delete mesh;

  return EXIT_SUCCESS;
}
开发者ID:Albex,项目名称:Advanced_Architecture,代码行数:34,代码来源:ACA2-2013.cpp


示例15: connect

void My3DViewer::setAztec(MyGLWidget* m){
	aztec=m;
	connect(splitQuad, SIGNAL(clicked()), aztec, SLOT(splitQuad()));
	connect(deleteVertex, SIGNAL(clicked()), aztec, SLOT(deleteVertex()));
	connect(insertEdge, SIGNAL(clicked()), aztec, SLOT(insertEdge()));
	connect(incrementSharpness, SIGNAL(clicked()), aztec, SLOT(incSharpness()));
	connect(decrementSharpness, SIGNAL(clicked()), aztec, SLOT(decSharpness()));
	connect(forcePlanarity, SIGNAL(clicked()), aztec, SLOT(toggleForcePlanarity()));
	connect(insertVertex, SIGNAL(clicked()), aztec, SLOT(insertVertex()));
	connect(smooth, SIGNAL(clicked()), aztec, SLOT(smooth()));
	connect(extrude, SIGNAL(clicked()), aztec, SLOT(extrude2()));

	connect(faceButton, SIGNAL(clicked()), aztec, SLOT(enterFaceMode()));
	connect(objectButton, SIGNAL(clicked()), aztec, SLOT(enterObjectMode()));
	connect(vertexButton, SIGNAL(clicked()), aztec, SLOT(enterVertexMode()));
	connect(edgeButton, SIGNAL(clicked()), aztec, SLOT(enterEdgeMode()));
	connect(cpButton, SIGNAL(clicked()), aztec, SLOT(enterCPMode()));

	connect(snapToFace, SIGNAL(clicked()), aztec, SLOT(snapToFace()));
	connect(snapToEdge, SIGNAL(clicked()), aztec, SLOT(snapToEdge()));
	connect(snapToVertex, SIGNAL(clicked()), aztec, SLOT(snapToVertex()));

	//Connect mouse move events
	connect(aztec, SIGNAL(sendMouseEvent(QMouseEvent*)), this, SLOT(moveEvent(QMouseEvent*)));

		//errors
	connect(aztec, SIGNAL(error(char*)), this, SLOT(throwError(char*)));
	
}
开发者ID:Jigarsenjallia,项目名称:Aztec,代码行数:29,代码来源:my3dviewer.cpp


示例16: while

void ReduceSurfaceTriangulation::pass1()
{
  cout << "\nFirst pass of surface reduction:\n(This is the expensive part...)" << endl;
  int iter = 0;
  bool done = false;
  m_UseNormalCorrectionForSmoothing = true;
  int num_initial_nodes = m_Grid->GetNumberOfPoints();
  int num_del_max = 0;
  while (!done) {
    ++iter;
    cout << "\npass-1 iteration-" << iter << ":" << endl;
    computeMeshDensity();
    int num_deleted = deleteNodes();
    num_del_max = max(num_del_max, num_deleted);
    cout << "deleted nodes  : " << num_deleted << endl;
    for (int i = 0; i < m_NumSmoothSteps; ++i) {
      cout << "  smoothing    : " << i+1 << "/" << m_NumSmoothSteps << endl;
      smooth(1);
      swap();
    }
    done = num_deleted <= max(num_initial_nodes/100, num_del_max/100);
    cout << "total nodes : " << m_Grid->GetNumberOfPoints() << endl;
    cout << "total cells : " << m_Grid->GetNumberOfCells() << endl;
    //done = true;
  }
}
开发者ID:Nasrollah,项目名称:engrid,代码行数:26,代码来源:reducesurfacetriangulation.cpp


示例17: fileRead

void fileRead(FILE *fdr, FILE *ofdr)
{
	char pattern[64][64];
	char data[512];
	int features[64];
	int count=0, num;
	int x, y, i;

	fseek(fdr, 0, SEEK_END);
	num = ftell(fdr) / 512;
	fseek(fdr, 0, SEEK_SET);

	while (count<num) {
		if (fread(data, 512, 1, fdr) != 1) {
			printf("can't open a file\n");
			exit(2);
		}
		printf("%d文字目\n", count);
		expand(data,pattern);
		noise(pattern, 15);
		smooth(pattern);
		normalize(pattern);
		outline(pattern);
		printpattern(pattern);
		extract(pattern, features);

		output(features, ofdr);
		
		count++;
		// while(getchar()!='\n');
	}
}
开发者ID:yk-m,项目名称:Knowledge-Engineering-I,代码行数:32,代码来源:4_3mac.c


示例18: getBackgroundTemplate

/**
 *\fn           int getBackgroundTemplate(uint8 *input, uint8 *output, int r, int threshold, int cx, int cy)
 *\brief        生成背景模板
 *\param[in]    uint8 * input 输入原图像数据
 *\param[in]    uint8 * output 背景模板:255为背景,0为前景
 *\param[in]    int r 对幅值图像高度平滑滤波的滤波器半径
 *\param[in]    int threshold 分割的阈值
 *\param[in]    int cx 图像宽
 *\param[in]    int cy 图像高
 *\return       int 0成功,其它失败
 */
int getBackgroundTemplate(uint8 *input, uint8 *output, int r, int threshold, int cx, int cy)
{
    int x = 0;
    int y = 0;
    int num = 0;
    int lineBegin= 0;
    uint8 *src = NULL;

    // 对方向场幅值图像进行高度平滑滤波
    smooth(input, output, cx, cy, r, 2);

    // 图像边缘均设置为背景

    num = cx - 1;

    for (y = 0; y < cy; y++)
    {
        src = output + y*cx;

        *(src) = 255;
        *(src + num) = 255;
    }

    num = (cy-1)*cx;

    for (x = 0; x < cx; x++)
    {
        src = output + x;

        *(src) = 255;
        *(src + num) = 255;
    }

    num = 0;
    lineBegin = cx;

    for (y = 1; y < cy-1; y++)
    {
        for (x = 1; x < cx-1; x++)
        {
            src = output + lineBegin + x;

            // 根据幅值与阈值大小判断是否为背景区域
            if (*src < threshold)
            {
                *src = 0;
            }
            else
            {
                *src = 255;
                num++;
            }
        }

        lineBegin += cx;
    }

    // 如果前景区域面积小于总面积的十分之一,则表示前景区域太小,返回错误
    return ((num < (cx * cy / 10)) ? 1 : 0);
}
开发者ID:tempbottle,项目名称:TestSet,代码行数:71,代码来源:FingerImageProcess.cpp


示例19: connect

QMenu* Scene_polylines_item::contextMenu() 
{
    const char* prop_name = "Menu modified by Scene_polylines_item.";

    QMenu* menu = Scene_item::contextMenu();

    // Use dynamic properties:
    // http://doc.qt.io/qt-5/qobject.html#property
    bool menuChanged = menu->property(prop_name).toBool();

    if(!menuChanged) {
        menu->addSeparator();
        // TODO: add actions to display corners
        QAction* action = menu->addAction(tr("Display corners with radius..."));
        connect(action, SIGNAL(triggered()),
                this, SLOT(change_corner_radii()));

        QAction* actionSmoothPolylines =
                menu->addAction(tr("Smooth polylines"));
        actionSmoothPolylines->setObjectName("actionSmoothPolylines");
        connect(actionSmoothPolylines, SIGNAL(triggered()),this, SLOT(smooth()));

        QMenu *container = new QMenu(tr("Line Width"));
        QWidgetAction *sliderAction = new QWidgetAction(0);
        connect(d->line_Slider, &QSlider::valueChanged, this, &Scene_polylines_item::itemChanged);

        sliderAction->setDefaultWidget(d->line_Slider);

        container->addAction(sliderAction);
        menu->addMenu(container);

        menu->setProperty(prop_name, true);
    }
    return menu;
}
开发者ID:FEniCS,项目名称:mshr,代码行数:35,代码来源:Scene_polylines_item.cpp


示例20: setup

void setup()
{
	size(200, 200); 
	smooth();
	noStroke();
	max_distance = dist(0, 0, width, height);
}
开发者ID:jamessqr,项目名称:Cing,代码行数:7,代码来源:Distance+2D.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ smp_call_function_single函数代码示例发布时间:2022-05-30
下一篇:
C++ smithyEffect函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap