Changeset 93:56eb90299693 in glemon0.x
 Timestamp:
 11/23/05 17:24:59 (19 years ago)
 Branch:
 gui
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk/gui@2381
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

gdcbroken_edge.cc
r89 r93 74 74 double absb=sqrt(b_v.normSquare()); 75 75 76 //old vector from one node to the breakpoint  c 77 xy<double> c_v(my_points[1].get_x()my_points[0].get_x(),my_points[1].get_y()my_points[0].get_y()); 78 79 //unit vector with the same direction to a_v 80 xy<double> a_v_u(a_v.x/absa,a_v.y/absa); 81 82 //normal vector of unit vector with the same direction to a_v 83 xy<double> a_v_u_n(((1)*a_v_u.y),a_v_u.x); 84 85 //unit vector with the same direction to b_v 86 xy<double> b_v_u(b_v.x/absb,b_v.y/absb); 87 88 //normal vector of unit vector with the same direction to b_v 89 xy<double> b_v_u_n(((1)*b_v_u.y),b_v_u.x); 90 91 //vector c in a_v_u and a_v_u_n coordinate system 92 xy<double> c_a(c_v*a_v_u,c_v*a_v_u_n); 93 94 //new vector from one node to the breakpoint  d  we have to calculate this one 95 xy<double> d_v=absb/absa*(c_a.x*b_v_u+c_a.y*b_v_u_n); 96 97 my_points[1]=Gnome::Art::Point(d_v.x+p[0].get_x(),d_v.y+p[0].get_y()); 98 99 my_points[0]=p[0]; 100 my_points[2]=p[1]; 101 102 Gnome::Canvas::Points points; 103 for(int i=0;i<3;i++) 76 if((absa!=0)&&(absb!=0)) 104 77 { 105 points.push_back(my_points[i]); 78 //old vector from one node to the breakpoint  c 79 xy<double> c_v(my_points[1].get_x()my_points[0].get_x(),my_points[1].get_y()my_points[0].get_y()); 80 81 //unit vector with the same direction to a_v 82 xy<double> a_v_u(a_v.x/absa,a_v.y/absa); 83 84 //normal vector of unit vector with the same direction to a_v 85 xy<double> a_v_u_n(((1)*a_v_u.y),a_v_u.x); 86 87 //unit vector with the same direction to b_v 88 xy<double> b_v_u(b_v.x/absb,b_v.y/absb); 89 90 //normal vector of unit vector with the same direction to b_v 91 xy<double> b_v_u_n(((1)*b_v_u.y),b_v_u.x); 92 93 //vector c in a_v_u and a_v_u_n coordinate system 94 xy<double> c_a(c_v*a_v_u,c_v*a_v_u_n); 95 96 //new vector from one node to the breakpoint  d  we have to calculate this one 97 xy<double> d_v=absb/absa*(c_a.x*b_v_u+c_a.y*b_v_u_n); 98 99 my_points[1]=Gnome::Art::Point(d_v.x+p[0].get_x(),d_v.y+p[0].get_y()); 100 101 my_points[0]=p[0]; 102 my_points[2]=p[1]; 103 104 Gnome::Canvas::Points points; 105 for(int i=0;i<3;i++) 106 { 107 points.push_back(my_points[i]); 108 } 109 property_points().set_value(points); 106 110 } 107 property_points().set_value(points); 111 else 112 { 113 //if distance is 0, segmentation would be occured 114 //in calculations, because of division by zero 115 //But we have luck: the edge cannot be seen in 116 //this case, so no update needed 117 set_arrow=false; 118 } 108 119 } 109 120 } … … 116 127 117 128 xy<gdouble> unit_vector_in_dir(targetcenter); 129 double length=sqrt( unit_vector_in_dir.normSquare() ); 130 118 131 // std::cout << target << "  " << center << " = " << unit_vector_in_dir << " / " <<unit_vector_in_dir.normSquare() ; 119 unit_vector_in_dir/= sqrt( unit_vector_in_dir.normSquare() );132 unit_vector_in_dir/=length; 120 133 // std::cout << " = " << unit_vector_in_dir << std::endl; 121 134 … … 141 154 xy<gdouble> top(center + unit_vector_in_dir * 3 * size); 142 155 143 // 156 //std::cout << bl << " " << br << " " << ccl << " " << ccr << " " << cl << " " << cr << " " << top << std::endl; 144 157 145 158 Gnome::Canvas::Points arrow_points;
Note: See TracChangeset
for help on using the changeset viewer.