Пример #1
0
void
h13 (void)
{
  sizeof(*c13());
  {
    extern IA *c13 (void);
    sizeof(*c13());
    {
      int c13;
      {
        extern A10 *c13 (void);
        sizeof(*c13());
      }
    }
    sizeof(*c13());
  }
  sizeof(*c13());
}
void Scene::init(){
	primitives = new Primitive*[25];
	nrOfPrimitives = 0;
    
    //wall at0,0,1
    Vec3 v121( 0,0, 1 );
	primitives[nrOfPrimitives] = new PlanePrim( v121, -13.0f );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 1 );
	primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 0.0f );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(1.0f);
    Color c121( 1,1,1 );
	primitives[nrOfPrimitives++]->getMaterial()->setColor(c121);
    
    
    //wall at 0 0 -1
    Vec3 v12( 0,0, -1 );
	primitives[nrOfPrimitives] = new PlanePrim( v12, 13.0f );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 1.0f );
	primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 0.0f );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(1.0f);
    Color c12( 0.3f,0.3f,0.7f );
	primitives[nrOfPrimitives++]->getMaterial()->setColor(c12);
    //-
    
    //the ground
    Vec3 v1( 0,1, 0 );
	primitives[nrOfPrimitives] = new CheckerBoard( v1, 3.4f );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 0.7f );
	primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 1.0f );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(0.0f);
    Color c1( 0.3f, 0.3f, 0.7f );
	primitives[nrOfPrimitives++]->getMaterial()->setColor(c1);
    //
    
    
    // 0 -1 0
    Vec3 v13( 0,-1, 0 );
	primitives[nrOfPrimitives] = new PlanePrim( v13, -3.4f );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 1 );
	primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 1.0f );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(1.0f - primitives[nrOfPrimitives]->getMaterial()->getDiffuse());
    Color c13( 1,1,1 );
	primitives[nrOfPrimitives++]->getMaterial()->setColor(c13);
    //
    
	//middle sphere
    Vec3 v2( 0, 1, 8 );
	primitives[nrOfPrimitives] = new Sphere( v2, 1.0f );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 1 );
    primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 0.2 );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(1.0f - primitives[nrOfPrimitives]->getMaterial()->getDiffuse());
    Color c2( 1,1,1);
	primitives[nrOfPrimitives++]->getMaterial()->setColor( c2 );
	//-
    
    //left sphere
    Vec3 v3( -5.5f, -0.5, 7 );
    Color c3( 0.7f, 0.7f, 0 );
	primitives[nrOfPrimitives] = new Sphere( v3, 2 );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 0.6f );
	primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 0.9f );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(1.0f - primitives[nrOfPrimitives]->getMaterial()->getDiffuse());
	primitives[nrOfPrimitives++]->getMaterial()->setColor( c3 );
    //-
    
    //right sphere
    Vec3 v31( 5.5f, -0.5, 7 );
    Color c31( 0.7f, 0.0f, 0 );
	primitives[nrOfPrimitives] = new Sphere( v31, 2 );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 0.6f );
	primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 0.9f );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(1.0f);
	primitives[nrOfPrimitives++]->getMaterial()->setColor( c31 );
    //-
    
    //a light
    Vec3 v4( 3, 2.5f, 3 );
    Color c4(0.7f,0.7f,0.7f);
	primitives[nrOfPrimitives] = new Sphere( v4, 0.5f );
	primitives[nrOfPrimitives]->isLight = true;
	primitives[nrOfPrimitives++]->getMaterial()->setColor( c4 );
	//--
    
    //another light
    Vec3 v5( 0, 5, 10 );
    Color c5( 0.6f, 0.6f, 0.8f );
	primitives[nrOfPrimitives] = new Sphere( v5, 0.5f );
	primitives[nrOfPrimitives]->isLight = true;
	primitives[nrOfPrimitives++]->getMaterial()->setColor( c5 );
	//--    
}
Пример #3
0
int main(int argc, char* argv[])
{
  Polycurve_conic_traits_2 traits;
    //polycurve constructors
  Polycurve_conic_traits_2::Construct_x_monotone_curve_2
    construct_x_mono_polycurve = traits.construct_x_monotone_curve_2_object();
  Polycurve_conic_traits_2::Construct_curve_2  construct_polycurve =
    traits.construct_curve_2_object();

   //create a curve

  Conic_curve_2 c3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(0), Algebraic(0)),
                   Conic_point_2(Algebraic(3), Algebraic(9)));
  Conic_curve_2 c4(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(3), Algebraic(9)),
                   Conic_point_2(Algebraic(5), Algebraic(25)));
  Conic_curve_2 c5(0,1,0,1,0,0, CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(-25), Algebraic(-5)),
                   Conic_point_2(Algebraic(0), Algebraic(0)));

  Conic_curve_2 c6(1,1,0,6,-26,162,CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(-7), Algebraic(13)),
                   Conic_point_2(Algebraic(-3), Algebraic(9)));
  Conic_curve_2 c7(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(-3), Algebraic(9)),
                   Conic_point_2(Algebraic(0), Algebraic(0)));
  Conic_curve_2 c8(0,1,0,-1,0,0, CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(0), Algebraic(0)),
                   Conic_point_2(Algebraic(4), Algebraic(-2)));

  Conic_curve_2 c9(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(-5), Algebraic(25)),
                   Conic_point_2(Algebraic(5), Algebraic(25)));
  Conic_curve_2 c10(58, 72, -48, 0, 0, -360);

  //This vector is used to store curves that will be used to create polycurve
  std::vector<Conic_curve_2> conic_curves;
  conic_curves.push_back(c9);

  //construct poly-curve
  Polycurve_conic_traits_2::Curve_2 conic_polycurve =
    construct_polycurve(conic_curves.begin(), conic_curves.end());

  Conic_curve_2 c11(0,1,0,-1,0,0,CGAL::COUNTERCLOCKWISE,
                     Conic_point_2(Algebraic(25), Algebraic(-5)),
                     Conic_point_2(Algebraic(0), Algebraic(0)));
  Conic_curve_2 c12(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
                     Conic_point_2(Algebraic(0), Algebraic(0)),
                     Conic_point_2(Algebraic(5), Algebraic(25)));
  conic_curves.clear();
  conic_curves.push_back(c11);
  conic_curves.push_back(c12);

  //construct poly-curve
  Polycurve_conic_traits_2::Curve_2 conic_polycurve_2 =
    construct_polycurve(conic_curves.begin(), conic_curves.end());

  /* VERY IMPORTANT
   * For efficiency reasons, we recommend users not to construct
   * x-monotone conic arc directly, but rather use the Make_x_monotone_2
   * functor supplied by the conic-arc traits class to convert conic curves
   * to x-monotone curves.
   */
  Conic_x_monotone_curve_2 xc3(c3);
  Conic_x_monotone_curve_2 xc4(c4);
  Conic_x_monotone_curve_2 xc5(c5);
  Conic_x_monotone_curve_2 xc6(c6);
  Conic_x_monotone_curve_2 xc7(c7);
  Conic_x_monotone_curve_2 xc8(c8);


  //This vector is used to store curves that will be used to create
  //X-monotone-polycurve
  std::vector<Conic_x_monotone_curve_2> xmono_conic_curves_2;
  xmono_conic_curves_2.push_back(xc5);
  xmono_conic_curves_2.push_back(xc3);
  xmono_conic_curves_2.push_back(xc4);


  //construct x-monotone poly-curve
  Pc_x_monotone_curve_2 conic_x_mono_polycurve_1 =
    construct_x_mono_polycurve(xmono_conic_curves_2.begin(),
                               xmono_conic_curves_2.end());

  xmono_conic_curves_2.clear();
  xmono_conic_curves_2.push_back(xc6);
  xmono_conic_curves_2.push_back(xc7);
  xmono_conic_curves_2.push_back(xc8);
  //construct x-monotone poly-curve
  Pc_x_monotone_curve_2 conic_x_mono_polycurve_2 =
    construct_x_mono_polycurve(xmono_conic_curves_2.begin(),
                               xmono_conic_curves_2.end());

  xmono_conic_curves_2.clear();
  xmono_conic_curves_2.push_back(xc5);

  Pc_x_monotone_curve_2 x_polycurve_push =
    construct_x_mono_polycurve(xmono_conic_curves_2.begin(),
                               xmono_conic_curves_2.end());
  Polycurve_conic_traits_2::X_monotone_subcurve_2 xcurve_push =
    Polycurve_conic_traits_2::X_monotone_subcurve_2(c5);
  //traits.construct_x_monotone_curve_2_object()(c5);

  xmono_conic_curves_2.clear();
  xmono_conic_curves_2.push_back(xc3);
  xmono_conic_curves_2.push_back(xc4);
  Pc_x_monotone_curve_2 base_curve =
    construct_x_mono_polycurve(xmono_conic_curves_2.begin(),
                               xmono_conic_curves_2.end());

  //curves for push_back
  Conic_curve_2 c13(1,1,0,-50,12,660,CGAL::COUNTERCLOCKWISE,
                    Conic_point_2(Algebraic(25), Algebraic(-7)),
                    Conic_point_2(Algebraic(25), Algebraic(-5)));
  Conic_curve_2 c14(0,1,0,-1,0,0,CGAL::COUNTERCLOCKWISE,
                    Conic_point_2(Algebraic(25), Algebraic(-5)),
                    Conic_point_2(Algebraic(0), Algebraic(0)));
  Conic_curve_2 c15(-1,0,0,0,1,0,CGAL::COUNTERCLOCKWISE,
                    Conic_point_2(Algebraic(0), Algebraic(0)),
                    Conic_point_2(Algebraic(5), Algebraic(25)));
  conic_curves.clear();
  conic_curves.push_back(c13);
  conic_curves.push_back(c14);
  Polycurve_conic_traits_2::Curve_2 base_curve_push_back =
    construct_polycurve(conic_curves.begin(), conic_curves.end());

  conic_curves.push_back(c15);
  Polycurve_conic_traits_2::Curve_2 Expected_push_back_result =
    construct_polycurve(conic_curves.begin(), conic_curves.end());

  // //checking the orientattion consistency
  // Conic_curve_2 c21(0,1,0,1,0,0,CGAL::CLOCKWISE,
  //                  Conic_point_2(Algebraic(9), Algebraic(-3)),
  //                  Conic_point_2(Algebraic(0), Algebraic(0)));
  // Conic_curve_2 c20(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
  //                   Conic_point_2(Algebraic(0), Algebraic(0)),
  //                   Conic_point_2(Algebraic(3), Algebraic(9)));
  //  Conic_x_monotone_curve_2 xc20(c20);
  //  Conic_x_monotone_curve_2 xc21(c21);
  //  xmono_conic_curves_2.clear();
  //  xmono_conic_curves_2.push_back(xc20);
  // xmono_conic_curves_2.push_back(xc21);
  // Pc_x_monotone_curve_2 eric_polycurve =
  //   construct_x_mono_polycurve(xmono_conic_curves_2.begin(),
  //                              xmono_conic_curves_2.end());
  // std::cout << "the polycurve is: " << eric_polycurve << std::endl;

  // std::cout<< std::endl;

  //check_compare_x_2(xc3, xc5);

  // check_equal();
  // std::cout<< std::endl;

   //check_intersect(conic_x_mono_polycurve_1, conic_x_mono_polycurve_2);
   //std::cout<< std::endl;

  // check_compare_end_points_xy_2();
  // std::cout<< std::endl;

  //check_split(conic_x_mono_polycurve_1, conic_x_mono_polycurve_2);
  // std::cout<< std::endl;

  //check_make_x_monotne_curve(conic_polycurve_2);
   //std::cout<< std::endl;

  // check_is_vertical();
  // std::cout<< std::endl;

  //check_compare_y_at_x_2();
  //std::cout<< std::endl;

  //adds the segment to the right.
  //check_push_back(base_curve_push_back, c15);
  //std::cout<< std::endl;

  //adds the segment to the left.
  //check_push_front(base_curve, xcurve_push);
  //std::cout<< std::endl;

  // check_are_mergable();
  // std::cout<< std::endl;

  // check_merge_2();
  // std::cout<< std::endl;

  // check_construct_opposite();
  // std::cout<< std::endl;

  // check_compare_y_at_x_right();
  // std::cout<< std::endl;

  // check_compare_y_at_x_left();
  // std::cout<< std::endl;
  //check_compare_points(conic_x_mono_polycurve_1);

  //number of segments
  //std::cout << "Number of segments: "
  //          << traits.number_of_points_2_object()(base_curve_push_back)
  //          << std::endl;

  check_trim(conic_x_mono_polycurve_1, atoi(argv[1]), atoi(argv[2]),
             atoi(argv[3]), atoi(argv[4]));
  std::cout << std::endl;

  //std::cout << (atoi(argv[1]) + atoi(argv[2])) << std::endl;
  // Conic_traits_2 con_traits;
  // Conic_curve_2 cc3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
  //                   Conic_point_2(Algebraic(0), Algebraic(0)),
  //                   Conic_point_2(Algebraic(3), Algebraic(9)));
  // Conic_x_monotone_curve_2 xcc3(cc3);
  // Conic_point_2       ps2(0, 0);
  // Conic_point_2       pt2(3, 9);
  // std::cout << "conic curve is : " << xcc3 << std::endl;
  // Conic_x_monotone_curve_2 trimmed_curve =
  //   con_traits.trim_2_object()(xc3, ps2, pt2);
  // std::cout << "trimmed conic curve is : " << trimmed_curve << std::endl;

  return 0;
}