2010-04-01から1ヶ月間の記事一覧

Pythonにおける親クラスのコンストラクタ呼び出し

以下のエントリに書かれているやり方が一番しっくりきた.http://d.hatena.ne.jp/methane/20081204/1228416796 suepr_class = Foo class Bar(super_class): def __init__(self): super_class.__init__(self) これもある種邪悪な気がするが, 利便性のために用…

vtkで任意の向きの円柱をつくる

actorの例として, 円柱を作ってみる. def create_cylinder(radius, height, res=30): cylinder = vtk.vtkCylinderSource() cylinder.SetResolution(res) cylinder.SetHeight(height) cylinder.SetRadius(radius) mapper = vtk.vtkPolyDataMapper() mapper.Se…

Pythonでvtkを使ってみる

以下のリンクを参考にvtkなど使っている. 詳しく無いのでこのやり方が正しいのかどうかはわからないが, とりあえず動く. http://home.hiroshima-u.ac.jp/~tyoshida/pyukiwiki/?vtk import vtk renderer = vtk.vtkRenderer() for actor in actors: renderer.A…