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


C++ PointArray类代码示例

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


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

示例1: PointArray

 /*
  * Returns an exact clone of the array.
  */
 PointArray *copy() {
   PointArray *clone = new PointArray(nElems);
   for (int i = 0; i < nElems; i++) {
     clone->append(thePoints[i]);
   }
   return clone;
 }
开发者ID:XintongEmilyWang,项目名称:Algorithms,代码行数:10,代码来源:PointArray.cpp

示例2: SearchMaxAreaBoundary

static int SearchMaxAreaBoundary( const PointArray& bpts, const IntArray& bpos )
{
    double maxArea = -1;
    int pos = -1;
    for( int i = 0; i < ( int )bpos.size(); i++ )
    {
        int s = 0;
        for( int j = 0; j < i; j++ )
        {
            s += bpos[j];
        }
        int t = s + bpos[i];

        PointArray polygon;
        std::copy( bpts.begin() + s, bpts.begin() + t, std::back_inserter( polygon ) );
        if( pos == -1 )
        {
            pos = i;
            maxArea = PolygonArea( polygon );
        }
        else
        {
            double area = PolygonArea( polygon );
            if( area > maxArea )
            {
                pos = i;
                maxArea = area;
            }
        }
    }
    return pos;
}
开发者ID:kanbang,项目名称:myexercise,代码行数:32,代码来源:Trace.cpp

示例3: splitCasteljau

void CurveFitter::splitCasteljau(const PointArray<256> &curve, qreal t,
    PointArray<256> &left, PointArray<256> &right)
{
    left.resize(curve.count());
    right.resize(curve.count());
    splitCasteljau(curve.count(), curve.data(), t, left.data(), right.data());
}
开发者ID:daivanov,项目名称:Curves,代码行数:7,代码来源:curvefitter.cpp

示例4: SearchLabelPostion

// 采用近似估计的算法
// 如果是闭合等值线,则搜索整个多边形中最长的边
// 如果是开放等值线,则搜索20%--80%范围内的多边形中最长边
void SearchLabelPostion( const PointArray& cnpts, DT_Point& tpt, double& angle )
{
    if( cnpts.empty() ) return;

    // 通常情况下,等值线至少有3个点
    int s = 0, t = cnpts.size();
    if( !IsPointEqual( cnpts.front(), cnpts.back() ) )
    {
        s = cnpts.size() / 5;
        t = cnpts.size() - s;
    }

    int pos = s;
    double maxDist = Distance_2( cnpts[0], cnpts[1] );
    for( int i = s; i < t - 1; i++ )
    {
        double dist = Distance_2( cnpts[i], cnpts[i + 1] );
        if( dist > maxDist )
        {
            pos = i;
            maxDist = dist;
        }
    }
    tpt = MidPoint( cnpts[pos], cnpts[pos + 1] );
    angle = Direction( cnpts[pos], cnpts[pos + 1] );
}
开发者ID:kanbang,项目名称:myexercise,代码行数:29,代码来源:Label.cpp

示例5: BuildAttribs

Contour::Contour( const PointArray& pts, const EdgeArray& ea, const TriangleArray& ta )
{
    // 将点数据复制一份
    std::copy( pts.begin(), pts.end(), std::back_inserter( pa ) );
    // 构造边和三角形属性数据
    BuildAttribs( ea, ta, eaa, taa );
}
开发者ID:kanbang,项目名称:myexercise,代码行数:7,代码来源:Trace.cpp

示例6: comp1

bool comp1(PointArray p1, PointArray p2) {
    if (p1.getSize() != p2.getSize())
        return false;
    for (int i = 0; i < p1.getSize(); i++)
        if (p1[i].getX() != p2[i].getX() || p1[i].getY() != p2[i].getY())
            return false;
    return true;
}
开发者ID:Carlossiii,项目名称:LP1-projects,代码行数:8,代码来源:search_poly.cpp

示例7: createDistinctPointArray

void OccupationMap::setOccupiedPoints(const PointArray &pointArray) {
  if(pointArray.size() == 0) return;
  PointArray tmp;
  createDistinctPointArray(tmp, pointArray); // pointArray.size() >= 1 => tmp.size() >= 1

  for(const CPoint *p = &tmp[0], *end = &tmp.last(); p <= end;) {
    setOccupiedPoint(*(p++));
  }
}
开发者ID:JesperMikkelsen,项目名称:Big-Numbers,代码行数:9,代码来源:OccupationMap.cpp

示例8: curve

PointArray<256> CurveFitter::curve(const PointArray<256> &curvePoints, int count)
{
    PointArray<256> points;
    points.resize(count);

    curve(curvePoints.count(), curvePoints.data(), count, points.data());

    return points;
}
开发者ID:daivanov,项目名称:Curves,代码行数:9,代码来源:curvefitter.cpp

示例9: makeRectanglePoints

PointArray ShapeManager::makeRectanglePoints(int x, int y, int width, int height)
{
    PointArray points;
    points.push_back(Point(x, y));
    points.push_back(Point(x + width, y));
    points.push_back(Point(x + width, y + height));
    points.push_back(Point(x, y + height));

    return points;
}
开发者ID:jjangminkim,项目名称:AmsongApp,代码行数:10,代码来源:ShapeManager.cpp

示例10: GetOutMostBoundary

static void GetOutMostBoundary( const PointArray& all_bpts, const IntArray& all_bpos, PointArray& bpts )
{
    // 搜索最大边界(最外围边界)
    int k = SearchMaxAreaBoundary( all_bpts, all_bpos );
    if( k != -1 )
    {
        int ks = 0, kt = 0;
        GetSEPos( all_bpos, k, ks, kt );
        std::copy( all_bpts.begin() + ks, all_bpts.begin() + kt, std::back_inserter( bpts ) );
    }
}
开发者ID:kanbang,项目名称:myexercise,代码行数:11,代码来源:Trace.cpp

示例11: comp2

bool comp2(PointArray p1, PointArray p2) {
    if (p1.getSize() != p2.getSize())
        return false;
    for (int i = 0; i < p1.getSize(); i++) {
        bool a = false;
        for (int j = 0; j < p1.getSize(); j++) {
            if (p1[i].getX() == p2[j].getX() && p1[i].getY() == p2[j].getY())
                a = true;
        }
        if (a == false) return a;
    }
    return true;
}
开发者ID:Carlossiii,项目名称:LP1-projects,代码行数:13,代码来源:search_poly.cpp

示例12: Vector2

PointArray* PointArray::reverse() const
{
    vector<Vector2*> *newArray = new vector<Vector2*>();
    vector<Vector2*>::reverse_iterator iter;
    Vector2 *point = nullptr;
    for (iter = _controlPoints->rbegin(); iter != _controlPoints->rend(); ++iter)
    {
        point = *iter;
        newArray->push_back(new Vector2(point->x, point->y));
    }
    PointArray *config = PointArray::create(0);
    config->setControlPoints(newArray);
    
    return config;
}
开发者ID:Jthora,项目名称:BeatRecognitionSystem,代码行数:15,代码来源:CCActionCatmullRom.cpp

示例13: Save

	static bool Save(const PointArray& PA, char* FileName) {
		ofstream f(FileName);
		f << "X\tY";
		for(unsigned i = 0; i < PA.size(); ++i)
			f << "\n" << PA[i].X << '\t' << PA[i].Y;
		return false;
	}
开发者ID:Make-Believe,项目名称:FRIS,代码行数:7,代码来源:main.cpp

示例14: write_classic_bundler

void write_classic_bundler(std::ofstream &file, CameraArray& cam_list, PointArray& point_list)
{
	file << "# Bundle file v0.3" << std::endl;
	file << cam_list.size() << " " << point_list.size() << std::endl;

	write_cams(file, cam_list);
	write_points(file, point_list);
}
开发者ID:srajotte,项目名称:easyBA,代码行数:8,代码来源:io.cpp

示例15:

PointArray::PointArray(const PointArray &pv) {
    size = pv.getSize();
    // could use size = pv.size since code in PointArray class has access to
    // private variables
    points = new Point[size];
    for (int i = 0; i < size; ++i)
        points[i] = pv.points[i];
}
开发者ID:Tigrolik,项目名称:git_workspace,代码行数:8,代码来源:geometry.cpp


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