Skip to content

Commit

Permalink
Added the draw_axes method that shows the principle axes in the origin
Browse files Browse the repository at this point in the history
  • Loading branch information
YHordijk committed Sep 1, 2024
1 parent 948fb18 commit 9459a98
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/tcviewer/mol_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,27 @@ def draw_isosurface(self, grid, isovalue=0, color=(1, 1, 0)):

self.renderer.AddActor(actor)


def draw_axes(self):
for v in [(1, 0, 0), (0, 1, 0), (0, 0, 1)]:
lineSource = vtkLineSource()
lineSource.SetPoint1((0, 0, 0))
lineSource.SetPoint2(v)

tubeFilter = vtkTubeFilter()
tubeFilter.source = lineSource
tubeFilter.SetInputConnection(lineSource.GetOutputPort())
tubeFilter.SetRadius(0.01)
tubeFilter.SetNumberOfSides(20)

tubeMapper = vtkPolyDataMapper()
tubeMapper.SetInputConnection(tubeFilter.GetOutputPort())

tubeActor = vtkActor()
tubeActor.SetMapper(tubeMapper)
tubeActor.GetProperty().SetColor([255*i for i in v])
# tubeActor.SetUserTransform(self.transform)
self.renderer.AddActor(tubeActor)
def remove_angle(self, a1, a2, a3):
for act in self.renderer.GetActors():
if not hasattr(act, 'type') or act.type != 'angle':
Expand Down

0 comments on commit 9459a98

Please sign in to comment.