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


C++ P1函数代码示例

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


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

示例1: P1

inline void AbstractPath::filterOffset(const int i, Vec2f& here) const {
  Vec2f P1(getElement(i-1), getElement(i));
  Vec2f P2(getElement(i+1), getElement(i));
  
  float p1len = P1.Len(), p2len = P2.Len(), sum = p1len+p2len;
  P1 *= p2len / sum;
  P2 *= p1len / sum;

  here = P1;
  here += P2;
}
开发者ID:doctorpangloss,项目名称:Roto,代码行数:11,代码来源:abstractPath.C

示例2: main

int main() {
  __CPROVER_ASYNC_0: P0(0);
  __CPROVER_ASYNC_1: P1(0);
  __CPROVER_ASYNC_2: P2(0);
  __CPROVER_ASYNC_3: P3(0);
  __CPROVER_assume(__unbuffered_cnt==4);
  fence();
  // EXPECT:exists
  __CPROVER_assert(!(x==2 && y==2 && __unbuffered_p0_r3==1 && __unbuffered_p1_r5==0 && __unbuffered_p2_r3==1 && __unbuffered_p3_r5==0), "Program proven to be relaxed for PPC, model checker says YES.");
  return 0;
}
开发者ID:debleena89,项目名称:Mytest,代码行数:11,代码来源:lwswr000.c

示例3: P1

void MainWindow::resizeItem() {
for (int i = 0;  i < 10;  i++) {
    QGraphicsRectItem* theFrame = item1;
    QPointF P1(100 - (7.0 * i)/3.0, 50 -(5.0*i)/3.0);

    graphicsSheet->addPoint("P1", P1);
    graphicsSheet->addPoint("pos", theFrame->pos());

    QPointF P2i = QPointF(theFrame->rect().width(), theFrame->rect().height());
    QPointF P2 = theFrame->mapToScene(P2i);

    qDebug() << "P1:" << P1;
    qDebug() << "P2:" << P2;
    graphicsSheet->addPoint("P2", P2);

    QTransform t;
    t.rotate(-theFrame->rotation());
    t.translate(-P1.x(), -P1.y());

    QPointF P2t = t.map(P2);

//    qDebug() << "P2t:" << P2t;  // OK

/*************************/
    QPointF P3(P2t.x()/2, P2t.y()/2);
 //   qDebug() << "P3:" << P3;

    QTransform t2;
    t2.translate(P1.x(), P1.y());
    t2.rotate(theFrame->rotation());
    QPointF P3t = t2.map(P3);
////    qDebug() << "P3t:" << P3t;      // OK

    graphicsSheet->addPoint("P3t", P3t);

    QTransform t3;
    t3.translate(P3t.x(), P3t.y());
    t3.rotate(-theFrame->rotation());
    t3.translate(-(P3t.x()), -(P3t.y()));

    QPointF newPos = t3.map(P1);
    QSizeF newSize = QSizeF(P2t.x(), P2t.y());

    graphicsSheet->addPoint("newPos", newPos);

    RectItem* item1 = new RectItem(QRectF(newPos.x(), newPos.y(), newSize.width(), newSize.height()));
    qreal angle = 30;
    QPointF center2 = QPointF(item1->rect().width() / 2, item1->rect().height() / 2);
    item1->setTransformOriginPoint(center2);
    item1->setRotation(angle);
    graphicsSheet->scene()->addItem(item1);

}
}
开发者ID:afester,项目名称:CodeSamples,代码行数:54,代码来源:main.cpp

示例4: myType

AREXPORT ArMapObject::ArMapObject(const char *type, 
					                        ArPose pose, 
                                  const char *description,
 		                              const char *iconName, 
                                  const char *name,
 		                              bool hasFromTo, 
                                  ArPose fromPose, 
                                  ArPose toPose) :
  myType((type != NULL) ? type : ""),
  myBaseType(),
  myName((name != NULL) ? name : "" ),
  myDescription((description != NULL) ? description : "" ),
  myPose(pose),
  myIconName((iconName != NULL) ? iconName : "" ),
  myHasFromTo(hasFromTo),
  myFromPose(fromPose),
  myToPose(toPose),
  myFromToSegments(),
  myStringRepresentation()
{
  if (myHasFromTo)
  {
    double angle = myPose.getTh();
    double sa = ArMath::sin(angle);
    double ca = ArMath::cos(angle);
    double fx = fromPose.getX();
    double fy = fromPose.getY();
    double tx = toPose.getX();
    double ty = toPose.getY();
    ArPose P0((fx*ca - fy*sa), (fx*sa + fy*ca));
    ArPose P1((tx*ca - fy*sa), (tx*sa + fy*ca));
    ArPose P2((tx*ca - ty*sa), (tx*sa + ty*ca));
    ArPose P3((fx*ca - ty*sa), (fx*sa + ty*ca));
    myFromToSegments.push_back(ArLineSegment(P0, P1));
    myFromToSegments.push_back(ArLineSegment(P1, P2));
    myFromToSegments.push_back(ArLineSegment(P2, P3));
    myFromToSegments.push_back(ArLineSegment(P3, P0));
  }
  else { // pose
    size_t whPos = myType.rfind("WithHeading");
    size_t whLen = 11;
    if (whPos > 0) {
      if (whPos == myType.size() - whLen) {
        myBaseType = myType.substr(0, whPos);
      }
    }
  } // end else pose

  IFDEBUG(
  ArLog::log(ArLog::Normal, 
             "ArMapObject::ctor() created %s (%s)",
             myName.c_str(), myType.c_str());
  );
开发者ID:eilo,项目名称:Evolucion-Artificial-y-Robotica-Autonoma-en-Robots-Pioneer-P3-DX,代码行数:53,代码来源:ArMapObject.cpp

示例5: test_Bbox_E3_operator_incr

void test_Bbox_E3_operator_incr()
{
    Point_E3d P1(-5,-4,-3);
    Point_E3d P2( 7, 6, 5);

    Bbox_E3d box(P1);
    box += P2;

    assert( box == Bbox_E3d(P1, P2) );

    assert( box.center() == Point_E3d(1,1,1) );
}
开发者ID:ghali,项目名称:DelCapo,代码行数:12,代码来源:test_e3.cpp

示例6: _getEdges

std::vector<sf::Vector2f> _getEdges(TPPLPoly& A)
{
	std::vector<sf::Vector2f> edges;
	for(unsigned int i=0; i < (A.GetNumPoints()+1) ; ++i)
	{
		sf::Vector2f P1( A[i].x, A[i].y);
		sf::Vector2f P2( A[(i+1)%A.GetNumPoints()].x, A[(i+1)%A.GetNumPoints()].y );

		edges.push_back( P2 - P1 );
	}
	return edges;
}
开发者ID:675492062,项目名称:NavMesh,代码行数:12,代码来源:GeneralPolygon.cpp

示例7: main

int main() {
__CPROVER_ASYNC_0:
    P0(0);
__CPROVER_ASYNC_1:
    P1(0);
__CPROVER_ASYNC_2:
    P2(0);
    __CPROVER_assume(__unbuffered_cnt==3);
    fence();
    // EXPECT:exists
    __CPROVER_assert(!(z==2 && __unbuffered_p1_r1==1 && __unbuffered_p1_r3==0), "Program was expected to be safe for PPC, model checker should have said NO.\nThis likely is a bug in the tool chain.");
    return 0;
}
开发者ID:sarnold,项目名称:cbmc,代码行数:13,代码来源:safe026.c

示例8: P1

bool CSPrimBox::Write2XML(TiXmlElement &elem, bool parameterised)
{
    CSPrimitives::Write2XML(elem,parameterised);

    TiXmlElement P1("P1");
    m_Coords[0].Write2XML(&P1,parameterised);
    elem.InsertEndChild(P1);

    TiXmlElement P2("P2");
    m_Coords[1].Write2XML(&P2,parameterised);
    elem.InsertEndChild(P2);
    return true;
}
开发者ID:koendv,项目名称:CSXCAD,代码行数:13,代码来源:CSPrimBox.cpp

示例9: main

int main() {

  GlobalPoint P1(3., 4., 7.);
  GlobalPoint P2(-2., 5., 7.);

  oldCode(P1,P2);
  newCode(P1,P2);

  oldCode(P2,P1);
  newCode(P2,P1);


  return 0;
}
开发者ID:12345ieee,项目名称:cmg-cmssw,代码行数:14,代码来源:PixelTriplets_InvPrbl_t.cpp

示例10: test_mixed_of

void test_mixed_of()
{
    typedef boost::geometry::model::polygon<P1> polygon_type1;
    typedef boost::geometry::model::polygon<P2> polygon_type2;
    typedef boost::geometry::model::box<P1> box_type1;
    typedef boost::geometry::model::box<P2> box_type2;

    polygon_type1 poly1, poly2;
    boost::geometry::read_wkt("POLYGON((0 0,0 5,5 5,5 0,0 0))", poly1);
    boost::geometry::read_wkt("POLYGON((0 0,0 5,5 5,5 0,0 0))", poly2);

    box_type1 box1(P1(1, 1), P1(4, 4));
    box_type2 box2(P2(0, 0), P2(5, 5));
    P1 p1(3, 3);
    P2 p2(3, 3);

    BOOST_CHECK_EQUAL(bg::covered_by(p1, poly2), true);
    BOOST_CHECK_EQUAL(bg::covered_by(p2, poly1), true);
    BOOST_CHECK_EQUAL(bg::covered_by(p2, box1), true);
    BOOST_CHECK_EQUAL(bg::covered_by(p1, box2), true);
    BOOST_CHECK_EQUAL(bg::covered_by(box1, box2), true);
    BOOST_CHECK_EQUAL(bg::covered_by(box2, box1), false);
}
开发者ID:ArkanaLord,项目名称:libboost,代码行数:23,代码来源:covered_by.cpp

示例11: test_op

void test_op()
{
    Point_E3d  P1(3.0,4.0,5.0);
    Point_E3d  P2(4.0,7.0,9.0);
    Vector_E3d V1(8.0,4.0,2.0);

    Point_E3d A1 = P1;
    A1 += V1;
    assert( Point_E3d(11.0,8.0,7.0) == A1 );
    A1 -= V1;
    assert( P1 == A1 );

    Vector_E3d V2(P1, P2);
    assert( Vector_E3d(1.0, 3.0, 4.0) == V2 );
}
开发者ID:ghali,项目名称:DelCapo,代码行数:15,代码来源:test_e3.cpp

示例12: P0

Point Rectangle::Sample(float u, float v, Normal *Ns) const {

    // u and v are random samples on the surface of the light source
    Point P0(-x/2, y/2, height), P1(x/2, y/2, height);
    Point P2(-x/2, -y/2, height), P3(x/2, -y/2, height);

    Point p = P0 + (P1 - P0) * u + (P2 - P0) * v;

    Normal n = Normal(Cross(P2-P0, P1-P0));
    *Ns = Normalize(n);

    // NORMAL ON THE PLANE
    *Ns = Normalize((*ObjectToWorld)(n));
    if (ReverseOrientation) *Ns *= -1.f;
    return (*ObjectToWorld)(p);
}
开发者ID:marwan-abdellah,项目名称:pbrt-v2,代码行数:16,代码来源:rectangle.cpp

示例13: test_rotation

void test_rotation()
{
    Point_E3d P1(1,2,3);

    Transformation_E3d T1(ROTATION,
                          Direction_E3d(3,4,5),
                          1.0);
    Point_E3d P2 = T1(P1);

    Transformation_E3d T2(ROTATION,
                          Direction_E3d(-3,-4,-5),
                          1.0);
    Point_E3d P3 = T2(P2);

    assert(P3 == P1);
}
开发者ID:ghali,项目名称:DelCapo,代码行数:16,代码来源:test_e3.cpp

示例14: test_Transformation_E3

void test_Transformation_E3()
{
    Point_E3d P1(5,7,9);
    Vector_E3d V1(11,13,17);

    Point_E3d P2 = P1 + V1;

    Transformation_E3d T(ORTHOGONAL, Point_E3d(4,5,6), Point_E3d(7,8,9));

    Point_E3d P1t = T(P1);
    Vector_E3d V1t = T(V1);

    Point_E3d P2t = T(P2);

    assert( P2t == P1t + V1t );
}
开发者ID:ghali,项目名称:DelCapo,代码行数:16,代码来源:test_e3.cpp

示例15: unrotatedSizeHint

QPolygon KDChart::TextLayoutItem::rotatedCorners() const
{
    // the angle in rad
    const qreal angle = mAttributes.rotation() * PI / 180.0;
    QSize size = unrotatedSizeHint();

    // my P1 - P4 (the four points of the rotated area)
    QPointF P1( size.height() * sin( angle ), 0 );
    QPointF P2( size.height() * sin( angle ) + size.width() * cos( angle ), size.width() * sin( angle ) );
    QPointF P3( size.width() * cos( angle ), size.width() * sin( angle ) + size.height() * cos( angle ) );
    QPointF P4( 0, size.height() * cos( angle ) );

    QPolygon result;
    result << P1.toPoint() << P2.toPoint() << P3.toPoint() << P4.toPoint();
    return result;
}
开发者ID:CGenie,项目名称:kmymoney,代码行数:16,代码来源:KDChartLayoutItems.cpp


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