don’t trust the documentation. Box3 was added in MAX 2015 (but kept secret )
we can change to:
fn makeBBox points =
(
b = box3()
expandToInclude b points -- where points is an array
b
),
the JS code is:
while (cellQueue.length) {
// pick the most promising cell from the queue
var cell = cellQueue.pop();
// update the best cell if we found a better one
if (cell.d > bestCell.d) {
bestCell = cell;
if (debug) console.log('found best %f after %d probes', Math.round(1e4 * cell.d) / 1e4, numProbes);
}
// do not drill down further if there's no chance of a better solution
if (cell.max - bestCell.d <= precision) continue;
while is going until cellQueue has items, where cellQueue.pop() pops top item and shrink the list…
Yes, now it is clear. Thank you. I though that this means that the loop has to be stopped, but…
// do not drill down further if there's no chance of a better solution
is the routine “alignment” dependent ? as local values give different result to world values. Perhaps not, strange things going on
quite a fun routine… the original c++ works on polys with holes (any other poly after the “first”)… could possibly use if for some kind of mapping layout tool.
this was a rectangle with a few shapes drawn in it and the when the new point of inaccessibility found an new shape drawn round that and repeat
Denis, I have found something strange.
The yellow point is created from the first code which you posted.
The red line is created from the last code.
Here is the same spline as an fbx file(saved in max2020): https://drive.google.com/file/d/1HPGhEfTQMzLGcjtPjHNLppfTBdXWNrmL/view?usp=sharing
I told above that the ring (array of spline points) must be closed for last version. It’s much faster for MXS to not do condition in loops.
Closed – means that the first point is added to the end (duplicated).
Serejah, thank you for this site.
I have pasted the coordiantes of the points of the spline in my previous post, but the result which the code calculates is not as expected. No matter if I use the world or the local coordinates of the knots the returned result is far from the expected one. I know the reason is in the code. Maybe I will try some of the other c# implementations to see what will happen.