本文整理汇总了C++中PointVector::reserve方法的典型用法代码示例。如果您正苦于以下问题:C++ PointVector::reserve方法的具体用法?C++ PointVector::reserve怎么用?C++ PointVector::reserve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointVector
的用法示例。
在下文中一共展示了PointVector::reserve方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rectangle
PointVector rectangle(const QRectF &rect)
{
const QPointF p1 = rect.topLeft();
const QPointF p2 = rect.bottomRight();
PointVector pv;
pv.reserve(5);
pv << Point(p1, 1);
pv << Point(p1.x(), p2.y(), 1);
pv << Point(p2, 1);
pv << Point(p2.x(), p1.y(), 1);
pv << Point(p1.x() + 1, p1.y(), 1);
return pv;
}
示例2: TP
void auxdata::DrcPoly::motionDraw(const layprop::DrawProperties&, CtmQueue& transtack,
SGBitSet* plst) const
{
CTM trans = transtack.front();
PointVector* ptlist = DEBUG_NEW PointVector;
ptlist->reserve(_psize);
for (unsigned i = 0; i < _psize; i++)
{
ptlist->push_back( TP(_pdata[2*i], _pdata[2*i+1]) * trans);
}
glBegin(GL_LINE_LOOP);
for (unsigned i = 0; i < _psize; i++)
{
glVertex2i((*ptlist)[i].x(), (*ptlist)[i].y());
}
glEnd();
ptlist->clear();
delete ptlist;
}
示例3: sampleStroke
PointVector sampleStroke(const QRectF &rect)
{
const int strokew = rect.width();
const qreal strokeh = rect.height() * 0.6;
const qreal offy = rect.top() + rect.height()/2;
const qreal dphase = (2*M_PI)/qreal(strokew);
qreal phase = 0;
PointVector pointvector;
pointvector.reserve(strokew);
pointvector << paintcore::Point(rect.left(), offy, 0.0);
for(int x=0;x<strokew;++x, phase += dphase) {
const qreal fx = x/qreal(strokew);
const qreal pressure = qBound(0.0, ((fx*fx) - (fx*fx*fx))*6.756, 1.0);
const qreal y = qSin(phase) * strokeh;
pointvector << Point(rect.left()+x, offy+y, pressure);
}
return pointvector;
}
示例4: PointVector_from_python
inline PointVector* PointVector_from_python(PyObject* py) {
PyObject* seq = PySequence_Fast(py, "Argument must be an iterable of Points");
if (seq == NULL)
return 0;
int size = PySequence_Fast_GET_SIZE(seq);
PointVector* cpp = new PointVector();
try {
cpp->reserve(size);
for (int i = 0; i < size; ++i) {
PyObject* point = PySequence_Fast_GET_ITEM(seq, i);
Point p = coerce_Point(point);
cpp->push_back(p);
}
} catch (std::exception e) {
delete cpp;
Py_DECREF(seq);
PyErr_SetString(PyExc_RuntimeError, e.what());
return 0;
}
Py_DECREF(seq);
return cpp;
}