Skip to content

Some properties and methods are missing from ConvexSpheroPolygon and ConvexSpheroPolyhedron, but they are shown in the docs #268

@josephburkhart

Description

@josephburkhart

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions