Get middle point

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Get middle point

jaise
In code, rs_vector& p gives end points.

How can get middle point same way ?

Reply | Threaded
Open this post in threaded view
|

Re: Get middle point

dxli
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 ?