当前位置: 首页>>代码示例>>C++>>正文


C++ Board2D::drawArrow方法代码示例

本文整理汇总了C++中Board2D::drawArrow方法的典型用法代码示例。如果您正苦于以下问题:C++ Board2D::drawArrow方法的具体用法?C++ Board2D::drawArrow怎么用?C++ Board2D::drawArrow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Board2D的用法示例。


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

示例1: exampleUpdate

/**
 * @brief Function showing how a DSS can be extended and retracted. 
 */
void exampleUpdate()
{
  trace.beginBlock ( "DSS update" );

  using namespace Z2i; 

  //Construction --------------------------------------------------
  //! [ArithmeticalDSSUpdateInit]
  Point M(11, 7); 
  NaiveDSS8<Integer> S( 5, 8,       //slope 
			Point(0,0), Point(10,6), //ending points 
			Point(0,0), Point(8,5), //upper points
			Point(3,1), Point(3,1)  //lower points
			);
  //! [ArithmeticalDSSUpdateInit]

  //this segment should be valid: 
  if (!S.isValid()) throw std::exception();
  // Store a copy before any operation
  NaiveDSS8<Integer> copyOfS = S; 

  trace.info() << S << std::endl;


  //Display ------------------------------------------------------  
  {
    Board2D board;

    // Draw the grid
    Domain domain( Point(0,0), M );
    board << SetMode(domain.className(), "Grid")
	  << domain;    
    // Draw the points of the DSS and its bounding box
    board << SetMode("PointVector", "Both");
    board << SetMode(S.className(), "Points") 
	  << S
	  << SetMode(S.className(), "BoundingBox") 
	  << S;
    // Draw the orthonormal base
    board.drawArrow(0.0, 0.0, 1.0, 0.0); 
    board.drawArrow(0.0, 0.0, 0.0, 1.0); 
    // Draw M
    board << SetMode(M.className(), "Both")
	  << CustomStyle( M.className(), new CustomColors( Color(255,0,0), Color(192, 0, 0)) )
	  << M; 


    // Save
    board.saveSVG("NaiveDSS8ExtInit.svg");
#ifdef WITH_CAIRO
    board.saveCairo("NaiveDSS8ExtInit.png", Board2D::CairoPNG);
#endif
  }

  // Extension -----------------------------------------------------
  //! [ArithmeticalDSSUpdateExtension]
  bool resExtention = S.extendFront( M ); 
  //! [ArithmeticalDSSUpdateExtension]
  //this segment should be extended: 
  if (!resExtention) throw std::exception(); 

  trace.info() << S << std::endl; 

  //Display ------------------------------------------------------  
  {
    Board2D board;

    // Draw the grid
    Domain domain( Point(0,0), M );
    board << SetMode(domain.className(), "Grid")
	  << domain;    
    // Draw the points of the DSS and its bounding box
    board << SetMode("PointVector", "Both");
    board << SetMode(S.className(), "Points") 
	  << S
	  << SetMode(S.className(), "BoundingBox") 
	  << S;
    // Draw the orthonormal base
    board.drawArrow(0.0, 0.0, 1.0, 0.0); 
    board.drawArrow(0.0, 0.0, 0.0, 1.0); 

    // Save
    board.saveSVG("NaiveDSS8ExtDone.svg");
#ifdef WITH_CAIRO
    board.saveCairo("NaiveDSS8ExtDone.png", Board2D::CairoPNG);
#endif
  }
    
  // Retraction ----------------------------------------------------
  //! [ArithmeticalDSSUpdateRetraction]
  bool resRetraction = S.retractFront(); 
  //! [ArithmeticalDSSUpdateRetraction]
  //this segment should be retracted: 
  if (!resRetraction) throw std::exception(); 

  trace.info() << S << std::endl; 

//.........这里部分代码省略.........
开发者ID:arnaudetitia,项目名称:DGtal,代码行数:101,代码来源:exampleArithmeticalDSS.cpp


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