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


C++ cg::point_2方法代码示例

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


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

示例1: on_double_click

 bool on_double_click(const point_2f & p)
 {
    chain.clear();
    chain = {point_2(0, 0), point_2(20, 20), point_2(40, 40)};
    current_vertex_.reset();
    return true;
 }
开发者ID:BorysMinaiev,项目名称:cg,代码行数:7,代码来源:douglas.cpp

示例2:

 triangle_contains_point_viewer():
     t_(point_2(0, 0),
        point_2(100, 100),
        point_2(200, 0)),
     rbutton_pressed_(false)
 {
 }
开发者ID:suhain,项目名称:cg,代码行数:7,代码来源:triangle_contains_point.cpp

示例3: TEST

TEST(Triangulation, one_line)
{
    using cg::point_2;
    std::vector<point_2> pts = boost::assign::list_of(point_2(0, 0))
                                                     (point_2(10, 0))
                                                     (point_2(20, 0))
                                                     (point_2(10, -10));

    cg::cell<double> cell;
    for (int i = 0; i < pts.size(); i++) {
        auto ans = cell.get_triangulation();

        for (const cg::triangle_2 & tr : ans) {
            std::cout << tr[0] << tr[1] << tr[2] << std::endl;
        }
        cell.add_point(pts[i]);
    }
    std::cout << "Ans" << std::endl;
    auto ans = cell.get_triangulation();

    for (const cg::triangle_2 & tr : ans) {
        std::cout << tr[0] << tr[1] << tr[2] << std::endl;
    }
    EXPECT_TRUE(true == true);
}
开发者ID:watson94,项目名称:cg,代码行数:25,代码来源:Delaunay_triangulation.cpp

示例4: TEST

TEST(convex_hull, simple_andrew4)
{
   using cg::point_2;

   std::vector<point_2> pts = boost::assign::list_of(point_2(1, 0))
                                                    (point_2(0, 1));

   EXPECT_TRUE(is_convex_hull(pts.begin(), cg::andrew_hull(pts.begin(), pts.end()), pts.end()));
}
开发者ID:free0u,项目名称:cg,代码行数:9,代码来源:convex_hull.cpp

示例5: TEST

TEST(orientation, counterclockwise2)
{
   using cg::point_2;

   std::vector<point_2> a = boost::assign::list_of(point_2(1, 0))
                                                  (point_2(3, 0))
                                                  (point_2(0, 2));

   EXPECT_TRUE(cg::counterclockwise(cg::contour_2(a)));
}
开发者ID:ChShersh,项目名称:cg,代码行数:10,代码来源:orientation.cpp

示例6: TEST

TEST(contains, triangle_point)
{
   using cg::point_2;

   cg::triangle_2 t(point_2(0, 0), point_2(1, 1), point_2(2, 0));

   for (size_t l = 0; l != 3; ++l)
      EXPECT_TRUE(cg::contains(t, t[l]));

   EXPECT_TRUE(cg::contains(t, point_2(1, 0.5)));

   EXPECT_TRUE(cg::contains(t, point_2(1, 0)));
   EXPECT_TRUE(cg::contains(t, point_2(0.5, 0.5)));
   EXPECT_TRUE(cg::contains(t, point_2(1.5, 0.5)));

   EXPECT_FALSE(cg::contains(t, point_2(0, 1)));
   EXPECT_FALSE(cg::contains(t, point_2(2, 1)));
   EXPECT_FALSE(cg::contains(t, point_2(1, -1)));
}
开发者ID:Susak,项目名称:cg,代码行数:19,代码来源:contains.cpp

示例7: TEST

TEST(dynamic_convex_hull, without_deleting3)
{
   using cg::point_2;

   std::vector<point_2> pts = boost::assign::list_of(point_2(-15.2939, -91.2349))
                              (point_2(73.6514, -84.1031))
                              (point_2(46.0487, -42.9297))
                              (point_2(21.95, 48.3017))
                              (point_2(-6.31702, -43.6781));

   cg::dynamic_hull dh;

   for (point_2 p : pts)
   {
      dh.add_point(p);
   }

   EXPECT_TRUE(is_convex_hull(pts.begin(), pts.end(), dh.get_hull().first, dh.get_hull().second));
}
开发者ID:YakutovDmitriy,项目名称:cg,代码行数:19,代码来源:dynamic_convex_hull.cpp

