[vtkusers] Problems with ComputeOBB - wrong OBB computed

Oliver Weinheimer mail at oliwe.com
Mon Aug 11 06:38:33 EDT 2014


Hi all,

I am using the following code to compute an OBB via vtkOBBTree for a set of
points.
Labeled points from my own data-structure are pushed in a vtkPoints instance
and then ComputeOBB from the vtkOBBTree class is called.
Sometimes the resulting OBB seems to be correct, sometimes even the value in
OBB_corner is definitely wrong.
Any Hints? Do I use the method ComputeOBB in a wrong way?

Thx Oliver

--- begin source code ---

vtkOBBTree* OBBTree = vtkOBBTree::New();
vtkPoints* objectPoints = vtkPoints::New();

//push points of object in objectpoints
double point[3];
for (int x=0;x<pdetectionvolume->columns();++x)
for (int y=0;y<pdetectionvolume->rows();++y)
for (int z=0;z<pdetectionvolume->slices();++z)
{
	if (pdetectionvolume->getvalue(label,x,y,z))
	{
		point[0]=(x*pdicomvolume->pixelspacingx());
		point[1]=(y*pdicomvolume->pixelspacingy());
		point[2]=(z*pdicomvolume->gapbetweenslices());
		objectpoints->insertnextpoint(point);
	}
}

double OBB_corner[3]={-1,-1,-1}, OBB_max[3]={0,0,0}, OBB_mid[3]={0,0,0},
OBB_min[3]={0,0,0}, OBB_size[3]={0,0,0};

OBBTree->ComputeOBB(objectPoints,OBB_corner,OBB_max,OBB_mid,
		OBB_min,OBB_size);
		
--- end source code ---




--
View this message in context: http://vtk.1045678.n5.nabble.com/Problems-with-ComputeOBB-wrong-OBB-computed-tp5728174.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list