1.1 --- a/gui/broken_edge.cc Thu Jul 28 17:01:40 2005 +0000
1.2 +++ b/gui/broken_edge.cc Thu Jul 28 17:06:13 2005 +0000
1.3 @@ -45,17 +45,18 @@
1.4 {
1.5 //arrow keeps its position-left button
1.6
1.7 - // if(p.size()==2)
1.8 - // {
1.9 - // Gnome::Canvas::Points points;
1.10 - // my_points[0]=p[0];
1.11 - // my_points[2]=p[1];
1.12 - // for(int i=0;i<3;i++)
1.13 - // {
1.14 - // points.push_back(my_points[i]);
1.15 - // }
1.16 - // property_points().set_value(points);
1.17 - // }
1.18 + if(p.size()==2)
1.19 + {
1.20 + Gnome::Canvas::Points points;
1.21 + my_points[0]=p[0];
1.22 + my_points[2]=p[1];
1.23 + for(int i=0;i<3;i++)
1.24 + {
1.25 + points.push_back(my_points[i]);
1.26 + }
1.27 + property_points().set_value(points);
1.28 + }
1.29 + set_arrow=true;
1.30
1.31 //////////////////////////////////////////////////////////////////////////////////////////////////////
1.32 /////////// kepps shape-with angles
1.33 @@ -184,54 +185,54 @@
1.34 /////////// kepps shape-with scalar multiplication
1.35 //////////////////////////////////////////////////////////////////////////////////////////////////////
1.36
1.37 - if(p.size()==2)
1.38 - {
1.39 - //old vector from one to the other node - a
1.40 - xy<double> a_v(my_points[2].get_x()-my_points[0].get_x(),my_points[2].get_y()-my_points[0].get_y());
1.41 - //new vector from one to the other node - b
1.42 - xy<double> b_v(p[1].get_x()-p[0].get_x(),p[1].get_y()-p[0].get_y());
1.43 +// if(p.size()==2)
1.44 +// {
1.45 +// //old vector from one to the other node - a
1.46 +// xy<double> a_v(my_points[2].get_x()-my_points[0].get_x(),my_points[2].get_y()-my_points[0].get_y());
1.47 +// //new vector from one to the other node - b
1.48 +// xy<double> b_v(p[1].get_x()-p[0].get_x(),p[1].get_y()-p[0].get_y());
1.49
1.50 - //old vector from one node to the breakpoint - c
1.51 - xy<double> c_v(my_points[1].get_x()-my_points[0].get_x(),my_points[1].get_y()-my_points[0].get_y());
1.52 +// //old vector from one node to the breakpoint - c
1.53 +// xy<double> c_v(my_points[1].get_x()-my_points[0].get_x(),my_points[1].get_y()-my_points[0].get_y());
1.54
1.55 - //new vector from one node to the breakpoint - d - we have to calculate this one
1.56 - xy<double> d_v;
1.57 +// //new vector from one node to the breakpoint - d - we have to calculate this one
1.58 +// xy<double> d_v;
1.59
1.60 - //scalar product of a and b (old and new vector from first point to the other)
1.61 - double sab=a_v*b_v;
1.62 - //scalar product of c and d (old and new vector from first point to breakpoint)
1.63 - double scd=sab*c_v.normSquare()/a_v.normSquare();
1.64 +// //scalar product of a and b (old and new vector from first point to the other)
1.65 +// double sab=a_v*b_v;
1.66 +// //scalar product of c and d (old and new vector from first point to breakpoint)
1.67 +// double scd=sab*c_v.normSquare()/a_v.normSquare();
1.68
1.69 - std::cout<<" a " << a_v<<" b " <<b_v<<" c " <<c_v<<" sab " <<sab<<" scd "<<scd<<std::endl;
1.70 +// std::cout<<" a " << a_v<<" b " <<b_v<<" c " <<c_v<<" sab " <<sab<<" scd "<<scd<<std::endl;
1.71
1.72 - double a=c_v.normSquare();
1.73 - double b=2*scd*c_v.y;
1.74 - double c=scd*scd-b_v.normSquare()/a_v.normSquare()*c_v.normSquare()*c_v.x*c_v.x;
1.75 +// double a=c_v.normSquare();
1.76 +// double b=2*scd*c_v.y;
1.77 +// double c=scd*scd-b_v.normSquare()/a_v.normSquare()*c_v.normSquare()*c_v.x*c_v.x;
1.78
1.79 - std::cout<<" a " << a<<" b " <<b<<" c " <<c<<std::endl;
1.80 +// std::cout<<" a " << a<<" b " <<b<<" c " <<c<<std::endl;
1.81
1.82 - d_v.y=(-b-sqrt(b*b-4*a*c))/2/a;
1.83 +// d_v.y=(-b-sqrt(b*b-4*a*c))/2/a;
1.84
1.85 - if(c_v.x!=0)
1.86 - {
1.87 - d_v.x=(scd-c_v.y*d_v.y)/c_v.x;
1.88 - }
1.89 - else
1.90 - {
1.91 - d_v.x=my_points[1].get_x();
1.92 - }
1.93 +// if(c_v.x!=0)
1.94 +// {
1.95 +// d_v.x=(scd-c_v.y*d_v.y)/c_v.x;
1.96 +// }
1.97 +// else
1.98 +// {
1.99 +// d_v.x=my_points[1].get_x();
1.100 +// }
1.101
1.102 - std::cout<<" d " << d_v<<std::endl;
1.103 +// std::cout<<" d " << d_v<<std::endl;
1.104
1.105 - my_points[1]=Gnome::Art::Point(d_v.x+p[0].get_x(),d_v.y+p[0].get_y());
1.106 +// my_points[1]=Gnome::Art::Point(d_v.x+p[0].get_x(),d_v.y+p[0].get_y());
1.107
1.108 - Gnome::Canvas::Points points;
1.109 - for(int i=0;i<3;i++)
1.110 - {
1.111 - points.push_back(my_points[i]);
1.112 - }
1.113 - property_points().set_value(points);
1.114 - }
1.115 +// Gnome::Canvas::Points points;
1.116 +// for(int i=0;i<3;i++)
1.117 +// {
1.118 +// points.push_back(my_points[i]);
1.119 +// }
1.120 +// property_points().set_value(points);
1.121 +// }
1.122 }
1.123 if(set_arrow)
1.124 {