示例8:

 triangle_intersects_triangle_viewer()
     : s_(point_2(-100, -100), point_2(50, 50), point_2(0, 50)),
      t_(point_2(-50, -50), point_2(50, -50), point_2(-50, 50)),
       rbutton_pressed_(false),
       int_({})
 {
     int_ = cg::intersection(s_, t_);
 }
开发者ID:dvbobrov,项目名称:cg,代码行数:8,代码来源:exam_2401_2.cpp

示例9: on_press

   bool on_press(const point_2f & p)
   {
      for (size_t i = 0; i < chain.size(); ++i)
      {
         if (fabs(chain[i].x - p.x) < 15 && fabs(chain[i].y - p.y) < 15)
         {
            current_vertex_ = i;
            return true;
         }
      }

      if(!current_vertex_)
         chain.push_back(point_2(p.x, p.y));

      return true;
   }
开发者ID:BorysMinaiev,项目名称:cg,代码行数:16,代码来源:douglas.cpp

示例10: TEST

TEST(minkowski, square)
{
   using cg::point_2;
   std::vector<point_2> a = boost::assign::list_of(point_2(0, 0))
                                                  (point_2(4, 0))
                                                  (point_2(4, 4))
                                                  (point_2(0, 4));

   std::vector<point_2> b = boost::assign::list_of(point_2(-2, -2))
                                                  (point_2(2, -2))
                                                  (point_2(2, 2))
                                                  (point_2(-2, 2));

   std::vector<point_2> c = boost::assign::list_of(point_2(-2, -2))
                                                  (point_2(6, -2))
                                                  (point_2(6, 6))
                                                  (point_2(-2, 6));
   auto ans = cg::contour_2(c);

   auto res = cg::minkowski_sum(cg::contour_2(a), cg::contour_2(b));
   EXPECT_TRUE( std::equal(ans.begin(), ans.end(), res.begin()) );
}
开发者ID:wotopul,项目名称:cg,代码行数:22,代码来源:minkowski.cpp

示例11: TEST

#include <gtest/gtest.h>
#include <boost/assign/list_of.hpp>
#include <cg/operations/convex.h>
#include <cg/convex_hull/graham.h>
#include <misc/random_utils.h>

#include "random_utils.h"

using namespace util;


TEST(convex, 1)
{
   using cg::point_2;

   std::vector<point_2> pts = boost::assign::list_of(point_2(0, 0));

   EXPECT_TRUE(cg::convex(cg::contour_2(pts)));
}

TEST(convex, 2)
{
   using cg::point_2;

   std::vector<point_2> pts = boost::assign::list_of(point_2(0, 0))
                                                    (point_2(1, 0));

   EXPECT_TRUE(cg::convex(cg::contour_2(pts)));
}

TEST(convex, 3)
开发者ID:darkraven74,项目名称:cg,代码行数:31,代码来源:convex.cpp

示例12: chain

 contour_contains_point_viewer()
    : chain(std::vector<point_2>({point_2(0, 0), point_2(20, 20), point_2(40, 40)}))
    , eps(0.5)
    , rbutton_pressed_(false)
 {}
开发者ID:BorysMinaiev,项目名称:cg,代码行数:5,代码来源:douglas.cpp

示例13:

   rectangle_intersects_segment_viewer()
      : s_(point_2(-100, -100), point_2(100, 100)),
        r_(cg::range_d(-50, 50), cg::range_d(-50, 50)),
	     rbutton_pressed_(false)
   {}
开发者ID:danielgalper,项目名称:cg,代码行数:5,代码来源:rectangle_intersects_segment.cpp

示例14: contour

 contour_contains_point_viewer()
    : contour(std::vector<point_2>({point_2(0, 0), point_2(100, 100), point_2(200, 0)}))
 {}
开发者ID:BigBot22,项目名称:cg,代码行数:3,代码来源:contour_contains_point.cpp

示例15: DCEL

 localization_point_viewer()
 {
     dcel_by_lines = new DCEL(point_2(-400, -400), point_2(400, 400));
 }
开发者ID:markina,项目名称:cg,代码行数:4,代码来源:localization_point_viewer.cpp


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