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

Method resize

Engine/source/navigation/navPath.cpp:339–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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