Esempio n. 1
0
  void addWeighted(WpointVector &list,ConvexDecompInterface *callback)
  {

    Wpoint p1(mP1,mC1);
    Wpoint p2(mP2,mC2);
    Wpoint p3(mP3,mC3);

		Vector3d d1 = mNear1 - mP1;
		Vector3d d2 = mNear2 - mP2;
		Vector3d d3 = mNear3 - mP3;

		d1*=WSCALE;
		d2*=WSCALE;
		d3*=WSCALE;

		d1 = d1 + mP1;
		d2 = d2 + mP2;
 	  d3 = d3 + mP3;

    Wpoint p4(d1,mC1);
    Wpoint p5(d2,mC2);
    Wpoint p6(d3,mC3);

    list.push_back(p1);
    list.push_back(p2);
    list.push_back(p3);

    list.push_back(p4);
    list.push_back(p5);
    list.push_back(p6);

#if 0
		callback->ConvexDebugPoint(mP1.Ptr(),0.01f,0x00FF00);
		callback->ConvexDebugPoint(mP2.Ptr(),0.01f,0x00FF00);
		callback->ConvexDebugPoint(mP3.Ptr(),0.01f,0x00FF00);
		callback->ConvexDebugPoint(d1.Ptr(),0.01f,0xFF0000);
		callback->ConvexDebugPoint(d2.Ptr(),0.01f,0xFF0000);
		callback->ConvexDebugPoint(d3.Ptr(),0.01f,0xFF0000);

		callback->ConvexDebugTri(mP1.Ptr(), d1.Ptr(),  d1.Ptr(),0x00FF00);
		callback->ConvexDebugTri(mP2.Ptr(), d2.Ptr(),  d2.Ptr(),0x00FF00);
		callback->ConvexDebugTri(mP3.Ptr(), d3.Ptr(),  d3.Ptr(),0x00FF00);

		Vector3d np1 = mP1 + mNormal*0.05f;
		Vector3d np2 = mP2 + mNormal*0.05f;
		Vector3d np3 = mP3 + mNormal*0.05f;

		callback->ConvexDebugTri(mP1.Ptr(), np1.Ptr(), np1.Ptr(), 0xFF00FF );
		callback->ConvexDebugTri(mP2.Ptr(), np2.Ptr(), np2.Ptr(), 0xFF00FF );
		callback->ConvexDebugTri(mP3.Ptr(), np3.Ptr(), np3.Ptr(), 0xFF00FF );

		callback->ConvexDebugPoint( np1.Ptr(), 0.01F, 0XFF00FF );
		callback->ConvexDebugPoint( np2.Ptr(), 0.01F, 0XFF00FF );
		callback->ConvexDebugPoint( np3.Ptr(), 0.01F, 0XFF00FF );

#endif



  }
Esempio n. 2
0
int main()
{
    FitParameter p0 (2,0.2,"0p2",0.2,0.2,0.2,0.2);
    FitParameter p1 (3,0.3,"0p3",0.3,0.3,0.3,0.3);

    std::cout << "Before"
            << "\n" << p0
            << "\n" << p1
            << std::endl;

    p0.swap(p1);

    std::cout << "After"
            << "\n" << p0
            << "\n" << p1
            << std::endl;


    Parameter p5 (5,0.5,"0p5",0.5);
    Parameter p6 (6,0.6,"0p6",0.6);

    std::cout << "Before"
            << "\n" << p5
            << "\n" << p6
            << std::endl;

    p5.swap(p6);

    std::cout << "After"
            << "\n" << p5
            << "\n" << p6
            << std::endl;

    std::cout << "////////////////////////" << std::endl;
    std::cout << "Parameters"  << std::endl;

    Parameters pars0;
    pars0.AddParameter(p0);
    pars0.AddParameter(p1);

    Parameters pars1;
    pars1.AddParameter(p5);
    pars1.AddParameter(p6);

    std::cout << "Before"
            << "\n" << pars0
            << "\n" << pars1
            << std::endl;

    pars0.swap(pars1);

    std::cout << "After"
            << "\n" << pars0
            << "\n" << pars1
            << std::endl;



    return 0;
}
Esempio n. 3
0
int main()
{
  // Construct an arrangement of seven intersecting line segments.
  Point_2 p1(1, 1), p2(1, 4), p3(2, 2), p4(3, 7), p5(4, 4), p6(7, 1), p7(9, 3);
  Ex_arrangement  arr;
  insert(arr, Segment_2(p1, p6));
  insert(arr, Segment_2(p1, p4));  insert(arr, Segment_2(p2, p6));
  insert(arr, Segment_2(p3, p7));  insert(arr, Segment_2(p3, p5));
  insert(arr, Segment_2(p6, p7));  insert(arr, Segment_2(p4, p7));

  // Create a mapping of the arrangement faces to indices.
  Face_index_map  index_map(arr);

  // Perform breadth-first search from the unbounded face, using the event
  // visitor to associate each arrangement face with its discover time.
  unsigned int    time = 0;
  boost::breadth_first_search(Dual_arrangement(arr), arr.unbounded_face(),
                              boost::vertex_index_map(index_map).visitor
                              (boost::make_bfs_visitor
                               (stamp_times(Face_property_map(), time,
                                            boost::on_discover_vertex()))));

  // Print the discover time of each arrangement face.
  Ex_arrangement::Face_iterator  fit;
  for (fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) {
    std::cout << "Discover time " << fit->data() << " for ";
    if (fit != arr.unbounded_face()) {
      std::cout << "face ";
      print_ccb<Ex_arrangement>(fit->outer_ccb());
    }
    else std::cout << "the unbounded face." << std::endl;
  }
  return 0;
}
Esempio n. 4
0
void Bezier::split(double t, Bezier & left, Bezier & right) const
{
	// http://processingjs.nihongoresources.com/bezierinfo/sketchsource.php?sketch=CubicDeCasteljau

	// interpolate from 4 to 3 points
	QPointF p5((1-t)*m_endpoint0.x() + t*m_cp0.x(), (1-t)*m_endpoint0.y() + t*m_cp0.y());
	QPointF p6((1-t)*m_cp0.x() + t*m_cp1.x(), (1-t)*m_cp0.y() + t*m_cp1.y());
	QPointF p7((1-t)*m_cp1.x() + t*m_endpoint1.x(), (1-t)*m_cp1.y() + t*m_endpoint1.y());

	// interpolate from 3 to 2 points
	QPointF p8((1-t)*p5.x() + t*p6.x(), (1-t)*p5.y() + t*p6.y());
	QPointF p9((1-t)*p6.x() + t*p7.x(), (1-t)*p6.y() + t*p7.y());

	// interpolate from 2 points to 1 point
	QPointF p10((1-t)*p8.x() + t*p9.x(), (1-t)*p8.y() + t*p9.y());

	// we now have all the values we need to build the subcurves
	left.m_endpoint0 = m_endpoint0;
	left.m_cp0 = p5;
	left.m_cp1 = p8;
	right.m_endpoint0 = left.m_endpoint1 = p10;
	right.m_cp0 = p9;
	right.m_cp1 = p7;
	right.m_endpoint1 = m_endpoint1;
	left.m_isEmpty = right.m_isEmpty = false;
} 
Esempio n. 5
0
BDic* find_nodeQueryPacket(char node[20], char target[20]) {


    BDic* res = neutralPacket();

    BString* a3a = new BString ("q");
    BString* a3b = new BString ("find_node");;
    std::pair<BString*, Bencodable *> p3(a3a, a3b);
    res->push_back(p3);

    BString* a4a = new BString ("a");
    BDic* a4b = new BDic;

    BString* a5a = new BString ("id");
    BString* a5b = new BString (node);
    std::pair<BString*, Bencodable *> p5(a5a, a5b);
    a4b->push_back(p5);

    BString* a6a = new BString ("target");
    BString* a6b = new BString (target);
    std::pair<BString*, Bencodable *> p6(a6a, a6b);
    a4b->push_back(p6);

    std::pair<BString*, Bencodable *> p4(a4a, a4b);
    res->push_back(p4);


    return res;

}
Esempio n. 6
0
mininode_geometry_pyramid::mininode_geometry_pyramid(double sizex,double sizey,double sizez)
   : mininode_geometry(0,3,0)
   {
   miniv3d p1(-sizex/2,-sizey/2,0);
   miniv3d p2(sizex/2,-sizey/2,0);
   miniv3d p3(-sizex/2,sizey/2,0);
   miniv3d p4(sizex/2,sizey/2,0);
   miniv3d p5(0,0,sizez);

   // sides
   setnrm(p1,p2,p5);
   addvtx(p5);
   addvtx(p1);
   addvtx(p2);
   setnrm(p2,p4,p5);
   addvtx(p2);
   addvtx(p5);
   addvtx(p4);
   setnrm(p4,p3,p5);
   addvtx(p4);
   addvtx(p3);
   addvtx(p5);
   setnrm(p3,p1,p5);
   addvtx(p5);
   addvtx(p1);
   addvtx(p3);

   // bottom
   setnrm(miniv3d(0,0,-1));
   addvtx(p3);
   addvtx(p4);
   addvtx(p1);
   addvtx(p2);
   }
Esempio n. 7
0
void measurement_overhead() {
    printf("Measurement, 0, 0\n");

    PM("","RDTSC, "O_STR);

    #define FOR_MEAS for (int k = 0; k < 100; ++k) { ; }
    double m; uint64_t med, se, min, max;
    measure(FOR_MEAS,m,med,se,min,max,10000);
    printf("Loop, "O_STR, m/100, med/100, se/100, min/100, max/100);

    printf("Function Calls, 0, 0\n");

    PM_COUNT(p0(), "p0, "O_STR,1000000);

    PM_COUNT(p1(1), "p1, "O_STR,1000000);

    PM_COUNT(p2(1,2), "p2, "O_STR,1000000);

    PM_COUNT(p3(1,2,3), "p3, "O_STR,1000000);

    PM_COUNT(p4(1,2,3,4), "p4, "O_STR,1000000);

    PM_COUNT(p5(1,2,3,4,5), "p5, "O_STR,1000000);

    PM_COUNT(p6(1,2,3,4,5,6), "p6, "O_STR,1000000);

    PM_COUNT(p7(1,2,3,4,5,6,7), "p7, "O_STR,1000000);
}
Esempio n. 8
0
int main(void)
{
  printf("Entering 100 iterations of incrementing pose X and Y and decrementing Theta...");
  for (int i = 0; i < 100; i++)
    fn2(fn1());

  printf("\nTesting ArPose::operator+(const ArPose&) and ArPose::operator-(const ArPose&)...\n");
  ArPose p1(10, 10, 90);
  ArPose p2(10, 10, 45);
  ArPose p3(0, 0, 0);
  ArPose p4(-20, 0, 360);
  ArPose p5(-20, -20, -180);
  printf("(10,10,90) + (10,10,90) => ");
  (p1 + p1).log();
  printf("(10,10,90) - (10,10,90) => ");
  (p1 - p1).log();
  printf("(10,10,90) + (10,10,45) => ");
  (p1 + p2).log();
  printf("(10,10,90) + (0,0,0) => ");
  (p1 + p3).log();
  printf("(10,10,90) - (0,0,0) => ");
  (p1 - p3).log();
  printf("(0,0,0) + (-20,0,360) => ");
  (p3 + p4).log();
  printf("(0,0,0) - (-20,0,360) => ");
  (p3 - p4).log();
  printf("(10,10,90) + (-20,0,360) => ");
  (p1 + p4).log();
  printf("(-20,0,360) + (-20,0,360) => ");
  (p4 + p4).log();
  printf("(-20,-20,-180) - (10,10,45) => ");
  (p5 - p2).log();

}
Esempio n. 9
0
void testSharedArrayPtr()
{
    Monkey::numConstructions = 0;
    Monkey::numDestructions = 0;

    {
        SharedArrayPtr<Monkey> p1(new Monkey[3]);

        PEGASUS_TEST_ASSERT(Monkey::numConstructions == 3);
        PEGASUS_TEST_ASSERT(Monkey::numDestructions == 0);

        SharedArrayPtr<Monkey> p5(new Monkey[2]);
        p1 = p5;

        PEGASUS_TEST_ASSERT(Monkey::numConstructions == 5);
        PEGASUS_TEST_ASSERT(Monkey::numDestructions == 3);

        PEGASUS_TEST_ASSERT(p1[0].index == p5[0].index);
        PEGASUS_TEST_ASSERT(p1[1].index == p5[1].index);
        PEGASUS_TEST_ASSERT(p1[0].index != p1[1].index);
    }

    PEGASUS_TEST_ASSERT(Monkey::numConstructions == 5);
    PEGASUS_TEST_ASSERT(Monkey::numDestructions == 5);
}
Esempio n. 10
0
void dgCollisionSphere::DebugCollision (const dgMatrix& matrix, dgCollision::OnDebugCollisionMeshCallback callback, void* const userData) const
{
	dgTriplex pool[1024 * 2];
	dgVector tmpVectex[1024 * 2];

	dgVector p0 ( dgFloat32 (1.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f)); 
	dgVector p1 (-dgFloat32 (1.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f)); 
	dgVector p2 ( dgFloat32 (0.0f), dgFloat32 (1.0f), dgFloat32 (0.0f), dgFloat32 (0.0f)); 
	dgVector p3 ( dgFloat32 (0.0f),-dgFloat32 (1.0f), dgFloat32 (0.0f), dgFloat32 (0.0f));
	dgVector p4 ( dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (1.0f), dgFloat32 (0.0f));
	dgVector p5 ( dgFloat32 (0.0f), dgFloat32 (0.0f),-dgFloat32 (1.0f), dgFloat32 (0.0f));

	dgInt32 i = 3;
	dgInt32 count = 0;
	TesselateTriangle (i, p4, p0, p2, count, tmpVectex);
	TesselateTriangle (i, p4, p2, p1, count, tmpVectex);
	TesselateTriangle (i, p4, p1, p3, count, tmpVectex);
	TesselateTriangle (i, p4, p3, p0, count, tmpVectex);
	TesselateTriangle (i, p5, p2, p0, count, tmpVectex);
	TesselateTriangle (i, p5, p1, p2, count, tmpVectex);
	TesselateTriangle (i, p5, p3, p1, count, tmpVectex);
	TesselateTriangle (i, p5, p0, p3, count, tmpVectex);

	for (dgInt32 i = 0; i < count; i ++) {
		tmpVectex[i] = tmpVectex[i].Scale4 (m_radius);
	}

	//dgMatrix matrix (GetLocalMatrix() * matrixPtr);
	matrix.TransformTriplex (&pool[0].m_x, sizeof (dgTriplex), &tmpVectex[0].m_x, sizeof (dgVector), count);
	for (dgInt32 i = 0; i < count; i += 3) {
		callback (userData, 3, &pool[i].m_x, 0);
	}
}
Esempio n. 11
0
dgInt32 dgConvexHull4d::BuildNormalList (dgBigVector* const normalArray) const
{
	dgVector p0 ( dgFloat32 (1.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f)); 
	dgVector p1 (-dgFloat32 (1.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f)); 
	dgVector p2 ( dgFloat32 (0.0f), dgFloat32 (1.0f), dgFloat32 (0.0f), dgFloat32 (0.0f)); 
	dgVector p3 ( dgFloat32 (0.0f),-dgFloat32 (1.0f), dgFloat32 (0.0f), dgFloat32 (0.0f));
	dgVector p4 ( dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (1.0f), dgFloat32 (0.0f));
	dgVector p5 ( dgFloat32 (0.0f), dgFloat32 (0.0f),-dgFloat32 (1.0f), dgFloat32 (0.0f));

	dgInt32 count = 0;
	dgInt32 subdivitions = 1;

	dgInt32 start = 0;
	TessellateTriangle  (subdivitions, p4, p0, p2, count, normalArray, start);
	start = 1;
	TessellateTriangle  (subdivitions, p5, p3, p1, count, normalArray, start);
	start = 2;
	TessellateTriangle  (subdivitions, p5, p1, p2, count, normalArray, start);
	start = 3;
	TessellateTriangle  (subdivitions, p4, p3, p0, count, normalArray, start);
	start = 4;
	TessellateTriangle  (subdivitions, p4, p2, p1, count, normalArray, start);
	start = 5;
	TessellateTriangle  (subdivitions, p5, p0, p3, count, normalArray, start);
	start = 6;
	TessellateTriangle  (subdivitions, p5, p2, p0, count, normalArray, start);
	start = 7;
	TessellateTriangle  (subdivitions, p4, p1, p3, count, normalArray, start);

	return count;
}
Esempio n. 12
0
int main( int argc, char *argv[] )
{
    if( argc < 2 || argc > 2)
   	{
        printf("Expecting one argument. Please try again\n");
   	}
    else if(argc==2)
    {
        if(atoi(argv[1])==1)
        {
            p1();
        }
        else if(atoi(argv[1])==2)
        {
            p2();
        }
        else if(atoi(argv[1])==3)
        {
            p3();
        }
        else if(atoi(argv[1])==4)
        {
            p4();
        }
        else if(atoi(argv[1])==5)
        {
            p5();
        }
        else
        {
            printf("Incorrect argument supplied.\n");
        }
    }
}
Esempio n. 13
0
    PrimitiveParts cubePrimitive(float width, float height, float depth)
    {
        float hx = width / 2;
        float hy = height / 2;
        float hz = depth / 2;

        // create the vertices
        Point3 p0(hx,hy,hz);
        Point3 p1(hx,hy,-hz);
        Point3 p2(-hx,hy,-hz);
        Point3 p3(-hx,hy,hz);
        Point3 p4(hx,-hy,hz);
        Point3 p5(hx,-hy,-hz);
        Point3 p6(-hx,-hy,-hz);
        Point3 p7(-hx,-hy,hz);

        QList<int> f0 = QList<int>() << 0 << 1 << 2 << 3;
        QList<int> f1 = QList<int>() << 4 << 5 << 1 << 0;
        QList<int> f2 = QList<int>() << 6 << 2 << 1 << 5;
        QList<int> f3 = QList<int>() << 7 << 3 << 2 << 6;
        QList<int> f4 = QList<int>() << 7 << 4 << 0 << 3;
        QList<int> f5 = QList<int>() << 4 << 7 << 6 << 5;

        PrimitiveParts parts;
        parts.points = QVector<Point3>() << p0 << p1 << p2 << p3 << p4 << p5 << p6 << p7;
        parts.faces = QVector<QList<int> >() << f0 << f1 << f2 << f3 << f4 << f5;
        return parts;
    }
Esempio n. 14
0
std::vector<Eigen::Vector2i> PathPlanner::getNeighbours(Eigen::Vector2i p)
{
    Eigen::Vector2i p0(p(0) + 1, p(1));
    Eigen::Vector2i p1(p(0) - 1, p(1));
    Eigen::Vector2i p2(p(0), p(1) + 1);
    Eigen::Vector2i p3(p(0), p(1) - 1);

    Eigen::Vector2i p4(p(0) + 1, p(1) + 1);
    Eigen::Vector2i p5(p(0) - 1, p(1) - 1);
    Eigen::Vector2i p6(p(0) - 1, p(1) + 1);
    Eigen::Vector2i p7(p(0) + 1, p(1) - 1);

    std::vector<Eigen::Vector2i> points;

    if(validPoint(p0))
        points.push_back(p0);
    if(validPoint(p1))
        points.push_back(p1);
    if(validPoint(p2))
        points.push_back(p2);
    if(validPoint(p3))
        points.push_back(p3);

    //Disallow walking through diagonal cracks
    if(validPoint(p4) && (validPoint(p0) || validPoint(p2)))
        points.push_back(p4);
    if(validPoint(p5) && (validPoint(p1) || validPoint(p3)))
        points.push_back(p5);
    if(validPoint(p6) && (validPoint(p1) || validPoint(p2)))
        points.push_back(p6);
    if(validPoint(p7) && (validPoint(p0) || validPoint(p3)))
        points.push_back(p7);

    return points;
}
Esempio n. 15
0
void CTest::x_TestPathes()
{
    CNcbiDiag p1( CDiagCompileInfo("somewhere/cpp/src/corelib/file.cpp", 0, 
                                   NCBI_CURRENT_FUNCTION) );
    CNcbiDiag p2( CDiagCompileInfo("somewhere/include/corelib/file.cpp", 0, 
                                   NCBI_CURRENT_FUNCTION) );
    CNcbiDiag p3( CDiagCompileInfo("somewhere/cpp/src/corelib/int/file.cpp", 0, 
                                   NCBI_CURRENT_FUNCTION) );
    CNcbiDiag p4( CDiagCompileInfo("somewhere/include/corelib/int/file.cpp", 0,
                                   NCBI_CURRENT_FUNCTION) );
    CNcbiDiag p5( CDiagCompileInfo("somewhere/foo/corelib/file.cpp", 0,
                                   NCBI_CURRENT_FUNCTION) );

    m_Diags.push_back(&p1);
    m_Diags.push_back(&p2);
    m_Diags.push_back(&p3);
    m_Diags.push_back(&p4);
    m_Diags.push_back(&p5);

    NcbiCout << "Testing file paths" << NcbiEndl;
    {
        int expects[] = { 1, 1, 1, 1, 0 };
        x_TestString( "/corelib", expects );
    }
    {
        int expects[] = { 1, 1, 0, 0, 0 };
        x_TestString( "/corelib/", expects );
    }
    {
        int expects[] = { 0, 0, 1, 1, 0 };
        x_TestString( "/corelib/int", expects );
    }

    m_Diags.clear();
}
Esempio n. 16
0
int main()
{
    vec v1(1, 1), v2(0, 2);
    cout << "vec1(1,1) cross vec2(0,2): " << cross(v1, v2) << endl << endl;
    node p0(0, 0), p1(0, 1), p2(1, 2), p3(2, 1), p4(2, 0), p5(1, 0), p6(1, 1);
    node s[7];
    s[0] = p4, s[1] = p3, s[2] = p2, s[3] = p1, s[4] = p0, s[5] = p5, s[6] = p6;
    segment l0(p0, p3), l1(p5, p6), l2(p6, p4), l3(p1, p2);
    test_segment(l0, l1);
    test_segment(l1, l2);
    test_segment(l0, l3);

    segment ll[4];
    ll[0] = l0, ll[1] = l1, ll[2] = l2, ll[3] = l3;
    for(int i = 0; i < 4; ++ i) {
        ll[i].s_lt.n_idx = i;
        ll[i].s_rt.n_idx = i;
        ll[i].s_lt.n_lt = 1;
        ll[i].s_rt.n_lt = 0;
    }
    cout << "sweeping:" << endl;
    for(int i = 0; i < 4; ++ i)
        ll[i].s_print();
    if(sweeping(ll, 4))
        cout << "yes" << endl;
    else
        cout << "no" << endl;

    return(0);
}
Esempio n. 17
0
static void tst6() {
    params_ref      ps;
    reslimit        rlim;
    nlsat::solver s(rlim, ps);
    anum_manager & am     = s.am();
    nlsat::pmanager & pm  = s.pm();
    nlsat::assignment as(am);
    nlsat::explain& ex    = s.get_explain();
    nlsat::var x0, x1, x2, a, b, c, d;
    a  = s.mk_var(false);
    b  = s.mk_var(false);
    c  = s.mk_var(false);
    d  = s.mk_var(false);
    x0 = s.mk_var(false);
    x1 = s.mk_var(false);
    x2 = s.mk_var(false);

    polynomial_ref p1(pm), p2(pm), p3(pm), p4(pm), p5(pm);
    polynomial_ref _x0(pm), _x1(pm), _x2(pm);
    polynomial_ref _a(pm), _b(pm), _c(pm), _d(pm);
    _x0 = pm.mk_polynomial(x0);
    _x1 = pm.mk_polynomial(x1);
    _x2 = pm.mk_polynomial(x2);
    _a  = pm.mk_polynomial(a);
    _b  = pm.mk_polynomial(b);
    _c  = pm.mk_polynomial(c);
    _d  = pm.mk_polynomial(d);

    p1 = (_a*(_x0^2)) + _x2 + 2;
    p2 = (_b*_x1) - (2*_x2) - _x0 + 8;
    nlsat::scoped_literal_vector lits(s);
    lits.push_back(mk_gt(s, p1));
    lits.push_back(mk_gt(s, p2));
    lits.push_back(mk_gt(s, (_c*_x0) + _x2 + 1));
    lits.push_back(mk_gt(s, (_d*_x0) - _x1 + 5*_x2));

    scoped_anum zero(am), one(am), two(am);
    am.set(zero, 0);
    am.set(one,  1);
    am.set(two,  2);
    as.set(0, one);
    as.set(1, one);
    as.set(2, two);
    as.set(3, two);
    as.set(4, two);
    as.set(5, one);
    as.set(6, one);
    s.set_rvalues(as);


    project(s, ex, x0, 2, lits.c_ptr());
    project(s, ex, x1, 3, lits.c_ptr());
    project(s, ex, x2, 3, lits.c_ptr());
    project(s, ex, x2, 2, lits.c_ptr());
    project(s, ex, x2, 4, lits.c_ptr());
    project(s, ex, x2, 3, lits.c_ptr()+1);


}
Esempio n. 18
0
void generateTriPrism(GLuint program, ShapeData* triPrismData)
{
	int Index = 0;
	point3 p1(1.0f, -0.5f, 0.0f);
	point3 p2(0.0f, -0.5f, 0.0f);
	point3 p3(0.0f, -0.5f, 1.0f);
	point3 p4(1.0f,  0.5f, 0.0f);
	point3 p5(0.0f,  0.5f, 0.0f);
	point3 p6(0.0f,  0.5f, 1.0f);

	// Bottom of the triangular prism
	triPrismPoints[Index] = p1; triPrismNormals[Index] = point3(0.0f, -1.0f, 0.0f); Index++;
	triPrismPoints[Index] = p3; triPrismNormals[Index] = point3(0.0f, -1.0f, 0.0f); Index++;
	triPrismPoints[Index] = p2; triPrismNormals[Index] = point3(0.0f, -1.0f, 0.0f); Index++;

	// Top of the triangular prism
	triPrismPoints[Index] = p4; triPrismNormals[Index] = point3(0.0f, 1.0f, 0.0f); Index++;
	triPrismPoints[Index] = p5; triPrismNormals[Index] = point3(0.0f, 1.0f, 0.0f); Index++;
	triPrismPoints[Index] = p6; triPrismNormals[Index] = point3(0.0f, 1.0f, 0.0f); Index++;

	// Back of the triangular prism
	triPrismPoints[Index] = p1; triPrismNormals[Index] = point3(0.0f, 0.0f, -1.0f); Index++;
	triPrismPoints[Index] = p2; triPrismNormals[Index] = point3(0.0f, 0.0f, -1.0f); Index++;
	triPrismPoints[Index] = p4; triPrismNormals[Index] = point3(0.0f, 0.0f, -1.0f); Index++;

	triPrismPoints[Index] = p2; triPrismNormals[Index] = point3(0.0f, 0.0f, -1.0f); Index++;
	triPrismPoints[Index] = p5; triPrismNormals[Index] = point3(0.0f, 0.0f, -1.0f); Index++;
	triPrismPoints[Index] = p4; triPrismNormals[Index] = point3(0.0f, 0.0f, -1.0f); Index++;

	// Left of the triangular prism
	triPrismPoints[Index] = p2; triPrismNormals[Index] = point3(-1.0f, 0.0f, 0.0f); Index++;
	triPrismPoints[Index] = p3; triPrismNormals[Index] = point3(-1.0f, 0.0f, 0.0f); Index++;
	triPrismPoints[Index] = p6; triPrismNormals[Index] = point3(-1.0f, 0.0f, 0.0f); Index++;

	triPrismPoints[Index] = p2; triPrismNormals[Index] = point3(-1.0f, 0.0f, 0.0f); Index++;
	triPrismPoints[Index] = p6; triPrismNormals[Index] = point3(-1.0f, 0.0f, 0.0f); Index++;
	triPrismPoints[Index] = p5; triPrismNormals[Index] = point3(-1.0f, 0.0f, 0.0f); Index++;

	// Front of the triangular prism
	triPrismPoints[Index] = p1; triPrismNormals[Index] = point3(1.0f, 0.0f, 1.0f); Index++;
	triPrismPoints[Index] = p6; triPrismNormals[Index] = point3(1.0f, 0.0f, 1.0f); Index++;
	triPrismPoints[Index] = p3; triPrismNormals[Index] = point3(1.0f, 0.0f, 1.0f); Index++;

	triPrismPoints[Index] = p1; triPrismNormals[Index] = point3(1.0f, 0.0f, 1.0f); Index++;
	triPrismPoints[Index] = p4; triPrismNormals[Index] = point3(1.0f, 0.0f, 1.0f); Index++;
	triPrismPoints[Index] = p6; triPrismNormals[Index] = point3(1.0f, 0.0f, 1.0f); Index++;

    triPrismData->numVertices = numTriPrismVertices;

    glGenVertexArrays( 1, &triPrismData->vao );
    glBindVertexArray( triPrismData->vao );

    setVertexAttrib(program,
    				(float*)triPrismPoints, sizeof(triPrismPoints),
    				(float*)triPrismNormals, sizeof(triPrismNormals),
    				0, 0);
}
Esempio n. 19
0
static void tst7() {
    params_ref      ps;
    reslimit        rlim;
    nlsat::solver s(rlim, ps);
    anum_manager & am     = s.am();
    nlsat::pmanager & pm  = s.pm();
    nlsat::var x0, x1, x2, a, b, c, d;
    a  = s.mk_var(false);
    b  = s.mk_var(false);
    c  = s.mk_var(false);
    d  = s.mk_var(false);
    x0 = s.mk_var(false);
    x1 = s.mk_var(false);
    x2 = s.mk_var(false);
    polynomial_ref p1(pm), p2(pm), p3(pm), p4(pm), p5(pm);
    polynomial_ref _x0(pm), _x1(pm), _x2(pm);
    polynomial_ref _a(pm), _b(pm), _c(pm), _d(pm);
    _x0 = pm.mk_polynomial(x0);
    _x1 = pm.mk_polynomial(x1);
    _x2 = pm.mk_polynomial(x2);
    _a  = pm.mk_polynomial(a);
    _b  = pm.mk_polynomial(b);
    _c  = pm.mk_polynomial(c);
    _d  = pm.mk_polynomial(d);

    p1 = _x0 + _x1;
    p2 = _x2 - _x0;
    p3 = (-1*_x0) - _x1;

    nlsat::scoped_literal_vector lits(s);
    lits.push_back(mk_gt(s, p1));
    lits.push_back(mk_gt(s, p2));
    lits.push_back(mk_gt(s, p3));

    nlsat::literal_vector litsv(lits.size(), lits.c_ptr());
    lbool res = s.check(litsv);
    SASSERT(res == l_false);
    for (unsigned i = 0; i < litsv.size(); ++i) {
        s.display(std::cout, litsv[i]);
        std::cout << " ";
    }
    std::cout << "\n";

    litsv.reset();
    litsv.append(2, lits.c_ptr());
    res = s.check(litsv);
    SASSERT(res == l_true);
    s.display(std::cout);
    s.am().display(std::cout, s.value(x0));
    std::cout << "\n";
    s.am().display(std::cout, s.value(x1));
    std::cout << "\n";
    s.am().display(std::cout, s.value(x2));
    std::cout << "\n";

}
int pruebasOficiales()
{
    p1();
    p2();
    p3();
    p4a();
    p4b();
    p5();
    
    return 0;
}
void RectangleSlice::generateOuterWall45(int wall_width)
{
  
  Eigen::Rotation2D<float> R(0.7854);

  Eigen::Vector2f p0((LINE_WIDTH * 2 * wall_width), (LINE_WIDTH * 2 * wall_width));
  p0 = R * p0;

  
  moveToStart45();
  _width -= p0(0);
  _length -= p0(1);
  for(int i = 0; i < wall_width; i++)
  {
    Eigen::Vector2f p1(0.0, _width);
    Eigen::Vector2f p2(-_length, 0.0);
    Eigen::Vector2f p3(0.0, -_width);
    Eigen::Vector2f p4(_length, 0.0);

    Eigen::Vector2f p5(LINE_WIDTH, -LINE_WIDTH);
    Eigen::Vector2f p6((LINE_WIDTH * 2), (LINE_WIDTH * 2));
    
    
    p1 = R * p1;
    p2 = R * p2;
    p3 = R * p3;
    p4 = R * p4;
    p5 = R * p5;
    p6 = R * p6;

    _ph->extrudeAlongXYAxis(p1(0), p1(1));
    _ph->extrudeAlongXYAxis(p2(0), p2(1));
    _ph->extrudeAlongXYAxis(p3(0), p3(1));
    _ph->extrudeAlongXYAxis(p4(0), p4(1));
    _ph->moveAlongXYAxis(p5(0), p5(1));
    _width += p6(0);
    _length += p6(0);

  }
  _ph->moveZAxis();
}
Esempio n. 22
0
void KisNodeDelegate::drawFrame(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    KisNodeViewColorScheme scm;

    QPen oldPen = p->pen();
    p->setPen(scm.gridColor(option, d->view));

    const QPoint base = option.rect.topLeft();

    QPoint p2 = base + QPoint(-scm.indentation() - 1, 0);
    QPoint p3 = base + QPoint(-2 * scm.border() - 2 * scm.decorationMargin() - scm.decorationSize(), 0);
    QPoint p4 = base + QPoint(-1, 0);
    QPoint p5(iconsRect(option,
                           index).left() - 1, base.y());
    QPoint p6(option.rect.right(), base.y());

    QPoint v(0, option.rect.height());

    const bool paintForParent =
        index.parent().isValid() &&
        !index.row();

    if (paintForParent) {
        QPoint p1(-2 * scm.indentation() - 1, 0);
        p1 += base;
        p->drawLine(p1, p2);
    }


    QPoint k0(0, base.y());
    QPoint k1(1 * scm.border() + 2 * scm.visibilityMargin() + scm.visibilitySize(), base.y());
    p->drawLine(k0, k1);
    p->drawLine(k0 + v, k1 + v);
    p->drawLine(k0, k0 + v);
    p->drawLine(k1, k1 + v);

    p->drawLine(p2, p6);
    p->drawLine(p2 + v, p6 + v);
    p->drawLine(p2, p2 + v);
    p->drawLine(p3, p3 + v);
    p->drawLine(p4, p4 + v);
    p->drawLine(p5, p5 + v);
    p->drawLine(p6, p6 + v);

    //// For debugging purposes only
    //p->setPen(Qt::blue);
    //KritaUtils::renderExactRect(p, iconsRect(option, index));
    //KritaUtils::renderExactRect(p, textRect(option, index));
    //KritaUtils::renderExactRect(p, scm.relThumbnailRect().translated(option.rect.topLeft()));

    p->setPen(oldPen);
}
Esempio n. 23
0
int main()
{
  try
    {
      symbol k("k"),q("q"),p("p"),p1("p1"),p2("p2"),p3("p3"),ms("ms"),l("l"),s("s"),m1s("m1s"),m2s("m2s"),m3s("m3s");
      symbol l1("l1"),l2("l2"),l3("l3"),l4("l4"),t("t"),p4("p4"),p5("p5"),p6("p6"),tp("tp"),v1("v1"),v2("v2"),l5("l5");
      symbol k1("k1"),k2("k2"),k3("k3"),k4("k4"),k5("k5"),ms1("ms1"),ms2("ms2"),ms3("ms3"),ms4("ms4");
      symbol s12("s12"),s23("s23"),s34("s34"),s45("s45"),s51("s51"),s13("s13"),s15("s15"),s56("s56"),s16("s16"),s123("s123"),s234("s234"),s345("s345");
      lst inv_l;
      inv_l.append(p1*p1 == 0);
      inv_l.append( p2*p2 == 0);inv_l.append( p3*p3  ==  0);inv_l.append( p4*p4  ==  0);inv_l.append( p5*p5  ==  0);inv_l.append( p6*p6  ==  0);
      inv_l.append(p1* p2  ==  s12/2);inv_l.append( p2* p3  ==  s23/2);inv_l.append( p3* p4  ==  s34/2);inv_l.append( p4* p5  ==  s45/2);
      inv_l.append(p5* p6  ==  s56/2);inv_l.append( p1* p6  ==  s16/2);inv_l.append( p1* p3  ==  (-s12 + s123 - s23)/2);
      inv_l.append(p2* p4  ==  (-s23 + s234 - s34)/2);
      inv_l.append( p3* p5  ==  (-s34 + s345 - s45)/2);
      inv_l.append(p1* p4  ==  (-s123 + s23 - s234 + s56)/2);
      inv_l.append(p1* p5  ==  (-s16 + s234 - s56)/2);
      inv_l.append( p2* p5  ==  (s16 - s234 + s34 - s345)/2);
      inv_l.append( p2* p6  ==  (-s12 - s16 + s345)/2);
      inv_l.append( p3* p6  ==  (s12 - s123 - s345 + s45)/2);
      inv_l.append( p4* p6  ==  (s123 - s45 - s56)/2);
      
      
      RoMB_loop_by_loop hexag(lst(k1),
                              lst(-pow(p1 + k1,2),-pow(p1 + p2 + k1,2),
                                  -pow(p1 + p2 + p3 + k1,2),
                                  -pow(p1 + p2 + p3 + p4 + k1,2),
                                  -pow(p1+p2+p3+p4+p5+k1,2),-pow(k1,2)),
                              inv_l,
                              lst(1,1,1,1,1,1),true);
      hexag.integrate_map(lst(s12 == -1, s23 == -2, s34 == -3, s45 == -4, s56 == -5, s16 == -6, s123 == -7, s234 == -8, s345 == -9));
/*

 FRESULT for parameters: {s12==-1,s23==-2,s34==-3,s45==-4,s56==-5,s16==-6,s123==-7,s234==-8,s345==-9}
 
  FRESULT anl :           = -0.1955084880526298663-1/240*log(8)*log(6)+947/60480*log(2)^2-1/480*log(6)*log(4)+1/1080*log(3)*log(7)+131/7560*log(9)*log(2)+19/1260*log(9)^2-1/560*log(8)*log(4)+523/60480*log(3)^2-1/1080*log(7)*log(5)+41/4320*log(3)*log(5)-1/48*log(8)*log(5)-1/1080*log(7)*log(4)+22/945*log(6)*log(7)+19/3780*log(3)*log(4)+493/30240*Pi^2+43/1008*eps^(-2)+49/8640*log(5)^2-641/30240*log(2)*log(6)+1/1080*log(9)*log(5)-22/945*log(2)*log(7)+271/60480*log(4)^2-3/112*log(8)*log(3)-19/3780*log(9)*log(4)+1/1080*log(4)*log(5)-61/2520*log(9)*log(7)+61/5040*log(7)^2+1/168*log(3)*log(2)+1/168*log(8)*log(9)+13/3360*log(2)*log(4)-1/30240*(-1132.7960047725738361+576*log(8)-163*log(3)+264*log(9)+533*log(2)-479*log(6)-444*log(7)+271*log(4)-287*log(5))*eps^(-1)+47/1680*log(8)^2-17/1680*log(8)*log(2)+767/60480*log(6)^2-22/945*log(9)*log(6)-13/1890*log(3)*log(9)
   FRESULT num:           = 1.9907333428263254975E-4+(0.032177795803854872908)*eps^(-1)+(0.04265873015873015873)*eps^(-2)
    eps^-2 term: 43/1008 +/- 0
     eps^-1 term: 0.03746018534300839405-2/105*log(8)+163/30240*log(3)-11/1260*log(9)-533/30240*log(2)+479/30240*log(6)+37/2520*log(7)-271/30240*log(4)+41/4320*log(5) +/- 9.022403780167233619E-6
      eps^0 term: -0.1955084880526298663-1/240*log(8)*log(6)+947/60480*log(2)^2-1/480*log(6)*log(4)+1/1080*log(3)*log(7)+131/7560*log(9)*log(2)+19/1260*log(9)^2-1/560*log(8)*log(4)+523/60480*log(3)^2-1/1080*log(7)*log(5)+41/4320*log(3)*log(5)-1/48*log(8)*log(5)-1/1080*log(7)*log(4)+22/945*log(6)*log(7)+19/3780*log(3)*log(4)+493/30240*Pi^2+49/8640*log(5)^2-641/30240*log(2)*log(6)+1/1080*log(9)*log(5)-22/945*log(2)*log(7)+271/60480*log(4)^2-3/112*log(8)*log(3)-19/3780*log(9)*log(4)+1/1080*log(4)*log(5)-61/2520*log(9)*log(7)+61/5040*log(7)^2+1/168*log(3)*log(2)+1/168*log(8)*log(9)+13/3360*log(2)*log(4)+47/1680*log(8)^2-17/1680*log(8)*log(2)+767/60480*log(6)^2-22/945*log(9)*log(6)-13/1890*log(3)*log(9) +/- 1.04620404922048185285E-4
      */

    }
  catch(std::exception &p)
    {
      std::cerr<<"******************************************************************"<<endl;
      std::cerr<<"   >>>ERROR:  "<<p.what()<<endl;
      std::cerr<<"******************************************************************"<<endl;
      return 1;
    }
  return 0;
}
Esempio n. 24
0
void BBox::render()
{
	Vec3d p0(inf),
		p1(sup[0], inf[1], inf[2]),
		p2(sup[0], sup[1], inf[2]),
		p3(inf[0], sup[1], inf[2]),
		p4(inf[0], inf[1], sup[2]),
		p5(sup[0], inf[1], sup[2]),
		p6(sup),
		p7(inf[0], sup[1], sup[2]);
	glBegin(GL_LINES);

	glVertex3dv(&p0[0]);
	glVertex3dv(&p1[0]);

	glVertex3dv(&p1[0]);
	glVertex3dv(&p2[0]);

	glVertex3dv(&p2[0]);
	glVertex3dv(&p3[0]);

	glVertex3dv(&p3[0]);
	glVertex3dv(&p0[0]);

	glVertex3dv(&p4[0]);
	glVertex3dv(&p5[0]);

	glVertex3dv(&p5[0]);
	glVertex3dv(&p6[0]);

	glVertex3dv(&p6[0]);
	glVertex3dv(&p7[0]);

	glVertex3dv(&p7[0]);
	glVertex3dv(&p4[0]);

	glVertex3dv(&p0[0]);
	glVertex3dv(&p4[0]);

	glVertex3dv(&p1[0]);
	glVertex3dv(&p5[0]);

	glVertex3dv(&p2[0]);
	glVertex3dv(&p6[0]);

	glVertex3dv(&p3[0]);
	glVertex3dv(&p7[0]);

	glEnd();
}
Esempio n. 25
0
	void ExplosionSystem::addExplosion(glm::vec3 origin)
	{
		MistEffect *g_MistEffect = new MistEffect(150);
		MistEmitter *g_MistEmitter = new MistEmitter();

		BurstEffect *g_BurstEffect = new BurstEffect(40);
		BurstEmitter *g_BurstEmitter = new BurstEmitter();

		ShockwaveEffect *g_ShockwaveEffect = new ShockwaveEffect(1);
		ShockwaveEmitter *g_ShockwaveEmitter = new ShockwaveEmitter();

		FlashEffect *g_FlashEffect = new FlashEffect(5);
		FlashEmitter *g_FlashEmitter = new FlashEmitter();

		ExplosionSparksEffect *g_ExplosionSparksEffect = new ExplosionSparksEffect(40);
		ExplosionSparksEmitter *g_ExplosionSparksEmitter = new ExplosionSparksEmitter();

		DebrisEffect *g_DebrisEffect = new DebrisEffect(25);
		DebrisEmitter *g_DebrisEmitter = new DebrisEmitter();

		TrailSystem *g_TrailSystem = new TrailSystem(15, origin);


		g_MistEmitter->setOrigin(origin);
		g_BurstEmitter->setOrigin(origin);
		g_ShockwaveEmitter->setOrigin(origin);
		g_FlashEmitter->setOrigin(origin);
		g_ExplosionSparksEmitter->setOrigin(origin);
		g_DebrisEmitter->setOrigin(origin);

		std::pair <MistEffect, MistEmitter> p1 (*g_MistEffect, *g_MistEmitter);
		std::pair <BurstEffect, BurstEmitter> p2 (*g_BurstEffect, *g_BurstEmitter);
		std::pair <ShockwaveEffect, ShockwaveEmitter> p3 (*g_ShockwaveEffect, *g_ShockwaveEmitter);
		std::pair <FlashEffect, FlashEmitter> p4 (*g_FlashEffect, *g_FlashEmitter);
		std::pair <ExplosionSparksEffect, ExplosionSparksEmitter> p5 (*g_ExplosionSparksEffect, *g_ExplosionSparksEmitter);
		std::pair <DebrisEffect, DebrisEmitter> p6 (*g_DebrisEffect, *g_DebrisEmitter);

		MistVector.push_back(p1);
		BurstVector.push_back(p2);
		ShockwaveVector.push_back(p3);
		FlashVector.push_back(p4);
		SparksVector.push_back(p5);
		DebrisVector.push_back(p6);

		g_TrailSystem->setCamera(camera);
		g_TrailSystem->addTrails();
		TrailSystemVector.push_back(*g_TrailSystem);
	}
Esempio n. 26
0
void init_crown_mesh(GLShape& mesh) {
    float x0 = 0.1f;
    float y0 = 0.025f;
    float y1 = 0.05f;
    float x1 = 0.5f * x0;
    
    Vector2 p0(-x0, 0.0f);
    Vector2 p1(x0, 0.0f);
    Vector2 p2(x0, y1);
    Vector2 p3(x1, y0);
    Vector2 p4(0.0f, y1);
    Vector2 p5(-x1, y0);
    Vector2 p6(-x0, y1);
    
    mesh = to_xy(triangulate({p0, p1, p2, p3, p4, p5, p6}));
}
void RenderVideoFrame::mousePressEvent(QMouseEvent * event) {
    if (getState()==0 && point_x==-1 && point_y==-1) {
        // we set more points just in my curiosity
        point_x = event->x();
        point_y = event->y();
        Point2f p1(point_x-point_diameter*2, point_y-point_diameter*2),
                p2(point_x+point_diameter*2, point_y-point_diameter*2),
                p3(point_x, point_y),
                p4(point_x-point_diameter*2, point_y+point_diameter*2),
                p5(point_x+point_diameter*2, point_y+point_diameter*2);

        in.clear();
        in.push_back(p1); in.push_back(p2); in.push_back(p3); in.push_back(p4); in.push_back(p5);
        setState(1); // tracking
    }
}
void PE_IO::fire_PI()
{	
	token_type x0,x1,x2,x3,x4,x5,x6,x7;
	x0.re=(rand()%10000)/10000.0000; x0.im=(rand()%10000)/10000.0000;
	x1.re=(rand()%10000)/10000.0000; x1.im=(rand()%10000)/10000.0000;
	x2.re=(rand()%10000)/10000.0000; x2.im=(rand()%10000)/10000.0000;
	x3.re=(rand()%10000)/10000.0000; x3.im=(rand()%10000)/10000.0000;
	x4.re=(rand()%10000)/10000.0000; x4.im=(rand()%10000)/10000.0000;
	x5.re=(rand()%10000)/10000.0000; x5.im=(rand()%10000)/10000.0000;
	x6.re=(rand()%10000)/10000.0000; x6.im=(rand()%10000)/10000.0000;
	x7.re=(rand()%10000)/10000.0000; x7.im=(rand()%10000)/10000.0000;
	
	packet p0(x_, y_, 1, 0, x0);
	printf("Round %d:PI: send x0 %.4f+%.4fi to (%d,%d)\n",
		pifire,x0.re,x0.im, p0.dest_x, p0.dest_y);
	packet p1(x_, y_, 1, 2, x1);
	printf("Round %d:PI: send x1 %.4f+%.4fi to (%d,%d)\n",
		pifire,x1.re,x1.im, p1.dest_x, p1.dest_y);
	packet p2(x_, y_, 2, 1, x2);
	printf("Round %d:PI: send x2 %.4f+%.4fi to (%d,%d)\n",
		pifire,x2.re,x2.im, p2.dest_x, p2.dest_y);
	packet p3(x_, y_, 0, 1, x3);
	printf("Round %d:PI: send x3 %.4f+%.4fi to (%d,%d)\n",
		pifire,x3.re,x3.im, p3.dest_x, p3.dest_y);
	packet p4(x_, y_, 1, 0, x4);
	printf("Round %d:PI: send x4 %.4f+%.4fi to (%d,%d)\n",
		pifire,x4.re,x4.im, p4.dest_x, p4.dest_y);
	packet p5(x_, y_, 1, 2, x5);
	printf("Round %d:PI: send x5 %.4f+%.4fi to (%d,%d)\n",
		pifire,x5.re,x5.im, p5.dest_x, p5.dest_y);
	packet p6(x_, y_, 2, 1, x6);
	printf("Round %d:PI: send x6 %.4f+%.4fi to (%d,%d)\n",
		pifire,x6.re,x6.im, p6.dest_x, p6.dest_y);
	packet p7(x_, y_, 0, 1, x7);
	printf("Round %d:PI: send x7 %.4f+%.4fi to (%d,%d)\n",
		pifire,x7.re,x7.im, p7.dest_x, p7.dest_y);
	out_queue_.push_back(p0);
	out_queue_.push_back(p1);
	out_queue_.push_back(p2);
	out_queue_.push_back(p3);
	out_queue_.push_back(p4);
	out_queue_.push_back(p5);
	out_queue_.push_back(p6);
	out_queue_.push_back(p7);
	
	pifire++;
}
Esempio n. 29
0
static void tst8() {
    params_ref      ps;
    reslimit        rlim;
    nlsat::solver s(rlim, ps);
    anum_manager & am     = s.am();
    nlsat::pmanager & pm  = s.pm();
    nlsat::assignment as(am);
    nlsat::explain& ex    = s.get_explain();
    nlsat::var x0, x1, x2, a, b, c, d;
    a  = s.mk_var(false);
    b  = s.mk_var(false);
    c  = s.mk_var(false);
    d  = s.mk_var(false);
    x0 = s.mk_var(false);
    x1 = s.mk_var(false);
    x2 = s.mk_var(false);

    polynomial_ref p1(pm), p2(pm), p3(pm), p4(pm), p5(pm);
    polynomial_ref _x0(pm), _x1(pm), _x2(pm);
    polynomial_ref _a(pm), _b(pm), _c(pm), _d(pm);
    _x0 = pm.mk_polynomial(x0);
    _x1 = pm.mk_polynomial(x1);
    _x2 = pm.mk_polynomial(x2);
    _a  = pm.mk_polynomial(a);
    _b  = pm.mk_polynomial(b);
    _c  = pm.mk_polynomial(c);
    _d  = pm.mk_polynomial(d);

    scoped_anum zero(am), one(am), two(am), six(am);
    am.set(zero, 0);
    am.set(one,  1);
    am.set(two,  2);
    am.set(six,  6);
    as.set(0, two); // a
    as.set(1, one); // b
    as.set(2, six); // c
    as.set(3, zero); // d
    as.set(4, zero); // x0
    as.set(5, zero); // x1
    as.set(6, two); // x2
    s.set_rvalues(as);

    nlsat::scoped_literal_vector lits(s);
    lits.push_back(mk_eq(s, (_a*_x2*_x2) - (_b*_x2) - _c));
    project(s, ex, x2, 1, lits.c_ptr());
}
Esempio n. 30
0
void COGLCubeMap::LoadCubeMapFromPath(const std::string& path)
{
	std::string p1(path);
	std::string p2(path);
	std::string p3(path);
	std::string p4(path);
	std::string p5(path);
	std::string p6(path);

	LoadCubeMapFromFiles(
		p1.append("pos_x.png").c_str(), 
		p2.append("neg_x.png").c_str(),
		p3.append("pos_y.png").c_str(),
		p4.append("neg_y.png").c_str(),
		p5.append("pos_z.png").c_str(),
		p6.append("neg_z.png").c_str());
}