Ejemplo n.º 1
0
void transform_big(Nef_polyhedron& N,int n, int s) {
  Vertex_const_iterator vi(N.vertices_begin());
  x_min = vi->point().hx()/vi->point().hw();
  x_max = vi->point().hx()/vi->point().hw();
  y_min = vi->point().hy()/vi->point().hw();
  y_max = vi->point().hy()/vi->point().hw();
  z_min = vi->point().hz()/vi->point().hw();
  z_max = vi->point().hz()/vi->point().hw();
  for(;vi != N.vertices_end();++vi) {
    if(vi->point().hx()/vi->point().hw() < x_min) 
      x_min = vi->point().hx()/vi->point().hw();
    if(vi->point().hx()/vi->point().hw() > x_max) 
      x_max = vi->point().hx()/vi->point().hw();
    if(vi->point().hy()/vi->point().hw() < y_min) 
      y_min = vi->point().hy()/vi->point().hw();
    if(vi->point().hy()/vi->point().hw() > y_max) 
      y_max = vi->point().hy()/vi->point().hw();
    if(vi->point().hz()/vi->point().hw() < z_min) 
      z_min = vi->point().hz()/vi->point().hw();
    if(vi->point().hz()/vi->point().hw() > z_max) 
      z_max = vi->point().hz()/vi->point().hw();
  }

  //  x_min-=(x_min<=0?0:1);
  //  y_min-=(y_min<=0?0:1);
  //  z_max+=(z_max<=0?1:0);
  
  N.transform(Aff_transformation_3(CGAL::TRANSLATION, Vector_3(-x_min,-y_min,-z_max)));
  N.transform(Aff_transformation_3(CGAL::SCALING, n*s+2,x_max-x_min));
  N.transform(Aff_transformation_3(CGAL::TRANSLATION, Vector_3(0,0,s/2)));
}
Ejemplo n.º 2
0
void transform_form(const Nef_polyhedron& N, Nef_polyhedron& F) {

    Vertex_const_iterator vi(N.vertices_begin());
    x_max = CGAL_NTS abs(vi->point().hx()/vi->point().hw());
    y_max = CGAL_NTS abs(vi->point().hy()/vi->point().hw());
    z_max = CGAL_NTS abs(vi->point().hz()/vi->point().hw());
    for(; vi != N.vertices_end(); ++vi) {
        if(CGAL_NTS abs(vi->point().hx()/vi->point().hw()) > x_max)
            x_max = CGAL_NTS abs(vi->point().hx()/vi->point().hw());
        if(CGAL_NTS abs(vi->point().hy()/vi->point().hw()) > y_max)
            y_max = CGAL_NTS abs(vi->point().hy()/vi->point().hw());
        if(CGAL_NTS abs(vi->point().hz()/vi->point().hw()) > z_max)
            z_max = CGAL_NTS abs(vi->point().hz()/vi->point().hw());
    }

    x_max*105/100;
    y_max*105/100;
    z_max*105/100;

    F.transform(Aff_transformation_3(x_max,0,0, 0,y_max,0, 0,0,z_max, 1));
    F.transform(Aff_transformation_3(CGAL::TRANSLATION,Vector_3(0,0,z_max)));
}