本文整理汇总了C++中shape函数的典型用法代码示例。如果您正苦于以下问题:C++ shape函数的具体用法?C++ shape怎么用?C++ shape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shape函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: render
void DrawingItemGroup::render(QPainter* painter, const DrawingStyleOptions& styleOptions)
{
#ifdef DEBUG_DRAW_ITEM_SHAPE
painter->setBrush(Qt::magenta);
painter->setPen(QPen(Qt::magenta, 1));
painter->drawPath(shape());
#endif
for(auto itemIter = mItems.begin(); itemIter != mItems.end(); itemIter++)
{
if ((*itemIter)->isVisible())
{
qreal scaleFactor = Drawing::unitsScale((*itemIter)->units(), units());
painter->save();
painter->translate((*itemIter)->pos());
painter->scale(scaleFactor, scaleFactor);
(*itemIter)->render(painter, styleOptions);
painter->restore();
}
}
}
开发者ID:jaallen85,项目名称:jade-legacy,代码行数:22,代码来源:DrawingItemGroup.cpp
示例2: TEST
TEST(BoxPointContainment, ComplexInside)
{
shapes::Box shape(1.0, 1.0, 1.0);
bodies::Body* box = new bodies::Box(&shape);
box->setScale(1.01);
Eigen::Affine3d pose(Eigen::AngleAxisd(M_PI/3.0, Eigen::Vector3d::UnitX()));
pose.translation() = Eigen::Vector3d(1.0,1.0,1.0);
box->setPose(pose);
bool contains = box->containsPoint(1.5,1.0,1.5);
EXPECT_TRUE(contains);
random_numbers::RandomNumberGenerator r;
Eigen::Vector3d p;
for (int i = 0 ; i < 100 ; ++i)
{
EXPECT_TRUE(box->samplePointInside(r, 100, p));
EXPECT_TRUE(box->containsPoint(p));
}
delete box;
}
开发者ID:jonbinney,项目名称:moveit-core,代码行数:22,代码来源:test_point_inclusion.cpp
示例3: mouseReleaseEvent
void AbstractButtonItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
{
if( m_mouseDown )
{
m_mouseDown = false;
this->update();
if( shape().contains(event->pos()) )
{
event->accept();
m_checked = ! m_checked;
update();
emit mouseClicked(m_checked);
emit toggled(m_checked);
}
}
}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:22,代码来源:GraphicsItems.cpp
示例4: compound
boost::shared_ptr<btCompoundShape> ConvexDecomp::run(std::vector<boost::shared_ptr<btCollisionShape> > &shapeStorage) {
HACD::HACD hacd;
hacd.SetPoints(&points[0]);
hacd.SetNPoints(points.size());
hacd.SetTriangles(&triangles[0]);
hacd.SetNTriangles(triangles.size());
hacd.SetCompacityWeight(0.1);
hacd.SetVolumeWeight(0.0);
// HACD parameters
// Recommended parameters: 2 100 0 0 0 0
//size_t nClusters = 2;
size_t nClusters = 1;
double concavity = 100;
bool invert = false;
bool addExtraDistPoints = false;
bool addNeighboursDistPoints = false;
bool addFacesPoints = false;
hacd.SetNClusters(nClusters); // minimum number of clusters
hacd.SetNVerticesPerCH(100); // max of 100 vertices per convex-hull
hacd.SetConcavity(concavity); // maximum concavity
hacd.SetAddExtraDistPoints(addExtraDistPoints);
hacd.SetAddNeighboursDistPoints(addNeighboursDistPoints);
hacd.SetAddFacesPoints(addFacesPoints);
hacd.Compute();
nClusters = hacd.GetNClusters();
boost::shared_ptr<btCompoundShape> compound(new btCompoundShape());
for (int c = 0; c < nClusters; ++c) {
btVector3 centroid;
boost::shared_ptr<btConvexHullShape> shape(processCluster(hacd, c, centroid));
shapeStorage.push_back(shape);
compound->addChildShape(btTransform(btQuaternion(0, 0, 0, 1), centroid), shape.get());
}
return compound;
}
开发者ID:NaohiroHayashi,项目名称:bulletsim,代码行数:39,代码来源:convexdecomp.cpp
示例5: main
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML Works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
开发者ID:rebbybear,项目名称:samplegame,代码行数:22,代码来源:main.cpp
示例6: getMemoryShapes
bool getMemoryShapes(const std::vector<MatShape> &inputs,
const int requiredOutputs,
std::vector<MatShape> &outputs,
std::vector<MatShape> &internals) const
{
CV_Assert(inputs.size() == 2);
int layerHeight = inputs[0][2];
int layerWidth = inputs[0][3];
// Since all images in a batch has same height and width, we only need to
// generate one set of priors which can be shared across all images.
size_t outNum = 1;
// 2 channels. First channel stores the mean of each prior coordinate.
// Second channel stores the variance of each prior coordinate.
size_t outChannels = 2;
outputs.resize(1, shape(outNum, outChannels,
layerHeight * layerWidth * _numPriors * 4));
return false;
}
开发者ID:lenlen,项目名称:opencv_contrib,代码行数:22,代码来源:prior_box_layer.cpp
示例7: test_far_from_origin
// This test case including path coords and matrix taken from crbug.com/627443.
// Because of inaccuracies in large floating point values this causes the
// the path renderer to attempt to add a path DF to its atlas that is larger
// than the plot size which used to crash rather than fail gracefully.
static void test_far_from_origin(GrDrawContext* drawContext, GrPathRenderer* pr,
GrResourceProvider* rp) {
SkPath path;
path.lineTo(49.0255089839f, 0.473541f);
static constexpr SkScalar mvals[] = {14.0348252854f, 2.13026182736f,
13.6122547187f, 118.309922702f,
1912337682.09f, 2105391889.87f};
SkMatrix matrix;
matrix.setAffine(mvals);
SkMatrix inverse;
SkAssertResult(matrix.invert(&inverse));
path.transform(inverse);
SkStrokeRec rec(SkStrokeRec::kFill_InitStyle);
rec.setStrokeStyle(1.f);
rec.setStrokeParams(SkPaint::kRound_Cap, SkPaint::kRound_Join, 1.f);
GrStyle style(rec, nullptr);
GrShape shape(path, style);
shape = shape.applyStyle(GrStyle::Apply::kPathEffectAndStrokeRec, 1.f);
GrPaint paint;
paint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode));
GrNoClip noClip;
GrPathRenderer::DrawPathArgs args;
args.fPaint = &paint;
args.fUserStencilSettings = &GrUserStencilSettings::kUnused;
args.fDrawContext = drawContext;
args.fClip = &noClip;
args.fResourceProvider = rp;
args.fViewMatrix = &matrix;
args.fShape = &shape;
args.fAntiAlias = true;
args.fGammaCorrect = false;
args.fColor = 0x0;
pr->drawPath(args);
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:42,代码来源:DFPathRendererTest.cpp
示例8: main
int
main()
{
typedef agg::pixfmt_bgr24 pixel_type;
const unsigned w = 60, h = 50;
unsigned row_size = pixel_type::pix_width * w;
unsigned buf_size = row_size * h;
agg::pod_array<unsigned char> img_buf(buf_size);
agg::rendering_buffer rbuf(img_buf.data(), w, h, app_flip_y ? -row_size : row_size);
pixel_type pixf(rbuf);
typedef agg::renderer_base<pixel_type> renderer_base;
typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_solid;
renderer_base rb(pixf);
renderer_solid rs(rb);
agg::rasterizer_scanline_aa<> ras;
agg::scanline_p8 sl;
agg::rgba8 white(255, 255, 255);
rb.clear(white);
agg::rgba8 color(160, 0, 0);
agg::ellipse shape(30.0, 25.0, 12.0, 12.0);
ras.add_path(shape);
rs.color(color);
agg::render_scanlines(ras, sl, rs);
save_image_file(rbuf, "output.ppm");
return 0;
}
开发者ID:franko,项目名称:agg-intro,代码行数:38,代码来源:main.cpp
示例9: getBlobShpae
static BlobShape getBlobShpae(std::vector<Mat> &vmat, int requestedCn = -1)
{
BlobShape shape(4);
int cnSum = 0, matCn;
CV_Assert(vmat.size() > 0);
for (size_t i = 0; i < vmat.size(); i++)
{
Mat &mat = vmat[i];
CV_Assert(!mat.empty());
CV_Assert((mat.dims == 3 && mat.channels() == 1) || mat.dims <= 2);
matCn = getMatChannels(mat);
cnSum += getMatChannels(mat);
if (i == 0)
{
shape[-1] = mat.cols;
shape[-2] = mat.rows;
shape[-3] = (requestedCn <= 0) ? matCn : requestedCn;
}
else
{
if (mat.cols != shape[-1] || mat.rows != shape[-2])
CV_Error(Error::StsError, "Each Mat.size() must be equal");
if (requestedCn <= 0 && matCn != shape[-3])
CV_Error(Error::StsError, "Each Mat.chnannels() (or number of planes) must be equal");
}
}
if (cnSum % shape[-3] != 0)
CV_Error(Error::StsError, "Total number of channels in vector is not a multiple of requsted channel number");
shape[0] = cnSum / shape[-3];
return shape;
}
开发者ID:headupinclouds,项目名称:opencv_contrib,代码行数:38,代码来源:blob.cpp
示例10: Q_UNUSED
void DelegateVideoControl::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option);
Q_UNUSED(widget);
painter->fillPath(shape(), brush());
qreal frameWidth = rect().height() / 2;
int position = frameWidth;
if (mTotalTimeInMs > 0)
{
position = frameWidth + (rect().width() - (2 * frameWidth)) / mTotalTimeInMs * mCurrentTimeInMs;
}
int radius = rect().height() / 6;
QRectF r(rect().x() + position - radius, rect().y() + (rect().height() / 4) - radius, radius * 2, radius * 2);
painter->setBrush(UBSettings::documentViewLightColor);
painter->drawEllipse(r);
if(mDisplayCurrentTime)
{
painter->setBrush(UBSettings::paletteColor);
painter->setPen(QPen(Qt::NoPen));
QRectF balloon(rect().x() + position - frameWidth, rect().y() - (frameWidth * 1.2), 2 * frameWidth, frameWidth);
painter->drawRoundedRect(balloon, frameWidth/2, frameWidth/2);
QTime t;
t = t.addMSecs(mCurrentTimeInMs < 0 ? 0 : mCurrentTimeInMs);
QFont f = painter->font();
f.setPointSizeF(f.pointSizeF() * mAntiScale);
painter->setFont(f);
painter->setPen(Qt::white);
painter->drawText(balloon, Qt::AlignCenter, t.toString("m:ss"));
}
}
开发者ID:coachal,项目名称:Sankore-3.1,代码行数:38,代码来源:UBGraphicsVideoItemDelegate.cpp
示例11: fprintf
void ConnEnd::outputCode(FILE *fp, const char *srcDst, unsigned int num) const
{
if (num == 0)
{
num = m_conn_ref->id();
}
if (junction())
{
fprintf(fp, " ConnEnd %sPt%u(junctionRef%u);\n", srcDst,
num, m_anchor_obj->id());
}
else if (shape())
{
fprintf(fp, " ConnEnd %sPt%u(shapeRef%u, %u);\n", srcDst,
num, m_anchor_obj->id(), m_connection_pin_class_id);
}
else
{
fprintf(fp, " ConnEnd %sPt%u(Point(%g, %g), (ConnDirFlags) %u);\n",
srcDst, num, m_point.x, m_point.y, m_directions);
}
}
开发者ID:cmears,项目名称:adaptagrams,代码行数:23,代码来源:connend.cpp
示例12: switch
void AdvancedTabBar::resizeEvent(QResizeEvent * event)
{
QTabBar::resizeEvent(event);
switch (shape()) {
case QTabBar::RoundedNorth:
case QTabBar::TriangularNorth:
case QTabBar::RoundedSouth:
case QTabBar::TriangularSouth:
setMinimumSize(parentWidget()->width(), 0);
d->list->setViewMode(QListView::IconMode);
break;
case QTabBar::RoundedEast:
case QTabBar::TriangularEast:
case QTabBar::RoundedWest:
case QTabBar::TriangularWest:
setMinimumSize(0, parentWidget()->height());
d->list->setViewMode(QListView::ListMode);
break;
}
d->list->setDragEnabled(false);
d->list->setDragDropMode(QAbstractItemView::NoDragDrop);
d->list->resize(size());
}
开发者ID:AlekSi,项目名称:Jabbin,代码行数:23,代码来源:advancedtabbar.cpp
示例13: ReshapeBlobs
void ReshapeBlobs(int num_timesteps, int num_instances) {
blob_bottom_.Reshape(num_timesteps, num_instances, 3, 2);
vector<int> shape(2);
shape[0] = num_timesteps;
shape[1] = num_instances;
blob_bottom_flush_.Reshape(shape);
shape.push_back(num_output_);
shape[0] = 1; shape[1] = num_instances; shape[2] = 4 * num_output_;
unit_blob_bottom_x_.Reshape(shape);
shape[0] = 1; shape[1] = num_instances; shape[2] = num_output_;
unit_blob_bottom_c_prev_.Reshape(shape);
shape[0] = 1; shape[1] = 1; shape[2] = num_instances;
unit_blob_bottom_flush_.Reshape(shape);
FillerParameter filler_param;
filler_param.set_min(-1);
filler_param.set_max(1);
UniformFiller<Dtype> filler(filler_param);
filler.Fill(&blob_bottom_);
filler.Fill(&unit_blob_bottom_c_prev_);
filler.Fill(&unit_blob_bottom_x_);
}
开发者ID:BlGene,项目名称:nips2015-action-conditional-video-prediction,代码行数:23,代码来源:test_lstm_layer.cpp
示例14: numpy_to_ublas
boost::numeric::ublas::matrix< T > &
numpy_to_ublas(
boost::python::object a,
boost::numeric::ublas::matrix< T > & m )
{
boost::python::tuple shape( a.attr("shape") );
if( boost::python::len( shape ) != 2 )
{
throw std::logic_error( "numeric::array must have 2 dimensions" );
}
m.resize(
boost::python::extract< unsigned >( shape[0] ),
boost::python::extract< unsigned >( shape[1] ) );
for( unsigned i = 0; i < m.size1(); ++i )
{
for( unsigned j = 0; j < m.size2(); ++j )
{
m( i, j ) = boost::python::extract< T >( a[
boost::python::make_tuple( i, j ) ] );
}
}
return m;
}
开发者ID:capoe,项目名称:soapxx,代码行数:23,代码来源:numpy.hpp
示例15: TEST
TEST(DATA, SourceRetype)
{
std::vector<ade::DimT> slist = {3, 3, 3};
ade::Shape shape(slist);
size_t n = shape.n_elems();
std::vector<double> data = {
16, 51, 12, 55, 69, 10, 52, 86, 95,
6, 78, 18, 100, 11, 52, 66, 55, 30,
80, 81, 36, 26, 63, 78, 80, 31, 37
};
ade::TensptrT ptr(llo::Variable<double>::get(data, shape));
llo::TensptrT<uint16_t> gd = llo::eval<uint16_t>(ptr);
auto gotslist = gd->dimensions();
EXPECT_ARREQ(slist, gotslist);
uint16_t* gotdata = (uint16_t*) gd->data();
for (size_t i = 0; i < n; ++i)
{
EXPECT_EQ((uint16_t) data[i], gotdata[i]);
}
}
开发者ID:mingkaic,项目名称:tenncor,代码行数:23,代码来源:test_variable.cpp
示例16: cxios_write_data_k47
void cxios_write_data_k47(const char* fieldid, int fieldid_size, float* data_k4,
int data_0size, int data_1size, int data_2size,
int data_3size, int data_4size, int data_5size,
int data_6size)
{
std::string fieldid_str;
if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return;
CTimer::get("XIOS").resume();
CTimer::get("XIOS send field").resume();
CContext* context = CContext::getCurrent();
if (!context->hasServer && !context->client->isAttachedModeEnabled())
context->checkBuffersAndListen();
CArray<float, 7> data_tmp(data_k4, shape(data_0size, data_1size, data_2size, data_3size, data_4size, data_5size, data_6size), neverDeleteData);
CArray<double, 7> data(data_0size, data_1size, data_2size, data_3size, data_4size, data_5size, data_6size);
data = data_tmp;
CField::get(fieldid_str)->setData(data);
CTimer::get("XIOS send field").suspend();
CTimer::get("XIOS").suspend();
}
开发者ID:RemiLacroix-IDRIS,项目名称:XIOS,代码行数:23,代码来源:icdata.cpp
示例17: QCOMPARE
void tst_QPainterPath::translate()
{
QPainterPath path;
// Path with no elements.
QCOMPARE(path.currentPosition(), QPointF());
path.translate(50.5, 50.5);
QCOMPARE(path.currentPosition(), QPointF());
QCOMPARE(path.translated(50.5, 50.5).currentPosition(), QPointF());
// path.isEmpty(), but we have one MoveTo element that should be translated.
path.moveTo(50, 50);
QCOMPARE(path.currentPosition(), QPointF(50, 50));
path.translate(99.9, 99.9);
QCOMPARE(path.currentPosition(), QPointF(149.9, 149.9));
path.translate(-99.9, -99.9);
QCOMPARE(path.currentPosition(), QPointF(50, 50));
QCOMPARE(path.translated(-50, -50).currentPosition(), QPointF(0, 0));
// Complex path.
QRegion shape(100, 100, 300, 200, QRegion::Ellipse);
shape -= QRect(225, 175, 50, 50);
QPainterPath complexPath;
complexPath.addRegion(shape);
QVector<QPointF> untranslatedElements;
for (int i = 0; i < complexPath.elementCount(); ++i)
untranslatedElements.append(QPointF(complexPath.elementAt(i)));
const QPainterPath untranslatedComplexPath(complexPath);
const QPointF offset(100, 100);
complexPath.translate(offset);
for (int i = 0; i < complexPath.elementCount(); ++i)
QCOMPARE(QPointF(complexPath.elementAt(i)) - offset, untranslatedElements.at(i));
QCOMPARE(complexPath.translated(-offset), untranslatedComplexPath);
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:37,代码来源:tst_qpainterpath.cpp
示例18: shape
void PickAndPlace::set_attached_object(bool attach, const geometry_msgs::Pose &pose,moveit_msgs::RobotState &robot_state)
{
// get robot state
robot_state::RobotStatePtr current_state= move_group_ptr->getCurrentState();
if(attach)
{
// constructing shape
std::vector<shapes::ShapeConstPtr> shapes_array;
shapes::ShapeConstPtr shape( shapes::constructShapeFromMsg( cfg.ATTACHED_OBJECT.primitives[0]));
shapes_array.push_back(shape);
// constructing pose
tf::Transform attached_tf;
tf::poseMsgToTF(cfg.ATTACHED_OBJECT.primitive_poses[0],attached_tf);
EigenSTL::vector_Affine3d pose_array(1);
tf::transformTFToEigen(attached_tf,pose_array[0]);
// attaching
current_state->attachBody(cfg.ATTACHED_OBJECT_LINK_NAME,shapes_array,pose_array,cfg.TOUCH_LINKS,cfg.TCP_LINK_NAME);
// update box marker
cfg.MARKER_MESSAGE.header.frame_id = cfg.TCP_LINK_NAME;
cfg.MARKER_MESSAGE.pose = cfg.TCP_TO_BOX_POSE;
}
else
{
// detaching
if(current_state->hasAttachedBody(cfg.ATTACHED_OBJECT_LINK_NAME))
current_state->clearAttachedBody(cfg.ATTACHED_OBJECT_LINK_NAME);
}
// save robot state data
robot_state::robotStateToRobotStateMsg(*current_state,robot_state);
}
开发者ID:Liangconghui,项目名称:NTU_Amazon_Picking_Challenge,代码行数:37,代码来源:set_attached_object.cpp
示例19: ConformShapeToMod
Shape ConformShapeToMod( // Return a copy of inshape conformed to the model
VEC& b, // io: eigvec weights, 2n x 1
const Shape& inshape, // in: the current position of the landmarks
const Shape& meanshape, // in: n x 2
const VEC& eigvals, // in: neigs x 1
const MAT& eigvecs, // in: 2n x neigs
const MAT& eigvecsi, // in: neigs x 2n, inverse of eigvecs
const double bmax, // in: for LimitB
const VEC& pointweights) // in: contribution of each point to the pose
{
Shape shape(inshape.clone());
// estimate the pose which transforms the shape into the model space
// (use the b from previous iterations of the ASM)
MAT modelshape(AsColVec(meanshape) + eigvecs * b);
modelshape = DimKeep(modelshape, shape.rows, 2); // redim back to 2 columns
const MAT pose(AlignmentMat(modelshape, shape, Buf(pointweights)));
// transform the shape into the model space
modelshape = TransformShape(shape, pose.inv(cv::DECOMP_LU));
// update shape model params b to match modelshape, then limit b
b = eigvecsi * AsColVec(modelshape - meanshape);
LimitB(b, eigvals, bmax);
// generate conformedshape from the model using the limited b
// (we generate as a column vec, then redim back to 2 columns)
const Shape conformedshape(DimKeep(eigvecs * b, shape.rows, 2));
// back to image space
return JitterPointsAt00(TransformShape(meanshape + conformedshape, pose));
}
开发者ID:tianzuishang,项目名称:I-morph,代码行数:37,代码来源:shapemod.cpp
示例20: shape
Ship::Ship(int mX, int mY, EventHandler e, int align, sf::Color c)
{
mx = mX;
my = mY;
x = 50;
y = std::abs(mx * align - 50);
health = 100; // arbitrary value
start = e.myClock.getElapsedTime();
end = e.myClock.getElapsedTime();
radius = 20;
attackDelay = 100;
curAtkDelay = attackDelay;
alignment = align;
myColor = c;
curColor = c;
healthBar.setSize(sf::Vector2f(health * 2, 50));
healthBar.setFillColor(curColor);
if(alignment == 0)
shipTexture.loadFromFile("ShipB.png");
else
shipTexture.loadFromFile("ShipG.png");
shipSprite.setTexture(shipTexture);
shipRenderTexture.create(shipTexture.getSize().x, shipTexture.getSize().y);
shipRenderTexture.draw(shipSprite);
sf::CircleShape shape(radius);
shape.setOutlineColor(curColor);
shape.setFillColor(sf::Color(0,0,0,0));
shape.setOutlineThickness(1);
shipRenderTexture.draw(shape);
shipRenderTexture.display(); // update the texture
shipSprite.setTexture(shipRenderTexture.getTexture());
hitColor = sf::Color(255-c.r, 255-c.g,255-c.b);
moveSpeed = 2;
specialA = 0;
specialB = 0;
}
开发者ID:brayou,项目名称:TomatoFighters,代码行数:36,代码来源:Ship.cpp
注:本文中的shape函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论