New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question/Feature request - 3d circle #19865
Comments
I think that we should support more wider varieties of geometric primitives |
What do you mean? If you provide a normal, center point and radius than you can only draw one circle as far as i can think off? It might be more tricky for a ellipse as his rotation does matter. Correct me if I'm wrong! |
No, I mean about how the plane where the circle is drawn is tilted |
Okay, I see you have mentioned to use normal vector |
I’d tell you that I missed your detail of using normal vectors |
It is possible to do this if you give equations for the circle and line. The equations for the circle are something like:
where r is the arbitrary position vector, c the centre, n the normal and R the radius. The equation for the line will be something like
where t is the parameter of the line. Using the vector module we have: In [24]: from sympy.vector import CoordSys3D
In [25]: N = CoordSys3D('N')
In [26]: x, y, z = N.base_scalars()
In [27]: i, j, k = N.base_vectors()
In [28]: c = 1*i
In [29]: n = i + j
In [30]: R = 2
In [31]: a = c
In [32]: b = i - j
In [33]: t = Symbol('t')
In [34]: r = a + t*b
In [35]: r
Out[35]: (t + 1) i_N + (-t) j_N
In [36]: (r - c).dot(n)
Out[36]: 0
In [37]: r - c
Out[37]: (t) i_N + (-t) j_N
In [42]: (r - c).dot(r - c)
Out[42]:
2
2⋅t
In [43]: solve((r - c).dot(r - c) - R**2, t)
Out[43]: [-√2, √2]
In [44]: r
Out[44]: (t + 1) i_N + (-t) j_N
In [45]: sol = solve((r - c).dot(r - c) - R**2, t, dict=True)
In [46]: sol
Out[46]: [{t: -√2}, {t: √2}]
In [47]: [r.subs(s) for s in sol]
Out[47]: [(1 - √2) i_N + (√2) j_N, (1 + √2) i_N + (-√2) j_N] |
Oooh, that comment wasn't present when sending mine comment @sylee957 |
@oscarbenjamin I'll give it a try, thank you! :) |
Hey,
I'm wondering if the library has a way to use 3 dimensional circles? I have a program that spit out 3d circles by providing the centerpoint, radius and normal vector of the circle his plane. I want to calculate the intersection of a line in the same plane with the circle, is that possible?
The text was updated successfully, but these errors were encountered: