math - How to get the endpoint of a line in Java given the midpoint and the other endpoint -


i know how maths on paper struggling work out how take potential negative values account.

given 2 locations: endpoint(x1, y1) , midpoint(x2, y2) find other endpoint location

point2d endpoint; //defined elsewhere point2d midpoint; //defined elsewhere  point2d otherend = new point2d(endpoint.getx() + 2 * (midpoint.getx() - endpoint.getx()),                                endpoint.gety() + 2 * (midpoint.gety() - endpoint.gety())); 

(sorry -- made bonheheaded mistake first time.)


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -