Skip to content

Commit 1afca48

Browse files
bruyeretfloryst
authored andcommitted
fix(examples): Fix wrong center computation from bounding box
1 parent 0a4d8ab commit 1afca48

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

Examples/Rendering/QuadView/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,7 @@ function createVolumeView(renderer, source) {
135135

136136
// Add one positional light
137137
const bounds = volume.getBounds();
138-
const center = [
139-
(bounds[1] - bounds[0]) / 2.0,
140-
(bounds[3] - bounds[2]) / 2.0,
141-
(bounds[5] - bounds[4]) / 2.0,
142-
];
138+
const center = vtkBoundingBox.getCenter(bounds);
143139
renderer.removeAllLights();
144140
const light = vtkLight.newInstance();
145141
const lightPos = [center[0] + 300, center[1] + 50, center[2] - 50];

Examples/Volume/VolumeMapperLightAndShadow/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,7 @@ function createVolumeShadowViewer(rootContainer, fileContents) {
101101

102102
// Add one positional light
103103
const bounds = actor.getBounds();
104-
const center = [
105-
(bounds[1] - bounds[0]) / 2.0,
106-
(bounds[3] - bounds[2]) / 2.0,
107-
(bounds[5] - bounds[4]) / 2.0,
108-
];
104+
const center = vtkBoundingBox.getCenter(bounds);
109105
renderer.removeAllLights();
110106
const light = vtkLight.newInstance();
111107
const lightPos = [center[0] + 300, center[1] + 50, center[2] - 50];

0 commit comments

Comments
 (0)