Skip to content

Broken behaviour with Sphere.scaled() #1488

Closed

Description

@kangoananya

Sphere.scaled() calls the scale() function with keyword arguments for x,y and z. However, the inbuilt Sphere.scale() method requires only a factor for uniform scaling of the self.radius. This makes it not possible to use the scaled() method at all. I suspect similar behaviour in the Cylinder class due to similar implementation of scale.

To replicate, create any sphere and apply scaling:
c = Sphere(10)
scaled_c = c.scaled(0.5,10,10)

  File "C:\Users\akango\Documents\github\compas_introduction_2025\.venv\lib\site-packages\compas\geometry\geometry.py", line 173, in scaled
    geometry.scale(x=x, y=y, z=z)
TypeError: scale() got an unexpected keyword argument 'x'

Is there a reason why most Shape objects have their own transformation methods which are different from the methods it could inherit from Geometry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions