本文整理汇总了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;
}
示例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;
}
示例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());
}
示例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] );
}
示例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 );
}
示例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;
}
示例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++));
}
}
示例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;
}
示例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;
}
示例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 ) );
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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];
}