Ejemplo n.º 1
0
    virtual void onDraw(){ 
        
      getMouse();
  
     static Dls dls = Ro::dls(5.0, 0,-5,0);
     Touch(interface,dls);

     static Dlp dlp = Vec(0,1,1).unit() + Inf(0);
     Touch(interface,dlp);
     Draw(dlp,0,1,0);

      //some lines
      int iter = 50;
      float spacing = 10;
      vector<Lin> lines(iter);

      int it = 0;
      for ( auto &i : lines ){
        it += 1;
        float t = -spacing/2.0 + spacing * (float) it / iter;


        //Top curvature
        Par tp = Par( Tnv(0,0,amtA) ).trs(0,3,0);       
        auto bstA = Gen::bst( tp );
        
        Pnt tpnt = Ro::point( t, 3, 0 );

        Dll dll = (tpnt ^ Vec::y ^ Inf(1) ).dual();

        Pnt pa = Ro::loc( tpnt.spin( bstA ) );


        //Bottom Curvature
        Par bp = Par( Tnv(0,0,amtB) ).trs(0,-3,0);       
        auto bstB = Gen::bst( bp );
       
        Pnt bpnt = Ro::point( t, -3, 0 );
        Pnt pb = Ro::loc( bpnt.spin( bstB ) );

        i = pa ^ pb ^ Inf(1); i = i.runit();

        Draw(i);

        Pnt rp = ( i.dual() ^ dlp ).dual().unit().null();
        Draw(rp,1,0,1);
      
        Draw(pa,1,0,0); Draw(tpnt,0,1,0); Draw(pb,1,0,0);


 //       Par itp = Par( Tnv(0,0,amtA) ).trs ( Fl::loc( LN(0,1,0), rp, false ) );
 //       auto ibst = Gen::bst(itp);
 //
        VT dist = Ro::dist( pa, rp );

        Pnt rpp = Ro::loc( Ro::split( ( Ro::dls( tpnt, dist ) ^ dll ).dual(), false )) ;

        VT dist2 = Ro::dist( tpnt, rpp );

 //       cout << dist << " " << dist2 << endl;
//        Pnt rpp = Ro::loc( rp.spin( !ibst ) ); //inverse operation
        Draw( rpp, 1,1, 0);
        auto ri = i.reflect(dlp);

        Draw(ri,0,0,1);

    }


        // Draw(dls,0,1,1,.2); 

  }