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

C++ centre函数代码示例

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

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



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

示例1: centre

void // Checks the sign of the vectors
PCA::signCheck()
{	
	float signNorm = 0, signVecBase = 0;
	PCLPoint pcl_point;
	Eigen::Vector3d vec_point;
	for (size_t i = 0; i < sub_cloud_ind[0].size(); i ++)
	{
		pcl_point = (*cloud).points[sub_cloud_ind[0][i]];
		if(pcl_point.z == pcl_point.z)
		{
			pcl_point.x -= centre(0);
			pcl_point.y -= centre(1);
			pcl_point.z -= centre(2);
			vec_point << pcl_point.x, pcl_point.y, pcl_point.z;
			signNorm += normal.dot(vec_point);
			signVecBase += vec_base1.dot(vec_point);
		}
	}
	if (signNorm!=0)
		normal = normal * signNorm / fabs(signNorm);
		
	if (signVecBase!=0)
		vec_base1 = vec_base1 * signVecBase / fabs(signVecBase);
}
开发者ID:caomw,项目名称:3D-Feat-Desc,代码行数:25,代码来源:PCA.cpp


示例2: display

      void display()
{     //     int f=0,m=0,tot=0;
	cleardevice();
		   // setcolor(9);
	centre(21,"WALCHAND COLLEGE OF ENGINEERING ");
	       centre(22,"SANGLI");
	       centre(23,"STAFF RECORD MANAGEMENT\n");
	printf("SNO NO: \t NAME: \t\t AGE :\t LAST EDUCATION : \t  BASIC SALARY:");
	  rewind(fa);
	while(1)
	{
		fread(&rec,sizeof(rec),1,fa);
	       //	 fclose(fa);
		if(feof(fa))
			break;
	       setbkcolor(14);






		printf("\n%4d \t\t %-15s  %4d  \t%-15s \t   %4ld  ",rec.sno,rec.nm,rec.age,rec.last_edu,rec.bs);
	}
	     //	printf("\nfemale:%4d male:%4d",f,m);

//		printf("\n total student:%4d",tot);

	getch();
	return;
}
开发者ID:MAYURESH29,项目名称:data-structure,代码行数:31,代码来源:STAFF2.C


示例3: createChildAlgorithm

/**
 * Fit peak without background i.e, with background removed
 *  inspired from FitPowderDiffPeaks.cpp
 *  copied from PoldiPeakDetection2.cpp
 *
 @param workspaceindex :: indice of the row to use
 @param center :: gaussian parameter - center
 @param sigma :: gaussian parameter - width
 @param height :: gaussian parameter - height
 @param startX :: fit range - start X value
 @param endX :: fit range - end X value
 @returns A boolean status flag, true for fit success, false else
 */
bool ConvertEmptyToTof::doFitGaussianPeak(int workspaceindex, double &center,
                                          double &sigma, double &height,
                                          double startX, double endX) {

  g_log.debug("Calling doFitGaussianPeak...");

  // 1. Estimate
  sigma = sigma * 0.5;

  // 2. Use factory to generate Gaussian
  auto temppeak = API::FunctionFactory::Instance().createFunction("Gaussian");
  auto gaussianpeak = boost::dynamic_pointer_cast<API::IPeakFunction>(temppeak);
  gaussianpeak->setHeight(height);
  gaussianpeak->setCentre(center);
  gaussianpeak->setFwhm(sigma);

  // 3. Constraint
  double centerleftend = center - sigma * 0.5;
  double centerrightend = center + sigma * 0.5;
  std::ostringstream os;
  os << centerleftend << " < PeakCentre < " << centerrightend;
  auto *centerbound = API::ConstraintFactory::Instance().createInitialized(
      gaussianpeak.get(), os.str(), false);
  gaussianpeak->addConstraint(centerbound);

  g_log.debug("Calling createChildAlgorithm : Fit...");
  // 4. Fit
  API::IAlgorithm_sptr fitalg = createChildAlgorithm("Fit", -1, -1, true);
  fitalg->initialize();

  fitalg->setProperty(
      "Function", boost::dynamic_pointer_cast<API::IFunction>(gaussianpeak));
  fitalg->setProperty("InputWorkspace", m_inputWS);
  fitalg->setProperty("WorkspaceIndex", workspaceindex);
  fitalg->setProperty("Minimizer", "Levenberg-MarquardtMD");
  fitalg->setProperty("CostFunction", "Least squares");
  fitalg->setProperty("MaxIterations", 1000);
  fitalg->setProperty("Output", "FitGaussianPeak");
  fitalg->setProperty("StartX", startX);
  fitalg->setProperty("EndX", endX);

  // 5.  Result
  bool successfulfit = fitalg->execute();
  if (!fitalg->isExecuted() || !successfulfit) {
    // Early return due to bad fit
    g_log.warning() << "Fitting Gaussian peak for peak around "
                    << gaussianpeak->centre() << '\n';
    return false;
  }

  // 6. Get result
  center = gaussianpeak->centre();
  height = gaussianpeak->height();
  double fwhm = gaussianpeak->fwhm();

  return fwhm > 0.0;
}
开发者ID:liyulun,项目名称:mantid,代码行数:70,代码来源:ConvertEmptyToTof.cpp


示例4: Test3dBathIntracellularStimulation

    void Test3dBathIntracellularStimulation()
    {
        HeartConfig::Instance()->SetSimulationDuration(1);  //ms
        HeartConfig::Instance()->SetOutputDirectory("BidomainBath3d");
        HeartConfig::Instance()->SetOutputFilenamePrefix("bidomain_bath_3d");

        c_vector<double,3> centre;
        centre(0) = 0.05;
        centre(1) = 0.05;
        centre(2) = 0.05;
        BathCellFactory<3> cell_factory(-2.5e7, centre); // stimulates x=0.05 node

        BidomainProblem<3> bidomain_problem( &cell_factory, true );

        TetrahedralMesh<3,3> mesh;
        mesh.ConstructRegularSlabMesh(0.01, 0.1, 0.1, 0.1);

        // Set everything outside a central sphere (radius 0.4) to be bath
        for (unsigned i=0; i<mesh.GetNumElements(); i++)
        {
            double x = mesh.GetElement(i)->CalculateCentroid()[0];
            double y = mesh.GetElement(i)->CalculateCentroid()[1];
            double z = mesh.GetElement(i)->CalculateCentroid()[2];
            if (sqrt((x-0.05)*(x-0.05) + (y-0.05)*(y-0.05) + (z-0.05)*(z-0.05)) > 0.04)
            {
                mesh.GetElement(i)->SetAttribute(HeartRegionCode::GetValidBathId());
            }
        }

        bidomain_problem.SetMesh(&mesh);
        bidomain_problem.Initialise();

        bidomain_problem.Solve();

        Vec sol = bidomain_problem.GetSolution();
        ReplicatableVector sol_repl(sol);

        // test V = 0 for all bath nodes
        for (unsigned i=0; i<mesh.GetNumNodes(); i++)
        {
            if (HeartRegionCode::IsRegionBath( mesh.GetNode(i)->GetRegion() )) // bath
            {
                TS_ASSERT_DELTA(sol_repl[2*i], 0.0, 1e-12);
            }
        }

        // a hardcoded value
        TS_ASSERT_DELTA(sol_repl[2*404], 39.6833, 1e-3);
    }
开发者ID:Chaste,项目名称:Chaste,代码行数:49,代码来源:TestBidomainWithBathLong.hpp


示例5: centre

void PlayState::updatePaused(float delta)
{
	sf::Vector2f centre(p_rtexture_->getView().getCenter());
	centre -= sf::Vector2f(pauseText_.getGlobalBounds().width / 2.f, pauseText_.getGlobalBounds().height / 2.f);
	pauseText_.setPosition(centre);

}
开发者ID:BeastModeSHU,项目名称:Copter,代码行数:7,代码来源:PlayState.cpp


示例6: setSystemFont

void MemberFilterDlg::initialize()
//--------------------------------
{
    setSystemFont( FALSE );
    rescale();
    move( frame().r );
    centre();

    _inheritGroup = new WGroupBox(      this, _inheritGroupR.r,  _inheritGroupR.t );
    _bttns._none = new WRadioButton(    this, _noneR.r,          _noneR.t, RStyleGroupFirst );
    _bttns._visible = new WRadioButton( this, _visibleR.r,       _visibleR.t );
    _bttns._all = new WRadioButton(     this, _allR.r,           _allR.t, RStyleGroupLast );

    _accessGroup = new WGroupBox(       this, _accessGroupR.r,   _accessGroupR.t );
    _public = new WCheckBox(            this, _publicR.r,        _publicR.t );
    _protected = new WCheckBox(         this, _protectedR.r,     _protectedR.t );
    _private = new WCheckBox(           this, _privateR.r,       _privateR.t );

    _memberGroup = new WGroupBox(       this, _memberGroupR.r,   _memberGroupR.t );
    _variables = new WCheckBox(         this, _variablesR.r,     _variablesR.t );
    _varStatic = new WCheckBox(         this, _varStaticR.r,    _varStaticR.t );
    _functions = new WCheckBox(         this, _functionsR.r,     _functionsR.t );
    _virtual = new WCheckBox(           this, _virtualR.r,       _virtualR.t );
    _funcStatic = new WCheckBox(        this, _funcStaticR.r,    _funcStaticR.t );

    _variables->onClick( this, (cbw) &MemberFilterDlg::varOrFuncPushed );
    _functions->onClick( this, (cbw) &MemberFilterDlg::varOrFuncPushed );

    _okButton = new WDefPushButton( this, _okButtonR.r,      _okButtonR.t );
    _defaultButton = new WPushButton(   this, _defaultButtonR.r, _defaultButtonR.t );
    _cancelButton = new WPushButton(    this, _cancelButtonR.r,  _cancelButtonR.t );


    _inheritGroup->show();
    _bttns._none->show();
    _bttns._visible->show();
    _bttns._all->show();
    _accessGroup->show();
    _public->show();
    _protected->show();
    _private->show();
    _memberGroup->show();
    _variables->show();
    _varStatic->show();
    _functions->show();
    _virtual->show();
    _funcStatic->show();
    _okButton->show();
    _defaultButton->show();
    _cancelButton->show();

    _okButton->onClick(      this, (cbw) MemberFilterDlg::okButton );
    _defaultButton->onClick( this, (cbw) MemberFilterDlg::defaultButton );
    _cancelButton->onClick(  this, (cbw) MemberFilterDlg::cancelButton );

    _bttns._none->setFocus();

    setValues( _current );
    show();
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:60,代码来源:memfilt.cpp


示例7: setSystemFont

void QueryConfig::initialize()
//----------------------------
{
    int i;
    OptionManager * optMgr = WBRWinBase::optManager();

    setSystemFont( FALSE );
    rescale();
    move( frame().r );
    centre();

    _symText =      new WText( this, _symTextR.r, _symTextR.t );
    _symName =      new WCommandList( this, _symNameR.r, NULL );

    _symText->show();
    _symName->show();

    _matchCase =    new WCheckBox( this, _matchCaseR.r, _matchCaseR.t );
    _wholeWord =    new WCheckBox( this, _anchoredR.r, _anchoredR.t );
    _useRX =        new WCheckBox( this, _useRXR.r, _useRXR.t );
    _cfgRegexp =    new WPushButton( this, _cfgRegexpR.r, _cfgRegexpR.t );

    _matchCase->show();
    _wholeWord->show();
    _useRX->show();

    _matchCase->setCheck( !optMgr->getIgnoreCase() );
    _wholeWord->setCheck( optMgr->getWholeWord() );
    _useRX->setCheck( optMgr->getUseRX() );
    _useRX->onClick( this, (cbw) &QueryConfig::useRXClicked );
    _wholeWord->enable( !optMgr->getUseRX() );

    _ok =           new WDefPushButton( this, _searchR.r, _searchR.t );
    _cancel =       new WPushButton( this, _cancelR.r, _cancelR.t );
    _filters =      new WPushButton( this, _filtersR.r, _filtersR.t );
    _help =         new WPushButton( this, _helpR.r, _helpR.t );

    _ok->show();
    _cancel->show();
    _filters->show();
    _cfgRegexp->show();
    _help->show();

    _cfgRegexp->enable( optMgr->getUseRX() );

    _ok->onClick(           this, (cbw) &QueryConfig::okButton );
    _cancel->onClick(       this, (cbw) &WDialog::cancelButton );
    _filters->onClick(      this, (cbw) &QueryConfig::filtersButton );
    _cfgRegexp->onClick(    this, (cbw) &QueryConfig::cfgRXButton );
    _help->onClick(         this, (cbw) &QueryConfig::helpButton );

    for( i = 0; i < _searchStrings->count(); i +=1 ) {
        _symName->insertString( ((WString *)(*_searchStrings)[ i ] )->gets(),
                                0 );
    }

    _symName->setFocus();

    show();
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:60,代码来源:querycfg.cpp


示例8: SDL_Init

void Graphic::Initialize()
{
	SDL_Init( SDL_INIT_VIDEO );

	SDL_SetVideoMode( 800, 600, 0, SDL_OPENGL | SDL_HWSURFACE );
	SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );

	GLint major, minor;
	glGetIntegerv(GL_MAJOR_VERSION, &major);
	glGetIntegerv(GL_MINOR_VERSION, &minor);
	std::cout
		<< "OpenGL on "
		<< glGetString(GL_VENDOR)
		<< glGetString(GL_RENDERER) << '\n';
	std::cout
		<< "OpenGL version supported "
		<< glGetString(GL_VERSION) << '\n';
	std::cout
		<< "GLSL version supported "
		<< glGetString(GL_SHADING_LANGUAGE_VERSION) << '\n';
	std::cout
		<< "Will now set GL to version "
		<< major << minor << '\n';

	
	glHint( GL_POINT_SMOOTH_HINT,GL_NICEST );
	glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );

	glEnable( GL_DEPTH_TEST ); 
	glEnable( GL_TEXTURE_2D );
	glEnable( GL_LINE_SMOOTH );
	glShadeModel( GL_SMOOTH );

	glViewport (0, 0, 800, 600);
	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
	glDepthFunc(GL_LEQUAL);

	glMatrixMode (GL_PROJECTION);
	glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 1000.0);
	glMatrixMode (GL_MODELVIEW);

	glEnableClientState( GL_VERTEX_ARRAY );
	glEnableClientState( GL_NORMAL_ARRAY );
	glEnableClientState( GL_TEXTURE_COORD_ARRAY );


	glm::vec3 eye(0.0f, 0.0f, 2.0f), centre(0, 0, -1.0f), up(0.0f, 1.0f, 0.0f);
	viewMatrix = glm::lookAt(eye, centre, up);


	GLuint vertexShader = LoadShader( "shader.vertex", Vertex );
	GLuint fragmentShader = LoadShader( "shader.fragment", Fragment );

	GLuint shaderProgram = glCreateProgram();

	glAttachShader( shaderProgram, vertexShader );
	glAttachShader( shaderProgram, fragmentShader );

	glLinkProgram( shaderProgram );
}
开发者ID:Alyanorno,项目名称:Message-system,代码行数:60,代码来源:graphics.cpp


示例9: textMetrics

void WInputDialog::initialize() {
/*******************************/

    WPoint avg;
    WPoint max;
    textMetrics( avg, max );
    int sp = max.x();

    int x = WSystemMetrics::dialogFrameWidth();
    int y = WSystemMetrics::dialogFrameHeight();

    int p_w = 0;
    int p_h = 0;
    updateExtents( _promptText, &p_w, &p_h );
    p_w += avg.x() / 2;
    p_h += avg.y() / 2;
    int r_w = 32 * avg.x();
    int r_h = max.y() + 2*max.y() / 3;
    updateExtents( *_reply, &r_w, &r_h );

    _prompt = new WText( this, WRect( x, y + (r_h - p_h)/2, p_w, p_h ), _promptText );
    _prompt->show();
    _input = new WEditBox( this, WRect( x + p_w + sp, y, r_w, r_h ), *_reply );
    _input->show();
    y += p_h + max.y();

    int b_w = 0;
    int b_h = 0;
    updateExtents( BrowseText, &b_w, &b_h );
    updateExtents( CancelText, &b_w, &b_h );
    updateExtents( OKText, &b_w, &b_h );
    b_w += avg.x() * 2;
    b_h += avg.y() / 2;
    WDefPushButton *bOk = new WDefPushButton( this, WRect( x, y, b_w, b_h ),
                                              OKText );
    bOk->onClick( this, (cbw)&WInputDialog::okButton );
    bOk->show();
    x += b_w + max.x();

    WPushButton *bCancel = new WPushButton( this, WRect( x, y, b_w, b_h ),
                                            CancelText );
    bCancel->onClick( this, (cbw)&WInputDialog::cancelButton );
    bCancel->show();
    x += b_w + max.x();

    if( _browseDialog ) {
        WPushButton *bBrowse = new WPushButton( this,
                                                WRect( x, y, b_w, b_h ),
                                                BrowseText );
        bBrowse->onClick( this, (cbw)&WInputDialog::browseButton );
        bBrowse->show();
    }

    shrink();
    centre();

    _input->select();
    _input->setFocus();
    show();
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:60,代码来源:winpdlg.cpp


示例10: centre

void Terrain::HighLightPosition( float x,float z,float radius ) {

  if (x != lastx || z != lastz) {
	  int centerX = x*(m_heightField.xDim-1);
	  int centerZ = z*(m_heightField.zDim-1);
	
	
	  float radiusInFiled = m_heightField.xDim * radius;
	  ofVec2f vecToPoint;
	  ofVec2f centre(centerX,centerZ);
	
	 // colorBuffer[(centerZ*m_heightField.xDim)+centerX] = ofVec3f(1,0,0);
	
	  for (int i = 0; i < m_heightField.xDim; ++i) {
	    for (int j = 0; j < m_heightField.zDim; ++j) {
	
	      vecToPoint = centre - ofVec2f(i,j);
	      float d = vecToPoint.length();
	      float normD = (1.0f-(d/radiusInFiled));
	
	      colorBuffer[(j*m_heightField.xDim)+i] = d < radiusInFiled ? ofVec3f(normD,0,0) : ofVec3f(0,0,0);
	    }
	  }

    lastx = x;
    lastz = z;

    isColorDirty = true;
  }
  


}
开发者ID:azzogat,项目名称:KT_mamba,代码行数:33,代码来源:Terrain.cpp


示例11: TestCellKillersOutputParameters

    void TestCellKillersOutputParameters()
   {
       std::string output_directory = "TestSloughingCellKillersOutputParameters";
       OutputFileHandler output_file_handler(output_directory, false);

       // Test with SloughingCellKiller
       SloughingCellKiller<2> sloughing_cell_killer(NULL, 20.0, true, 10.0);
       TS_ASSERT_EQUALS(sloughing_cell_killer.GetIdentifier(), "SloughingCellKiller-2");

       out_stream sloughing_cell_killer_parameter_file = output_file_handler.OpenOutputFile("sloughing_results.parameters");
       sloughing_cell_killer.OutputCellKillerParameters(sloughing_cell_killer_parameter_file);
       sloughing_cell_killer_parameter_file->close();

       std::string sloughing_cell_killer_results_dir = output_file_handler.GetOutputDirectoryFullPath();
       FileComparison( sloughing_cell_killer_results_dir + "sloughing_results.parameters", "crypt/test/data/TestSloughingCellKillers/sloughing_results.parameters").CompareFiles();

       // Test with RadialSloughingCellKiller
       c_vector<double,2> centre(2);
       centre[0] = 0.1;
       centre[1] = 0.2;
       double radius = 0.4;
       RadialSloughingCellKiller radial_cell_killer(NULL, centre, radius);
       TS_ASSERT_EQUALS(radial_cell_killer.GetIdentifier(), "RadialSloughingCellKiller");

       out_stream radial_cell_killer_parameter_file = output_file_handler.OpenOutputFile("radial_results.parameters");
       radial_cell_killer.OutputCellKillerParameters(radial_cell_killer_parameter_file);
       radial_cell_killer_parameter_file->close();

       std::string radial_cell_killer_results_dir = output_file_handler.GetOutputDirectoryFullPath();
       FileComparison( radial_cell_killer_results_dir + "radial_results.parameters", "crypt/test/data/TestSloughingCellKillers/radial_results.parameters").CompareFiles();
   }
开发者ID:ktunya,项目名称:ChasteMod,代码行数:31,代码来源:TestSloughingCellKillers.hpp


示例12: getTextExtentX

void VAbout::initialize()
{
    int fw = WSystemMetrics::dialogFrameWidth();
    int fh = WSystemMetrics::dialogFrameHeight();
    int wid = 0;
    int yoff = fh;
    for( int i=0; _viperDesc[i] != NULL; i++ ) {
        int w = getTextExtentX( _viperDesc[i] );
        int h = getTextExtentY( _viperDesc[i] );
        if( w > 0 ) {
            if( wid < w ) wid = w;
            WText* t1 = new WText( this, WRect(fw, yoff, w, h), _viperDesc[i] );
//          WText* t1 = new WText( this, WRect(fw, yoff, w, h), _viperDesc[i], TextStyleCentre );
            yoff += h * 5/4;
            t1->show();
        }
    }
    wid += fw * 2;

    static const char ok[] = { "OK" };
    int w = getTextExtentX( ok ) * 3;
    int h = getTextExtentY( ok ) * 3/2;
    int xoff = (wid - w) / 2;
    WDefPushButton* bOk = new WDefPushButton( this, WRect( xoff, yoff, w, h), "OK" );
    yoff += h * 5/4;
    bOk->onClick( this, (cbw)&VAbout::okButton );
    bOk->show();

    shrink();
    centre();

    show();
    bOk->setFocus();
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:34,代码来源:vabout.cpp


示例13: TEST_F

TEST_F(BodySurfaceDynamicFrameTest, Serialization) {
  serialization::DynamicFrame message;
  big_frame_->WriteToMessage(&message);

  EXPECT_TRUE(message.HasExtension(
      serialization::BodySurfaceDynamicFrame::extension));
  auto const extension = message.GetExtension(
      serialization::BodySurfaceDynamicFrame::extension);
  EXPECT_TRUE(extension.has_centre());
  EXPECT_EQ(0, extension.centre());

  auto const read_big_frame =
      DynamicFrame<ICRFJ2000Equator, BigSmallFrame>::ReadFromMessage(
          ephemeris_.get(), message);
  EXPECT_THAT(read_big_frame, Not(IsNull()));

  Instant const t = t0_ + period_;
  DegreesOfFreedom<BigSmallFrame> const point_dof =
      {Displacement<BigSmallFrame>({10 * Metre, 20 * Metre, 30 * Metre}) +
           BigSmallFrame::origin,
       Velocity<BigSmallFrame>({3 * Metre / Second,
                                2 * Metre / Second,
                                1 * Metre / Second})};
  EXPECT_EQ(big_frame_->GeometricAcceleration(t, point_dof),
            read_big_frame->GeometricAcceleration(t, point_dof));
}
开发者ID:eggrobin,项目名称:Principia,代码行数:26,代码来源:body_surface_dynamic_frame_test.cpp


示例14: centre

Rect Rect::scale(float number)const{
	Vec2f centre((m_maxX + m_minX)*0.5f, (m_maxY + m_minY)*0.5f);
	float w = m_maxX - m_minX;
	float h = m_maxY - m_minY;
	return Rect(centre.x - w*0.5f*number, centre.x + w*0.5f*number,
		centre.y - h*0.5f*number, centre.y + h*0.5f*number);
}
开发者ID:AD87,项目名称:Super-Smash-TV,代码行数:7,代码来源:Rect.cpp


示例15: updateState

void updateState(GLFWwindow* window, Grid* fluid,
				Vector3* camerapos,Vector3* camera_z,Vector3* camera_y,
				Vector3* lightPos){

	static double lastTime = glfwGetTime();
	double currentTime = glfwGetTime();

	glfwPollEvents();

	double xpos, ypos;
	glfwGetCursorPos(window, &xpos, &ypos);

	xpos -= 1366/2;
	ypos -= 768/2;

	xpos/=100;
	ypos/=100;
	Vector3 centre(0,0,2),current(xpos,ypos,sqrt(4-xpos*xpos-ypos*ypos));
	Matrix4 rotMat;

	int state = glfwGetKey(window, GLFW_KEY_LEFT_CONTROL );
	if((centre*current).mod()>0.005 ){
		Vector3 rotation_Goal=centre*current*300;
		Matrix4 basisTransform(-*camera_z,*camera_y,Matrix4::BASIS);
		rotation_Goal=(basisTransform*Vector4(rotation_Goal,0)).xyz();
		rotMat = 	Matrix4(Vector3(50,50,50),Matrix4::TRANSLATE)*
					Matrix4(rotation_Goal,Vector3(1.25,3.4,5.4),Matrix4::BASIS)*
					Matrix4(rotation_Goal ,Matrix4::ROTATION_Z)*
					Matrix4(rotation_Goal,Vector3(1.25,3.4,5.4))*
					Matrix4(Vector3(-50,-50,-50),Matrix4::TRANSLATE);
		fluid->Model = rotMat*fluid->Model;
	}
	glfwSetCursorPos(window, 1366/2, 768/2);
}
开发者ID:rohandas36,项目名称:FlowuUiN,代码行数:34,代码来源:Ui.cpp


示例16: compute_model_path

project::project(const std::string& fpath)
        : scene_data_{is_project_file(fpath) ? compute_model_path(fpath)
                                             : fpath}
        , needs_save_{!is_project_file(fpath)} {
    //  First make sure default source and receiver are in a sensible position.
    const auto aabb =
            wayverb::core::geo::compute_aabb(get_scene_data().get_vertices());
    const auto c = centre(aabb);

    (*persistent.sources())[0]->set_position(c);
    (*persistent.receivers())[0]->set_position(c);

    //  Set up surfaces.
    const auto& surface_strings = scene_data_.get_scene_data()->get_surfaces();
    *persistent.materials() = wayverb::combined::model::materials_from_names<1>(begin(surface_strings),
                                                      end(surface_strings));

    //  If there's a config file, we'll just overwrite the state we just set,
    //  but that's probably fine.
    if (is_project_file(fpath)) {
        const auto config_file = project::compute_config_path(fpath);

        //  load the config
        std::ifstream stream{config_file};
        cereal::JSONInputArchive{stream}(persistent);
    }

    persistent.connect([&](auto&) { needs_save_ = true; });
}
开发者ID:reuk,项目名称:wayverb,代码行数:29,代码来源:main_model.cpp


示例17: setSystemFont

void NewDBRFile::initialize()
//--------------------------
{
    setSystemFont( false );
    rescale();
    move( frame().r );
    centre();

    _browsefileGroup =   new WGroupBox(      this, _browsefileGroupR.r,   _browsefileGroupR.t );
    _fileEdit =          new WEditBox(       this, _fileEditR.r,          _fileEditR.t );
    _okButton =          new WDefPushButton( this, _okButtonR.r,          _okButtonR.t );
    _browseFilesButton = new WPushButton(    this, _browseFilesButtonR.r, _browseFilesButtonR.t );
    _cancelButton =      new WPushButton(    this, _cancelButtonR.r,      _cancelButtonR.t );

    _browsefileGroup->show();
    _fileEdit->show();
    _okButton->show();
    _browseFilesButton->show();
    _cancelButton->show();

    _okButton->onClick(          this, (cbw) NewDBRFile::okButton );
    _browseFilesButton->onClick( this, (cbw) NewDBRFile::filesButton );
    _cancelButton->onClick(      this, (cbw) NewDBRFile::cancelButton );

    _fileEdit->setFocus();

    show();
}
开发者ID:ArmstrongJ,项目名称:open-watcom-v2,代码行数:28,代码来源:newdbrdg.cpp


示例18: TEST_F

TEST_F(BodyCentredNonRotatingDynamicFrameTest, Serialization) {
  serialization::DynamicFrame message;
  small_frame_->WriteToMessage(&message);

  EXPECT_TRUE(message.HasExtension(
      serialization::BodyCentredNonRotatingDynamicFrame::extension));
  auto const extension = message.GetExtension(
      serialization::BodyCentredNonRotatingDynamicFrame::extension);
  EXPECT_TRUE(extension.has_centre());
  EXPECT_EQ(1, extension.centre());

  auto const read_small_frame =
      DynamicFrame<ICRS, Small>::ReadFromMessage(message, ephemeris_.get());
  EXPECT_THAT(read_small_frame, Not(IsNull()));

  Instant const t = t0_ + period_;
  DegreesOfFreedom<Small> const point_dof =
      {Displacement<Small>({10 * Metre, 20 * Metre, 30 * Metre}) +
           Small::origin,
       Velocity<Small>({3 * Metre / Second,
                        2 * Metre / Second,
                        1 * Metre / Second})};
  EXPECT_EQ(small_frame_->GeometricAcceleration(t, point_dof),
            read_small_frame->GeometricAcceleration(t, point_dof));
}
开发者ID:mockingbirdnest,项目名称:Principia,代码行数:25,代码来源:body_centred_non_rotating_dynamic_frame_test.cpp


示例19: centre

float FuzzyVariable::right(int crispValue, int median, int deviation)
{
	if( crispValue >= median )
		return 1.0f;
	else
		return centre(crispValue, median, deviation);
}
开发者ID:tnaran,项目名称:fuzzygen,代码行数:7,代码来源:fuzzy.cpp


示例20: centre

/**
 *	This is the constructor for SphereVectorGenerator.
 *
 * 	@param Centre		The centre of the sphere.
 * 	@param MaxRadius	The radius of the sphere.
 * 	@param MinRadius	The radius of the hole in the centre of the sphere.
 */
SphereVectorGenerator::SphereVectorGenerator( const Vector3 &Centre,
		float MaxRadius,
		float MinRadius )
{
	centre(Centre);
	maxRadius(MaxRadius);
	minRadius(MinRadius);
}
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:15,代码来源:vector_generator.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ centreWithSize函数代码示例发布时间:2022-05-30
下一篇:
C++ centralWidget函数代码示例发布时间: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