isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.41k stars 2.3k forks source link

Inheritance in python from Geometry3D #1425

Open oliver-batchelor opened 4 years ago

oliver-batchelor commented 4 years ago

I wanted to make a composite Geometry3D, so I tried to inherit a python class.

class Foo(open3d.geometry.Geometry3D): ... def init(self): ... pass

I try to use this I expected some errors about missing methods e.g. 'rotate'...

However,

>>> open3d.visualization.draw_geometries([f])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Unable to cast from non-held to held instance (T& to Holder<T>) (compile in debug mode for type information)

What does this mean - is this kind of inheritance on the python side possible?

oliver-batchelor commented 2 years ago

As of 15.1:

class Foo(o3d.geometry.Geometry3D):
  def __init__(self):
    super(Foo, self).__init__()
    pass
    super(Foo, self).__init__()
TypeError: Foo: No constructor defined!