MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / resize

Method resize

Engine/source/navigation/navPath.cpp:337–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337void NavPath::resize()
338{
339 if(!mPoints.size())
340 {
341 mObjBox.set(Point3F(-0.5f, -0.5f, -0.5f),
342 Point3F( 0.5f, 0.5f, 0.5f));
343 resetWorldBox();
344 setTransform(MatrixF(true));
345 return;
346 }
347
348 Point3F max(mPoints[0]), min(mPoints[0]), pos(0.0f);
349 for(U32 i = 1; i < mPoints.size(); i++)
350 {
351 Point3F p = mPoints[i];
352 max.x = getMax(max.x, p.x);
353 max.y = getMax(max.y, p.y);
354 max.z = getMax(max.z, p.z);
355 min.x = getMin(min.x, p.x);
356 min.y = getMin(min.y, p.y);
357 min.z = getMin(min.z, p.z);
358 pos += p;
359 }
360 pos /= mPoints.size();
361 min -= Point3F(0.5f, 0.5f, 0.5f);
362 max += Point3F(0.5f, 0.5f, 0.5f);
363
364 mObjBox.set(min - pos, max - pos);
365 MatrixF mat = Parent::getTransform();
366 mat.setPosition(pos);
367 Parent::setTransform(mat);
368}
369
370bool NavPath::plan()
371{

Callers

nothing calls this directly

Calls 6

getMaxFunction · 0.85
Point3FClass · 0.50
MatrixFClass · 0.50
sizeMethod · 0.45
setMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected