New method fot vtkBoundingBox

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

New method fot vtkBoundingBox

drjustice

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 !




_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|

Re: New method fot vtkBoundingBox

Will Schroeder-2
I'll add it in. I've got a large MR pending #4281 with some additions to vtkBoundingBox.

On Wed, Jun 13, 2018 at 9:45 PM Patrick Bergeron <[hidden email]> wrote:

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 !



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers



--
William J. Schroeder, PhD
Kitware, Inc. - Building the World's Technical Computing Software
28 Corporate Drive
Clifton Park, NY 12065
[hidden email]
http://www.kitware.com
(518) 881-4902

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|

Re: New method fot vtkBoundingBox

Will Schroeder-2
Patrick do you have a test available, I'd like to cover the code....

On Thu, Jun 14, 2018 at 5:25 AM Will Schroeder <[hidden email]> wrote:
I'll add it in. I've got a large MR pending #4281 with some additions to vtkBoundingBox.

On Wed, Jun 13, 2018 at 9:45 PM Patrick Bergeron <[hidden email]> wrote:

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 !



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers



--
William J. Schroeder, PhD
Kitware, Inc. - Building the World's Technical Computing Software
28 Corporate Drive
Clifton Park, NY 12065
[hidden email]
http://www.kitware.com
(518) 881-4902


--
William J. Schroeder, PhD
Kitware, Inc. - Building the World's Technical Computing Software
28 Corporate Drive
Clifton Park, NY 12065
[hidden email]
http://www.kitware.com
(518) 881-4902

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers