67 double camWorldPos[4];
71 double camWorldFocalPoint[4];
73 camWorldFocalPoint[3] = 1.0;
77 InverseVolumeMatrix->DeepCopy(volMatrix);
78 InverseVolumeMatrix->Invert();
79 InverseVolumeMatrix->MultiplyPoint(camWorldPos, camWorldPos);
80 InverseVolumeMatrix->MultiplyPoint(camWorldFocalPoint, camWorldFocalPoint);
82 this->CameraPosition =
vtkVector3d(camWorldPos[0], camWorldPos[1], camWorldPos[2]);
83 this->CameraPosition = this->CameraPosition /
vtkVector3d(camWorldPos[3]);
85 vtkVector3d camFP(camWorldFocalPoint[0], camWorldFocalPoint[1], camWorldFocalPoint[2]);
121 for (
int i = 0; i < 6; ++i)
123 int low = 2 * (i / 2);
124 bboundsP[i] = bbounds[i];
125 if (bboundsP[i] < abounds[low])
127 bboundsP[i] = abounds[low];
129 if (bboundsP[i] > abounds[low + 1])
131 bboundsP[i] = abounds[low + 1];
133 aboundsP[i] = abounds[i];
134 if (aboundsP[i] < bbounds[low])
136 aboundsP[i] = bbounds[low];
138 if (aboundsP[i] > bbounds[low + 1])
140 aboundsP[i] = bbounds[low + 1];
148 for (
int i = 0; i < 6; i += 2)
150 if (aboundsP[i] != aboundsP[i + 1])
152 dimSize[dims] = aboundsP[i + 1] - aboundsP[i];
157 degenAxes[degenDims] = i / 2;
167 if (dimSize[0] < dimSize[1])
169 if (dimSize[0] < dimSize[2])
180 if (dimSize[1] < dimSize[2])
194 double atobdir[3] = { bbounds[0] + bbounds[1] - abounds[0] - abounds[1],
195 bbounds[2] + bbounds[3] - abounds[2] - abounds[3],
196 bbounds[4] + bbounds[5] - abounds[4] - abounds[5] };
200 if (fabs(aboundsP[degenAxes[0] * 2] - bboundsP[degenAxes[0] * 2]) > 0.01 * atoblength)
207 if (this->CameraIsParallel)
214 vtkVector3d planePoint(0.25 * (aboundsP[0] + aboundsP[1] + bboundsP[0] + bboundsP[1]),
215 0.25 * (aboundsP[2] + aboundsP[3] + bboundsP[2] + bboundsP[3]),
216 0.25 * (aboundsP[4] + aboundsP[5] + bboundsP[4] + bboundsP[5]));
224 double plane[3] = { 0, 0, 0 };
225 plane[degenAxes[0]] = 1.0;
227 double dot = dir[0] * plane[0] + dir[1] * plane[1] + dir[2] * plane[2];
233 double side = plane[0] * atobdir[0] + plane[1] * atobdir[1] + plane[2] * atobdir[2];
234 return (dot * side < 0 ? 1 : -1);