U++ framework
Do not panic. Ask here before giving up.

Home » Community » Coffee corner » Drawing ellipse with Painter with 2 foci
Drawing ellipse with Painter with 2 foci [message #52307] Tue, 03 September 2019 09:00
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
I had a situation where I needed this, having 2 foci Pointfs (a1, a2) and "radius at focus" (r) (minimum distance focus - ellipse).

So if need this and are too lazy to solve very simple math, here is the code:

		double d = Distance(a1, a2);
		iw.Begin();
		iw.Translate(0.5 * (a1 + a2));
		iw.Rotate(Bearing(a2 - a1));
		iw.Ellipse(0, 0, 0.5 * d + r, sqrt((d + r) * r)).Stroke(1, Black());
		iw.End();


 
Read Message
Previous Topic: What is the minimum OpenGL version required for GLCtrl?
Next Topic: Key/Value store disk-based caching solution
Goto Forum:
  


Current Time: Tue May 05 15:06:35 GMT+2 2026

Total time taken to generate the page: 0.00426 seconds