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

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

Android Gson.fromJson error -