find the vector from origin to the midpoint of the vector p1p2 joining the points p1 (4 3) and p2 ( 8 -5 )
Answers
Answered by
1
Answer:
Are you looking for the slope of the line that connects those points? If so, I think you want to use Vec2Ang(). It's a built-in VS call.
Var
V :Vector;
...
V.x := p2X - p1X; { your DeltaX }
V.y := p2Y - p1Y; { your DeltaY }
V.z := 0;
Ang := Vec2Ang(V);
You'll get angles in degrees in the range of +-180. If you want values from 0-360, then test for a negative angle and add 360 to it.
if (Ang<0) then Ang := Ang + 360;
If you are looking for the angle between two vectors, the answer is a little more complicated, but easily done. Write back for more details.
Similar questions