Changeset 1601:70d169a8313a in lemon-0.x
- Timestamp:
- 07/28/05 19:01:40 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2106
- Location:
- gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
gui/broken_edge.cc
r1524 r1601 20 20 { 21 21 bool set_arrow=false; 22 //red arrow losts its position-right button 22 23 if(!move) 23 24 { … … 43 44 else 44 45 { 46 //arrow keeps its position-left button 47 48 // if(p.size()==2) 49 // { 50 // Gnome::Canvas::Points points; 51 // my_points[0]=p[0]; 52 // my_points[2]=p[1]; 53 // for(int i=0;i<3;i++) 54 // { 55 // points.push_back(my_points[i]); 56 // } 57 // property_points().set_value(points); 58 // } 59 60 ////////////////////////////////////////////////////////////////////////////////////////////////////// 61 /////////// kepps shape-with angles 62 ////////////////////////////////////////////////////////////////////////////////////////////////////// 63 64 65 // //old vector from one to the other node 66 // xy<double> o_p2p(my_points[2].get_x()-my_points[0].get_x(),my_points[2].get_y()-my_points[0].get_y()); 67 // //projection of the old vector to positive x axis 68 // xy<double> o_x_p2p(fabs(o_p2p.x),0); 69 // //length of p2p vector 70 // double o_l_p2p=sqrt( o_p2p.normSquare() ); 71 // if(o_p2p.x<0) 72 // { 73 // o_l_p2p*=-1; 74 // } 75 // //length of projection of p2p vector 76 // double o_l_x_p2p=sqrt( o_x_p2p.normSquare() ); 77 // //old angle of p2p vector to the x axis 78 // double o_a_p2p=acos(o_l_x_p2p/o_l_p2p); 79 // if(o_p2p.y>0) 80 // { 81 // o_a_p2p=2*M_PI-o_a_p2p; 82 // } 83 84 // //old vector from first node to the breakpoint 85 // xy<double> o_1b((my_points[1].get_x()-my_points[0].get_x()),(my_points[1].get_y()-my_points[0].get_y())); 86 // //projection of the old node-breakpoint vector to positive x axis 87 // xy<double> o_x_1b(fabs(o_1b.x),0); 88 // //length of 1b vector 89 // double o_l_1b=sqrt( o_1b.normSquare() ); 90 // if(o_1b.x<0) 91 // { 92 // o_l_1b*=-1; 93 // } 94 // //length of projection of 1b vector 95 // double o_l_x_1b=sqrt( o_x_1b.normSquare() ); 96 // //old angle of 1b vector to the x axis 97 // double o_a_1b=acos(o_l_x_1b/o_l_1b); 98 // if(o_1b.y>0) 99 // { 100 // o_a_1b=2*M_PI-o_a_1b; 101 // } 102 103 // if(p.size()==2) 104 // { 105 // set_arrow=true; 106 107 // my_points[0]=p[0]; 108 // my_points[2]=p[1]; 109 110 // //new vector from one to the other node 111 // xy<double> n_p2p(my_points[2].get_x()-my_points[0].get_x(),my_points[2].get_y()-my_points[0].get_y()); 112 // //projection of the new vector to positive x axis 113 // xy<double> n_x_p2p(fabs(n_p2p.x),0); 114 // //length of p2p vector 115 // double n_l_p2p=sqrt( n_p2p.normSquare() ); 116 // if(n_p2p.x<0) 117 // { 118 // n_l_p2p*=-1; 119 // } 120 // //length of projection of p2p vector 121 // double n_l_x_p2p=sqrt( n_x_p2p.normSquare() ); 122 // //new angle of p2p vector to the x axis 123 // double n_a_p2p=acos(n_l_x_p2p/n_l_p2p); 124 // if(n_p2p.y>0) 125 // { 126 // n_a_p2p=2*M_PI-n_a_p2p; 127 // } 128 129 // //new angle of 1b vector to the x axis 130 // double n_a_1b=o_a_1b+n_a_p2p-o_a_p2p; 131 132 // std::cout << " p2p regi: " << o_a_p2p/M_PI*180 << " uj: " << n_a_p2p/M_PI*180-(int)n_a_p2p/M_PI*180 << std::endl; 133 // std::cout << " 1b regi: " << o_a_1b/M_PI*180 << " uj: " << n_a_1b/M_PI*180-(int)n_a_1b/M_PI*180 << std::endl; 134 135 // // std::cout << o_p2p << " " << n_p2p << std::endl; 136 137 // if((n_a_1b>M_PI*3/2)||(n_a_1b<M_PI/2)) 138 // { 139 // std::cout << "jobb terfel" << std::endl; 140 // my_points[1]=Gnome::Art::Point(p[0].get_x()+cos(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p,p[0].get_y()-sin(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p); 141 // } 142 // else if((n_a_1b<M_PI*3/2)&&(n_a_1b>M_PI/2)) 143 // { 144 // std::cout << "bal terfel" << std::endl; 145 // my_points[1]=Gnome::Art::Point(p[0].get_x()-cos(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p,p[0].get_y()+sin(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p); 146 // } 147 // else 148 // { 149 // std::cout << "y tengely" << std::endl; 150 // double new_y=my_points[1].get_y(); 151 // my_points[1]=Gnome::Art::Point(p[0].get_x()-cos(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p,new_y); 152 // } 153 154 // std::cout << "alap: " << p[0] << " eredeti hossz: " << o_l_1b << " nagy uj: " << n_l_p2p << " nagy regi: " << o_l_p2p << " a*b/c " << o_l_1b*n_l_p2p/o_l_p2p << " eredmeny: " << my_points[1] << std::endl; 155 156 157 // // if(o_1b.x*o_1b.y>0) 158 // // { 159 // // if(n_p2p.x>0) 160 // // { 161 // // my_points[1]=Gnome::Art::Point(p[0].get_x()+cos(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p,p[0].get_y()+sin(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p); 162 // // } 163 // // else 164 // // { 165 // // my_points[1]=Gnome::Art::Point(p[0].get_x()-cos(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p,p[0].get_y()-sin(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p); 166 // // } 167 // // } 168 // // else if(o_1b.x*o_1b.y<0) 169 // // { 170 // // if(n_p2p.x>0) 171 // // { 172 // // my_points[1]=Gnome::Art::Point(p[0].get_x()+cos(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p,p[0].get_y()-sin(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p); 173 // // } 174 // // else 175 // // { 176 // // my_points[1]=Gnome::Art::Point(p[0].get_x()-cos(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p,p[0].get_y()+sin(n_a_1b)*o_l_1b*n_l_p2p/o_l_p2p); 177 // // } 178 // // } 179 // // else 180 // // { 181 // // } 182 183 ////////////////////////////////////////////////////////////////////////////////////////////////////// 184 /////////// kepps shape-with scalar multiplication 185 ////////////////////////////////////////////////////////////////////////////////////////////////////// 186 45 187 if(p.size()==2) 46 { 188 { 189 //old vector from one to the other node - a 190 xy<double> a_v(my_points[2].get_x()-my_points[0].get_x(),my_points[2].get_y()-my_points[0].get_y()); 191 //new vector from one to the other node - b 192 xy<double> b_v(p[1].get_x()-p[0].get_x(),p[1].get_y()-p[0].get_y()); 193 194 //old vector from one node to the breakpoint - c 195 xy<double> c_v(my_points[1].get_x()-my_points[0].get_x(),my_points[1].get_y()-my_points[0].get_y()); 196 197 //new vector from one node to the breakpoint - d - we have to calculate this one 198 xy<double> d_v; 199 200 //scalar product of a and b (old and new vector from first point to the other) 201 double sab=a_v*b_v; 202 //scalar product of c and d (old and new vector from first point to breakpoint) 203 double scd=sab*c_v.normSquare()/a_v.normSquare(); 204 205 std::cout<<" a " << a_v<<" b " <<b_v<<" c " <<c_v<<" sab " <<sab<<" scd "<<scd<<std::endl; 206 207 double a=c_v.normSquare(); 208 double b=2*scd*c_v.y; 209 double c=scd*scd-b_v.normSquare()/a_v.normSquare()*c_v.normSquare()*c_v.x*c_v.x; 210 211 std::cout<<" a " << a<<" b " <<b<<" c " <<c<<std::endl; 212 213 d_v.y=(-b-sqrt(b*b-4*a*c))/2/a; 214 215 if(c_v.x!=0) 216 { 217 d_v.x=(scd-c_v.y*d_v.y)/c_v.x; 218 } 219 else 220 { 221 d_v.x=my_points[1].get_x(); 222 } 223 224 std::cout<<" d " << d_v<<std::endl; 225 226 my_points[1]=Gnome::Art::Point(d_v.x+p[0].get_x(),d_v.y+p[0].get_y()); 227 47 228 Gnome::Canvas::Points points; 48 my_points[0]=p[0];49 my_points[2]=p[1];50 229 for(int i=0;i<3;i++) 51 230 { … … 55 234 } 56 235 } 57 58 236 if(set_arrow) 59 237 { -
gui/main_win.cc
r1598 r1601 122 122 pScrolledWindow->add(gd_canvas); 123 123 vbox.pack_start(*pScrolledWindow); 124 //vbox.pack_start(gd_canvas); 124 125 tooltips.set_tip(*(uim->get_widget("/ToolBar/CreateNode")),"Create Node"); 126 tooltips.enable(); 125 127 126 128 show_all_children(); -
gui/main_win.h
r1598 r1601 42 42 Gtk::VBox vbox; 43 43 44 ///Tooltips 45 Gtk::Tooltips tooltips; 46 44 47 ///Callback for 'FileNew' action. 45 48 virtual void newFile();
Note: See TracChangeset
for help on using the changeset viewer.