55 double camWorldPos[4];
59 double camWorldFocalPoint[4];
61 camWorldFocalPoint[3] = 1.0;
65 InverseVolumeMatrix->DeepCopy(volMatrix);
66 InverseVolumeMatrix->Invert();
67 InverseVolumeMatrix->MultiplyPoint(camWorldPos, camWorldPos);
68 InverseVolumeMatrix->MultiplyPoint(camWorldFocalPoint, camWorldFocalPoint);
70 this->CameraPosition =
vtkVector3d(camWorldPos[0], camWorldPos[1], camWorldPos[2]);
71 this->CameraPosition = this->CameraPosition /
vtkVector3d(camWorldPos[3]);
73 vtkVector3d camFP(camWorldFocalPoint[0], camWorldFocalPoint[1], camWorldFocalPoint[2]);
76 this->CameraViewDirection = camFP - this->CameraPosition;
109 for (
int i = 0; i < 6; ++i)
111 int low = 2 * (i / 2);
112 bboundsP[i] = bbounds[i];
113 bboundsP[i] = std::max(bboundsP[i], abounds[low]);
114 bboundsP[i] = std::min(bboundsP[i], abounds[low + 1]);
115 aboundsP[i] = abounds[i];
116 aboundsP[i] = std::max(aboundsP[i], bbounds[low]);
117 aboundsP[i] = std::min(aboundsP[i], bbounds[low + 1]);
124 for (
int i = 0; i < 6; i += 2)
126 if (aboundsP[i] != aboundsP[i + 1])
128 dimSize[dims] = aboundsP[i + 1] - aboundsP[i];
133 degenAxes[degenDims] = i / 2;
143 if (dimSize[0] < dimSize[1])
145 if (dimSize[0] < dimSize[2])
156 if (dimSize[1] < dimSize[2])
170 double atobdir[3] = { bbounds[0] + bbounds[1] - abounds[0] - abounds[1],
171 bbounds[2] + bbounds[3] - abounds[2] - abounds[3],
172 bbounds[4] + bbounds[5] - abounds[4] - abounds[5] };
176 if (fabs(aboundsP[degenAxes[0] * 2] - bboundsP[degenAxes[0] * 2]) > 0.01 * atoblength)
183 if (this->CameraIsParallel)
185 dir = this->CameraViewDirection;
190 vtkVector3d planePoint(0.25 * (aboundsP[0] + aboundsP[1] + bboundsP[0] + bboundsP[1]),
191 0.25 * (aboundsP[2] + aboundsP[3] + bboundsP[2] + bboundsP[3]),
192 0.25 * (aboundsP[4] + aboundsP[5] + bboundsP[4] + bboundsP[5]));
193 dir = planePoint - this->CameraPosition;
200 double plane[3] = { 0, 0, 0 };
201 plane[degenAxes[0]] = 1.0;
203 double dot = dir[0] * plane[0] + dir[1] * plane[1] + dir[2] * plane[2];
209 double side = plane[0] * atobdir[0] + plane[1] * atobdir[1] + plane[2] * atobdir[2];
210 return (dot * side < 0 ? 1 : -1);