Hello,
I have a serie of given points but i dont know the minor axis length, could someone know how to trace an ellipse passing through those points?
Ellipse problem.gh (10.0 KB)
Hello,
I have a serie of given points but i dont know the minor axis length, could someone know how to trace an ellipse passing through those points?
Ellipse problem.gh (10.0 KB)
Hi -
Thatās not a trivial task to solve.
The following thread has 2 Grasshopper graphs that might get you further:
(The thread contains a link to a longer discussion as well).
Also, we have the āFit ellipse through points functionā feature request on the list as RH-62823.
-wim
I canāt help wondering how you know the major axis points but donāt know the ellipse?
Hereās a Galapagos solution:
Ellipse problem_2021Oct29bb.gh (14.1 KB)P.S. Responded to the wrong personā¦
If you already have the major axis you could also get the ellipse by intersecting lines with the circle and scale1D:
For more general ellipse/conic problems I see thereās this recent plugin
This solution with Python 3.9 and Hops
Ellipse problem.gh (10.2 KB)
from flask import Flask
import ghhops_server as hs
import numpy as np
from skimage.measure import EllipseModel
app = Flask(__name__)
hops = hs.Hops(app)
@hops.component(
"/ellipse",
name="Ellipse",
description="Ellipse from points",
#icon="",
inputs=[
hs.HopsPoint("Points", "P", "List of points",hs.HopsParamAccess.LIST),
],
outputs=[
hs.HopsString("Result", "R", "Result output"),
]
)
def ellipse(points):
pts = []
for p in points:
x = p.X
y = p.Y
pt = (x, -y)
pts.append(pt)
a_points = np.array(pts)
ell = EllipseModel()
ell.estimate(a_points)
xc, yc, a, b, theta = ell.params
return [xc,-yc,-theta,a,b]
if __name__ == "__main__":
app.run()
There are other codes:
Is anyone able to install this?
I installed it from PackageManager and it worked
This is one of the cases where OP provided just a single case and then left the thread (iām joking)
Iād like to try some algorythms but i fear other cases would have a different general situation.
Thank Daniel. Package Manager seemed to work, but then nothing shows up when I restart Rhino. Anyway, itās not your problem.
Thank you very much for your solution!
I had the same problem, you should try with a previous version of hops, it works well with the 0.4.1