Tuesday 15 February 2011

c++ - Create arrow class -


I am trying to create an arrow square which takes two points. This is what I have:

  struct arrow: lines {// one arrow is a line with an arrow on the end arrow (Point P1, Point P2) // two Points created for an arrow: P1 (P1), P2 (P2) {} zero draw_line () console; Point P1; Point P2; };   

I have draw_lines () const function:

  zero arrows :: draw_lines () const {lines arrow; Arrow.add (p1, p2); Arrow.draw_lines (); }   

It works by typing Aero A (Point (X, Y), Point (x1, y1)); It is then calculated to calculate the arrow by using the arrow as the base point (x, y), which becomes p1 and (x1, y1), which becomes p2, direction As a guide and (x1, y1). I like the arrows to look like this, only concrete: --- & gt; I can calculate the angle, what is the number of arrows? The lines of the arrow head should be in the form of two X, Y coordinates, such as (P 2.x, P.A., (X coordinate of back point relative to P2), (y p2) .x and .nn The signal point gives the P and X coordinates of P.

Thanks for any help.

looks like using atan2 here.

  const double pi = 3.1415926535897931; const int r = 5; const double jo_jungle = pi / 6.0; // 30 degree tight double stem_angle = ATA 2 (P2i-P1e, P 2.x-P1x); Lines Arrow; Arrow (P1, P2); ARDAID (P2, Point (p2.x - r * cos ( Stem_angle + join_angle), p2.y - r * sin (stem_angle + join_angle)); arrow.add (p2, point (p2.x - r * cos (stem_angle-   

this The approach described in your own comment is:

Ideally, I want to enter the const int to add or subtract the slope angle I am the angle of the arrowhead lines, and for the second length, and it takes care of the NTI gritty point.

Except that double is much better than int to store in join_angle radians.

No comments:

Post a Comment