Login  Register

Re: Get middle point

Posted by dxli on Jan 11, 2016; 2:36pm
URL: https://forum.librecad.org/Get-middle-point-tp5712811p5712812.html

I'm not sure I got the question.

If you have two points p0(x0, y0), and p1(x1, y1)

then, the middle points means (p0 + p1) * 0.5
double x0{0.};
double y0{0.};
double x1{0.};
double y1{0.};
RS_Vector p0{x0, y0};
RS_Vector p1{x1, y1};
RS_Vector middle = (p0 + p1) * 0.5;

jaise wrote
In code, rs_vector& p gives end points.

How can get middle point same way ?