Skip to content

Conversation

@winksaville
Copy link
Contributor

  • Add parameters azimuth viewup and clipping_range to allow for improved control of the rendering.
  • Always call ResetCamera early so the camera is in a known state before applying user defined parameters, some of which are relative.

 - Add parameters azimuth viewup and clipping_range to allow for
   improved control of the rendering.
 - Always call ResetCamera early so the camera is in a known
   state before applying user defined parameters, some of which
   are relative.
@winksaville
Copy link
Contributor Author

I've added this per the suggestion from @adam-urbanczyk in "Enhance show in vis.py" discussion #1844.

@codecov
Copy link

codecov bot commented Jun 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.77%. Comparing base (f07e7e0) to head (e4512c4).
⚠️ Report is 20 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1855      +/-   ##
==========================================
+ Coverage   95.66%   95.77%   +0.10%     
==========================================
  Files          28       29       +1     
  Lines        7431     7856     +425     
  Branches     1122     1183      +61     
==========================================
+ Hits         7109     7524     +415     
+ Misses        193      192       -1     
- Partials      129      140      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@winksaville
Copy link
Contributor Author

Anyone have any thoughts on this PR?

@adam-urbanczyk
Copy link
Member

Pls give it some time.

Reset camera orientation if no explicit position is provided.
@winksaville
Copy link
Contributor Author

I'm a neophyte at all this so I asked the bot1 and it says always calling ResetCamera like I did was wrong It's solution was:

# actors already added to ren
cam = ren.GetActiveCamera()

user_pose = any(p is not None for p in (position, focus, viewup, roll, elevation, azimuth))

if not user_pose:
    ren.ResetCamera()  # compute default pose + clipping range
else:
    if focus is not None:    cam.SetFocalPoint(*focus)
    if position is not None: cam.SetPosition(*position)
    if viewup is not None:   cam.SetViewUp(*viewup)
    if roll is not None:     cam.Roll(roll)
    if elevation is not None:cam.Elevation(elevation)
    if azimuth is not None:  cam.Azimuth(azimuth)
    if clipping_range is not None:
        cam.SetClippingRange(*clipping_range)
    else:
        ren.ResetCameraClippingRange()

renWin.Render()  # finalize sizes/ranges

The if statement double negative is odd and there are likely other issues, but the final call to renWin.Render() seems like a good idea.

I'd suggest asking for help on a VTK community forum and since this is well beyond my area of expertise I'll let you all decide how or whether to take this PR.

Wink

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants