Description
The getters and setters for centroid are missing from ConvexSpheroPolygon and ConvexSpheroPolyhedron, but the docs show that they are there:
Additionally, the is_inside() method is shown for both of the above classes, but it is only implemented for ConvexSpheroPolyhedron:
The ConvexSpheroPolyhedron.is_inside() implementation ultimately uses the centroid of the underlying polyhedron, so perhaps implementing centroid for this class could be as simple as
class ConvexSpheroPolyhedron(Shape3D):
...
@property
def centroid(self):
return self._polyhedron.centroid
@centroid.setter
def centroid(self, value):
self._polyhedron.centroid = value
If it is that easy, perhaps this same approach could be used for ConvexSpheroPolygon?
To reproduce
To see that centroid is missing from ConvexSpheroPolyhedron:
verts = [
[1, 1, 1], [1, -1, 1], [1, 1, -1], [1, -1, -1],
[-1, 1, 1], [-1, -1, 1], [-1, 1, -1], [-1, -1, -1]
]
spherocube = coxeter.shapes.ConvexSpheropolyhedron(verts, radius=0.5)
print(spherocube.centroid)
spherocube.centroid = [1,1,1]
print(spherocube.centroid)
and from ConvexSpheroPolygon:
verts = [[-1, 0], [0, 1], [1, 0]]
rounded_tri = coxeter.shapes.ConvexSpheropolygon(verts, radius=.1)
print(rounded_tri.centroid)
rounded_tri.centroid = [1,1]
print(rounded_tri.centroid)
To see that is_inside() is missing from ConvexSpheroPolygon:
verts = [[-1, 0], [0, 1], [1, 0]]
rounded_tri = coxeter.shapes.ConvexSpheropolygon(verts, radius=.1)
print(rounded_tri.is_inside([1,1]))
Error output
Each code block given above throws a NotImplementedError originating from the base class Shape2D or Shape3D. I assume that these classes are why the methods show up in the documentation in the first place.
System configuration
Please complete the following information:
- Operating System: Windows 10
- Version of Python: 3.13.3
- Version of coxeter: 0.10.0
Description
The getters and setters for
centroidare missing fromConvexSpheroPolygonandConvexSpheroPolyhedron, but the docs show that they are there:ConvexSpheroPolygon.centroidConvexSpheroPolyhedron.centroidAdditionally, the
is_inside()method is shown for both of the above classes, but it is only implemented forConvexSpheroPolyhedron:ConvexSpheroPolygon.is_inside()ConvexSpheroPolyhedron.is_inside()The
ConvexSpheroPolyhedron.is_inside()implementation ultimately uses the centroid of the underlying polyhedron, so perhaps implementingcentroidfor this class could be as simple asIf it is that easy, perhaps this same approach could be used for
ConvexSpheroPolygon?To reproduce
To see that
centroidis missing fromConvexSpheroPolyhedron:and from
ConvexSpheroPolygon:To see that
is_inside()is missing fromConvexSpheroPolygon:Error output
Each code block given above throws a
NotImplementedErrororiginating from the base classShape2DorShape3D. I assume that these classes are why the methods show up in the documentation in the first place.System configuration
Please complete the following information: