Skip to content

feat: add resetCameraScreenSpace method with offsetRatio input, so actors fully fit the screen#3371

Open
aerogt3 wants to merge 1 commit intoKitware:masterfrom
aerogt3:1285-fix-resetCameraScreenSpace
Open

feat: add resetCameraScreenSpace method with offsetRatio input, so actors fully fit the screen#3371
aerogt3 wants to merge 1 commit intoKitware:masterfrom
aerogt3:1285-fix-resetCameraScreenSpace

Conversation

@aerogt3
Copy link
Contributor

@aerogt3 aerogt3 commented Nov 30, 2025

add resetCameraScreenSpace method with offsetRatio input, essentially a resetCamera call that fills the entire screen space (where 90% offsetRatio means visible actors will fill 90% of the screen space)

#1285

Context

#1285

Results

See image here:
#1285 (comment)

Changes

Duplicated the resetCamera method, with logic to ensure visible actors fill a percentage of the screen (default: 90%)

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Testing

  • Tested environment:
    • master
    • ubuntu 2240
    • firefox 144.0.2 & chrome 142.0

@aerogt3 aerogt3 force-pushed the 1285-fix-resetCameraScreenSpace branch from 5173f89 to 3f36750 Compare December 1, 2025 11:10
Copy link
Member

@finetjul finetjul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! That's much easier to maintain.

ymax = Math.max(dy, ymax);
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use vtkBoundingBox.transformBounds(boundsToUse, publicAPI.getActiveCamera().getModelTransformMatrix, boundsToUse)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done I think

@aerogt3 aerogt3 force-pushed the 1285-fix-resetCameraScreenSpace branch 2 times, most recently from 2e1ea8f to f7db178 Compare March 12, 2026 07:42
Port of VTK C++ vtkRenderer::ResetCameraScreenSpace. Uses a screen-space
bounding box to zoom closer to the data, correctly accounting for viewport
aspect ratio for both perspective and parallel projection.

Also adds zoomToBoxUsingViewAngle as a standalone public method.

Closes Kitware#1285
@aerogt3 aerogt3 force-pushed the 1285-fix-resetCameraScreenSpace branch from f7db178 to cad750c Compare March 12, 2026 07:46
@aerogt3 aerogt3 requested a review from finetjul March 12, 2026 07:54
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