The following code is used to generate a random point cloud around the original ellipse, and then the function xdrx-points->fitellipse is used to fit the ellipse, and then the fitting accuracy is compared.
Looking at the chart data, it should be a perfect fit.
![](http://www.theswamp.org/index.php?PHPSESSID=e742b5ef2949403918609c8381efc337&action=dlattach;topic=58835.0;attach=41725;image)
(xdrx
-entsel "\nPick Ellipse<Exit>:" '
((0 .
"ellipse"))) )
)
(xdrx-begin)
(setq info1
(xdrx
-getpropertyvalue
e "center" "area"
"majorAxis" "minorAxis" "majorRadius"
"minorRadius"
)
)
(setq pts
(xdrx
-curve
-getsamplepoints e
200) pts1 nil
)
(setq x
(xdrx
-math
-rand
-5.0 5.0) y (xdrx-math-rand -5.0 5.0)
)
(xdrx-point-make pt)
)
)
pts
)
(xdrx-entity-setcolor elli 1)
(setq info2
(xdrx
-getpropertyvalue
elli "center" "area"
"majorAxis" "minorAxis" "majorRadius"
"minorRadius"
)
)
lst
(list (list "Ellipse Fitting Comparison Table" nil nil nil nil nil nil nil)) "CENTER" "AREA"
"MajorAxis" "MajorRadius"
"MinorAxis" "MinorRadius"
)
)
)
scl (* (xd::var:getratio) (xd::var:getscaleratio))
h (* scl 4)
)
(xd::table:makefromlist lst '(0 0 0) h (/ h 2.0))
(xd::drag:simplemove
(entlast) "\nTable Insert:" 8 t
) (xd::drag:simplemove elli "\nEllipse Insert Point:" 5 t)
)
)
(xdrx-end)
)
)
)