本文整理汇总了C++中ARRAY::SetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ ARRAY::SetSize方法的具体用法?C++ ARRAY::SetSize怎么用?C++ ARRAY::SetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARRAY
的用法示例。
在下文中一共展示了ARRAY::SetSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPoints
void SplineSeg<D> :: GetPoints (int n, ARRAY<Point<D> > & points)
{
points.SetSize (n);
if (n >= 2)
for (int i = 0; i < n; i++)
points[i] = GetPoint(double(i) / (n-1));
}
示例2:
void Primitive ::
GetTangentialVecSurfaceIndices (const Point<3> & p, const Vec<3> & v,
ARRAY<int> & surfind, double eps) const
{
cout << "get tangvecsurfind not implemented" << endl;
surfind.SetSize (0);
}
示例3: Intersection
void Intersection (const FlatArray<T> & in1, const FlatArray<T> & in2, const FlatArray<T> & in3,
ARRAY<T> & out)
{
out.SetSize(0);
for(int i=0; i<in1.Size(); i++)
if(in2.Contains(in1[i]) && in3.Contains(in1[i]))
out.Append(in1[i]);
}
示例4: GetKeys
void CHotKeys::GetKeys(ARRAY& keys)
{
INT_PTR count = GetSize();
keys.SetSize(count);
for(int i=0; i < count; i++)
{
keys[i] = ElementAt(i)->GetKey();
}
}
示例5: QickSort
void QickSort (const ARRAY<double> & values,
ARRAY<int> & order)
{
int i, n = values.Size();
order.SetSize (n);
for (i = 1; i <= n; i++)
order.Elem(i) = i;
QickSortRec (values, order, 1, order.Size());
}
示例6: LineIntersections
void LineSeg<D> :: LineIntersections (const double a, const double b, const double c,
ARRAY < Point<D> > & points, const double eps) const
{
points.SetSize(0);
double denom = -a*p2(0)+a*p1(0)-b*p2(1)+b*p1(1);
if(fabs(denom) < 1e-20)
return;
double t = (a*p1(0)+b*p1(1)+c)/denom;
if((t > -eps) && (t < 1.+eps))
points.Append(GetPoint(t));
}
示例7: Sort
void Sort (const ARRAY<double> & values,
ARRAY<int> & order)
{
int n = values.Size();
int i, j;
order.SetSize (n);
for (i = 1; i <= n; i++)
order.Elem(i) = i;
for (i = 1; i <= n-1; i++)
for (j = 1; j <= n-1; j++)
if (values.Get(order.Elem(j)) > values.Get(order.Elem(j+1)))
{
Swap (order.Elem(j), order.Elem(j+1));
}
}
示例8: GetPolySurfs
void Polyhedra :: GetPolySurfs(ARRAY < ARRAY<int> * > & polysurfs)
{
int maxnum = -1;
for(int i = 0; i<faces.Size(); i++)
{
if(faces[i].inputnr > maxnum)
maxnum = faces[i].inputnr;
}
polysurfs.SetSize(maxnum+1);
for(int i=0; i<polysurfs.Size(); i++)
polysurfs[i] = new ARRAY<int>;
for(int i = 0; i<faces.Size(); i++)
polysurfs[faces[i].inputnr]->Append(faces[i].planenr);
}
示例9: OnDeleteCopyData
void CCopyProperties::OnDeleteCopyData()
{
int nCount = m_lCopyData.GetSelCount();
if(nCount)
{
m_bDeletedData = true;
//Get the selected indexes
ARRAY items;
items.SetSize(nCount);
m_lCopyData.GetSelItems(nCount, items.GetData());
items.SortDescending();
//Get the selected itemdata
for(int i = 0; i < nCount; i++)
{
m_DeletedData.Add(m_lCopyData.GetItemData(items[i]));
m_lCopyData.DeleteString(items[i]);
}
}
}
示例10: OnDeleteCopyData
void CCopyProperties::OnDeleteCopyData()
{
int nCount = m_lCopyData.GetSelCount();
if(nCount)
{
m_bDeletedData = true;
//Get the selected indexes
ARRAY items;
items.SetSize(nCount);
m_lCopyData.GetSelItems(nCount, items.GetData());
items.SortDescending();
//Get the selected itemdata
for(int i = 0; i < nCount; i++)
{
int row = items[i];
m_DeletedData.Add((int)m_lCopyData.GetItemData(row));
m_lCopyData.DeleteString(row);
int newRow = row-1;
if(newRow < 0)
{
newRow = 0;
}
if(newRow >= 0 && newRow < m_lCopyData.GetCount())
{
m_lCopyData.SetSel(newRow);
m_lCopyData.SetCurSel(newRow);
m_lCopyData.SetCaretIndex(newRow);
m_lCopyData.SetAnchorIndex(newRow);
}
}
}
}
示例11: GetPrimitiveData
void Polyhedra :: GetPrimitiveData (const char *& classname,
ARRAY<double> & coeffs) const
{
classname = "Polyhedra";
coeffs.SetSize(0);
coeffs.Append (points.Size());
coeffs.Append (faces.Size());
coeffs.Append (planes.Size());
/*
int i, j;
for (i = 1; i <= planes.Size(); i++)
{
planes.Elem(i)->Print (*testout);
}
for (i = 1; i <= faces.Size(); i++)
{
(*testout) << "face " << i << " has plane " << faces.Get(i).planenr << endl;
for (j = 1; j <= 3; j++)
(*testout) << points.Get(faces.Get(i).pnums[j-1]);
(*testout) << endl;
}
*/
}
示例12: LineIntersections
/** calculates lineintersections:
for lines $$ a x + b y + c = 0 $$ the interecting points are calculated
and stored in points */
virtual void LineIntersections (const double a, const double b, const double c,
ARRAY < Point<2> > & points, const double eps) const
{points.SetSize(0);}
示例13: reg
inline int FindInnerPoint2 (POINTARRAY & points,
FACEARRAY & faces,
Point3d & p)
{
static int timer = NgProfiler::CreateTimer ("FindInnerPoint2");
NgProfiler::RegionTimer reg (timer);
ARRAY<Vec3d> a;
ARRAY<double> c;
Mat<3> m, inv;
Vec<3> rs, x, pmin;
int nf = faces.Size();
a.SetSize (nf);
c.SetSize (nf);
for (int i = 0; i < nf; i++)
{
Point3d p1 = points.Get(faces[i][0]);
a[i] = Cross (points.Get(faces[i][1]) - p1,
points.Get(faces[i][2]) - p1);
a[i] /= a[i].Length();
c[i] = - (a[i].X() * p1.X() + a[i].Y() * p1.Y() + a[i].Z() * p1.Z());
}
x = 0;
double hmax = 0;
for (int i = 0; i < nf; i++)
{
const Element2d & el = faces[i];
for (int j = 1; j <= 3; j++)
{
double hi = Dist (points.Get(el.PNumMod(j)),
points.Get(el.PNumMod(j+1)));
if (hi > hmax) hmax = hi;
}
}
double fmin = 0;
for (int i1 = 1; i1 <= nf; i1++)
for (int i2 = i1+1; i2 <= nf; i2++)
for (int i3 = i2+1; i3 <= nf; i3++)
for (int i4 = i3+1; i4 <= nf; i4++)
{
m(0, 0) = a.Get(i1).X() - a.Get(i2).X();
m(0, 1) = a.Get(i1).Y() - a.Get(i2).Y();
m(0, 2) = a.Get(i1).Z() - a.Get(i2).Z();
rs(0) = c.Get(i2) - c.Get(i1);
m(1, 0) = a.Get(i1).X() - a.Get(i3).X();
m(1, 1) = a.Get(i1).Y() - a.Get(i3).Y();
m(1, 2) = a.Get(i1).Z() - a.Get(i3).Z();
rs(1) = c.Get(i3) - c.Get(i1);
m(2, 0) = a.Get(i1).X() - a.Get(i4).X();
m(2, 1) = a.Get(i1).Y() - a.Get(i4).Y();
m(2, 2) = a.Get(i1).Z() - a.Get(i4).Z();
rs(2) = c.Get(i4) - c.Get(i1);
if (fabs (Det (m)) > 1e-10)
{
CalcInverse (m, inv);
x = inv * rs;
double f = -1e10;
for (int i = 0; i < nf; i++)
{
double hd =
x(0) * a[i].X() + x(1) * a[i].Y() + x(2) * a[i].Z() + c[i];
if (hd > f) f = hd;
if (hd > fmin) break;
}
if (f < fmin)
{
fmin = f;
pmin = x;
}
}
}
p = Point3d (pmin(0), pmin(1), pmin(2));
(*testout) << "fmin = " << fmin << endl;
return (fmin < -1e-3 * hmax);
}
示例14: GetPrimitiveData
void Primitive :: GetPrimitiveData (const char *& classname,
ARRAY<double> & coeffs) const
{
classname = "undef";
coeffs.SetSize (0);
}
示例15: Clear
void Clear() {
boundary.SetSize(0);
};