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
Messages: 14039 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();
|
|
|
Goto Forum:
Current Time: Sat Sep 21 00:26:49 CEST 2024
Total time taken to generate the page: 0.03616 seconds
|