I want to draw a line from point A to point B. However the lines itself should be intelligent in the sense that if point B is exactly
below point A a straight line should get drawn. But if the point B is below A and little far horizontally from A then a line should get drawn in right angled manner. I hope you are getting me. If you may have used any UML tool like edraw Max or any other you may have seen these types of lines. Any idea how can we achieve this?
Thanks in advance :)
The argument of a complex number is defined as the angle inclined from the real axis in the direction of the complex number represented on the complex plane. It is denoted by “θ” or “φ”. It is measured in the standard unit called “radians”.
Complex numbers are the numbers that are expressed in the form of a+ib where, a,b are real numbers and 'i' is an imaginary number called “iota”. The value of i = (√-1). For example, 2+3i is a complex number, where 2 is a real number (Re) and 3i is an imaginary number (Im).
Complex number are, to use the mathematical term, a “field”, like the real numbers. They have a rule both for addition AND for multiplication. They are not just like that two-dimensional grid. We use complex numbers in physics all the time because they're extremely useful.
Just like we can use the number line to visualize the set of real numbers, we can use the complex plane to visualize the set of complex numbers. The complex plane consists of two number lines that intersect in a right angle at the point (0,0)left parenthesis, 0, comma, 0, right parenthesis.
Here's some code:
void connectPoints(Point a, Point b)
{
Point middlePoint1(a.x, (a.y + b.y)/2);
Point middlePoint2(b.x, (a.y + b.y)/2);
drawLine(a, middlePoint1);
drawLine(middlePoint1, middlePoint2);
drawLine(middlePoint2, b);
}
To clarify, the asker actually wants 3-segment axis-aligned lines that look like most connections here:
What's the problem with straightforward approach?
// pA, pB - points
DrawLine(pA.X, pA.Y, pA.X, pB.Y); // vertical line from A point down/up to B
DrawLine(pA.X, pB.Y, pB.X, pB.Y); // horizontal line to B
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With