Mesh for cylinders has wrong radius if not axis-aligned.
luzader opened this issue · 2 comments
luzader commented
Hello. Great work with this library. Unfortunately I did find an issue where the mesh generated for cylinders only has the correct radius if the cylinder's vector is axis-aligned. For cylinders with arbitrary vectors the radius is smaller than requested. You can see this with the following minimal example:
from matplotlib import pyplot as plt
from skspatial.objects import Cylinder, Sphere
fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
center = [0, 0, 0]
ax.plot_wireframe(*Sphere(center, 1).to_mesh())
ax.plot_wireframe(*Cylinder(center, [1, 0, 0], 1).to_mesh(4, 32), color='g')
ax.plot_wireframe(*Cylinder(center, [0.707, .707, 0], 1).to_mesh(4, 32), color='r')
ax.set_xlim((-3, 3))
ax.set_ylim((-3, 3))
ax.set_zlim((-3, 3))
plt.tight_layout()
plt.show()
The green cylinder has the correct radius, matching the blue sphere, but the red cylinder is too small by a factor of 0.707.