MoI discussion forum
MoI discussion forum

Full Version: BoundingBox Info node

From: Barry-H
2 Jul   [#1]
Hi,
I have come across a problem with the boundingbox info node.
The model selected Z dimension is showing twice its actual size.
However Moi shows the correct sizes in the top right display.
this discrepancy only happens with this particular model so far.
Can someone check the code below for possible answers.
Unfortunately I cannot post the model.
The photo shows the issue.
Thanks
Barry

function bBox()
{
this.addInput("In", "objectlist");

this.addOutput("x-length", "numarray");
this.addOutput("y-length", "numarray");
this.addOutput("z-length", "numarray");
this.addOutput("center", "pointarray");

this.bbox = moi.VectorMath.createBoundingBox();
}

bBox.title = "BoundingBox-Infos";
bBox.desc = "BoundingBox-Infos";

bBox.prototype.onExecute = function ()
{
var inObj = this.getInputData(0, moi.geometryDatabase.createObjectList());
// this.bbox.add[i]BoundingBox(inObj.getBoundingBox());
this.bbox = inObj.getHighAccuracyBoundingBox();
var x=[this.bbox.xLength],y=[this.bbox.yLength],z=[this.bbox.zLength];
this.outputs[0].label = x[0].toFixed(2);
this.setOutputData(0, x);
this.outputs[1].label = y[0].toFixed(2);
this.setOutputData(1, y);
this.outputs[2].label = z[0].toFixed(2);
this.setOutputData(2, z);
var center = new pointArray();
center.pushPoint(this.bbox.center);
this.setOutputData(3, center);
}
bBox.prototype.onPropertyChange = function ()



Image Attachments:
Screenshot (800).png 


From: Michael Gibson
2 Jul   [#2] In reply to [#1]
Hi Barry, it's probably either a bug or possibly a malformed trim boundary where pieces of the larger underlying surface are incorrectly being targeted in the bounding box calculation.

You might try running ShrinkTrimmedSrf on it to see if that helps.

It's not likely to be from your script code.

If there are any geometric anomalies like self intersecting surfaces or trim boundaries those could be the cause as well.


re:
> However Moi shows the correct sizes in the top right display.

The top right display uses a different method, it's based off of the display mesh so it can be quick.

- Michael
From: Barry-H
3 Jul   [#3] In reply to [#2]
Thanks Michael,
had tried the shrink surface but no difference.
Cheers
Barry
From: Michael Gibson
3 Jul   [#4] In reply to [#3]
Hi Barry, it's difficult to help with a geometry specific issue without being able to work with the geometry.

The object looks like it might be kind of lumpy and bumpy - is it possible that there are areas of self intersection in its surfaces or trim boundaries?

- Michael