Skip to content

Commit 8b17606

Browse files
WillCMcCfinetjul
authored andcommitted
docs(Renderer): Update resetCamera documentation
1 parent 316cc60 commit 8b17606

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

Sources/Rendering/Core/Renderer/index.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -412,17 +412,19 @@ function vtkRenderer(publicAPI, model) {
412412

413413
// default so that the bounding sphere fits within the view fustrum
414414

415-
// compute the distance from the intersection of the view frustum with the
416-
// bounding sphere. Basically in 2D draw a circle representing the bounding
417-
// sphere in 2D then draw a horizontal line going out from the center of
418-
// the circle. That is the camera view. Then draw a line from the camera
419-
// position to the point where it intersects the circle. (it will be tangent
420-
// to the circle at this point, this is important, only go to the tangent
421-
// point, do not draw all the way to the view plane). Then draw the radius
422-
// from the tangent point to the center of the circle. You will note that
423-
// this forms a right triangle with one side being the radius, another being
424-
// the target distance for the camera, then just find the target dist using
425-
// a sin.
415+
// Viewing the scene from the side in 2D:
416+
// Draw a circle representing the bounding sphere containing all pixels.
417+
// Then, draw a horizontal line going out from the center of the circle.
418+
// The camera is somewhere on this line.
419+
// Picture the view frustrum, moving through the circle.
420+
// Draw a line from the intersection of the view frustrum and the bounding sphere to line the camera is on, ensuring that the line is tangent to the circle.
421+
// Draw the radius from the tangent point to the center of the circle.
422+
// You will note that this forms a right triangle with sides:
423+
// - radius
424+
// - the line formed by the intersection of the view frustrum and the bounding sphere
425+
// - the target distance for the camera.
426+
// We can use trigonometry to solve for that distance.
427+
426428
const angle = vtkMath.radiansFromDegrees(model.activeCamera.getViewAngle());
427429
const parallelScale = radius;
428430
const distance = radius / Math.sin(angle * 0.5);

0 commit comments

Comments
 (0)