[vtk-developers] New method fot vtkBoundingBox

Patrick Bergeron pbergeron at spiria.com
Wed Jun 13 21:45:47 EDT 2018


It's funny how sometimes you think a method exists, but doesn't (or I'm not looking at the right spot?)


I'm not currently registered for pushing submits to the git repo, would someone be kind enough to PR this for me for inclusion?


I currently have this code as a helper function, but it would be nice if it would be in vtk...

(I use this as a means to project all points of a bbox against a plane, so I need to iterate over all corners of the box)



inline void vtkBoundingBox::GetCorner(int corner, double p[3]) const
{
if ((corner < 0) || (corner > 7))
{
p[0] = VTK_DOUBLE_MAX;
p[1] = VTK_DOUBLE_MAX;
p[2] = VTK_DOUBLE_MAX;
return; // out of bounds
}

int ix = (corner & 1)        ? 1 : 0;  // 0,1,0,1,0,1,0,1
int iy = ((corner >> 1) & 1) ? 1 : 0;  // 0,0,1,1,0,0,1,1
int iz = (corner >> 2)       ? 1 : 0;  // 0,0,0,0,1,1,1,1

const double* pts[2] = { this->MinPnt, this->MaxPnt };
p[0] = pts[ix][0];
p[1] = pts[iy][1];
p[2] = pts[iz][2];
}



Thank you !


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtk-developers/attachments/20180614/e375b217/attachment.html>


More information about the vtk-developers mailing list