2

I need to draw an ellipse given two co-ordinates

Ellipse Coords
        Coords

but i'm not sure how to do this with vertices, co-vertices, foci, and a centre point. I'm basically confused as to which points go into the two co-ordinates. I have this so far

Ellipse (a, b)(c, d)       = scaled(solidCircle(1) (???)
Circle (a, b)(c, d)        = (solidCircle (r))
                                            where xc = ((c-a)*(c-a))
                                                  yc = ((d-b)*(d-b))
                                                   r = sqrt(xc +yc)

I included the circle equation as I'm using scaled circle.

Thank you!

CB010101
  • 63
  • 3
  • `scaled` is not sufficient for this, unless both foci share either the same x- or y-coordinate. If they don't, you'd additionally need a rotation, which gets fiddly. It would be easier with a general matrix transformation, but I think CodeWorld has no support for such transformations (`diagrams` has). Perhaps it would be easier to approximate the ellipse as a [polygon](https://code.world/doc.html?shelf=help/codeworld.shelf#v:polygon), using [a standard parametrization](https://en.wikipedia.org/wiki/Ellipse#Ellipse_as_an_affine_image_of_the_unit_circle_x%C2%B2+y%C2%B2=1) of the general ellipse. – leftaroundabout Aug 20 '18 at 11:29
  • I am not sure what you mean. Given two points in the plane there are infinitely many Ellipses that can go through them – lsmor Aug 20 '18 at 12:51
  • Are the coordinates intended to be on the circumference of the ellipse? If so, two points is not enough. Indeed, it's easy to draw two ellipses that intersect at four points, so at least five is needed in general. Unfortunately then you have a different problem, namely that not all sets of five points can be touched by a single ellipse (e.g. draw a square and put the fifth point anywhere in the interior). – Daniel Wagner Aug 20 '18 at 12:57

0 Answers0