Changed abs() to std::abs() in a few places.

This commit is contained in:
David Williams 2012-01-05 21:01:23 +00:00
parent 4dd6b296c1
commit 8b866c9c47
4 changed files with 17 additions and 17 deletions

View File

@ -249,7 +249,7 @@ namespace PolyVox
float AStarPathfinder<VolumeType, VoxelType>::SixConnectedCost(const Vector3DInt32& a, const Vector3DInt32& b)
{
//This is the only heuristic I'm sure of - just use the manhatten distance for the 6-connected case.
uint32_t faceSteps = abs(a.getX()-b.getX()) + abs(a.getY()-b.getY()) + abs(a.getZ()-b.getZ());
uint32_t faceSteps = std::abs(a.getX()-b.getX()) + std::abs(a.getY()-b.getY()) + std::abs(a.getZ()-b.getZ());
return faceSteps * 1.0f;
}
@ -270,9 +270,9 @@ namespace PolyVox
//Can't say I'm certain about this heuristic - if anyone has
//a better idea of what it should be then please let me know.
uint32_t array[3];
array[0] = abs(a.getX() - b.getX());
array[1] = abs(a.getY() - b.getY());
array[2] = abs(a.getZ() - b.getZ());
array[0] = std::abs(a.getX() - b.getX());
array[1] = std::abs(a.getY() - b.getY());
array[2] = std::abs(a.getZ() - b.getZ());
//Maybe this is better implemented directly
//using three compares and two swaps... but not

View File

@ -302,7 +302,7 @@ namespace PolyVox
{
//All four vertices of a given quad have the same material,
//so just check that the first pair or vertices match.
if(fabs(m_meshCurrent->getVertices()[q1.vertices[0]].getMaterial() - m_meshCurrent->getVertices()[q2.vertices[0]].getMaterial()) < 0.001)
if(std::abs(m_meshCurrent->getVertices()[q1.vertices[0]].getMaterial() - m_meshCurrent->getVertices()[q2.vertices[0]].getMaterial()) < 0.001)
{
//Now check whether quad 2 is adjacent to quad one by comparing vertices.
//Adjacent quads must share two vertices, and the second quad could be to the

View File

@ -123,15 +123,15 @@ namespace PolyVox
int dk = ((z1 < z2) ? 1 : ((z1 > z2) ? -1 : 0));
float minx = floorf(x1), maxx = minx + 1.0f;
float tx = ((x1 > x2) ? (x1 - minx) : (maxx - x1)) / abs(x2 - x1);
float tx = ((x1 > x2) ? (x1 - minx) : (maxx - x1)) / std::abs(x2 - x1);
float miny = floorf(y1), maxy = miny + 1.0f;
float ty = ((y1 > y2) ? (y1 - miny) : (maxy - y1)) / abs(y2 - y1);
float ty = ((y1 > y2) ? (y1 - miny) : (maxy - y1)) / std::abs(y2 - y1);
float minz = floorf(z1), maxz = minz + 1.0f;
float tz = ((z1 > z2) ? (z1 - minz) : (maxz - z1)) / abs(z2 - z1);
float tz = ((z1 > z2) ? (z1 - minz) : (maxz - z1)) / std::abs(z2 - z1);
float deltatx = 1.0f / abs(x2 - x1);
float deltaty = 1.0f / abs(y2 - y1);
float deltatz = 1.0f / abs(z2 - z1);
float deltatx = 1.0f / std::abs(x2 - x1);
float deltaty = 1.0f / std::abs(y2 - y1);
float deltatz = 1.0f / std::abs(z2 - z1);
m_sampVolume.setPosition(i,j,k);
m_result.previousVoxel = Vector3DInt32(i,j,k);

View File

@ -108,15 +108,15 @@ namespace PolyVox
int dk = ((z1 < z2) ? 1 : ((z1 > z2) ? -1 : 0));
float minx = floorf(x1), maxx = minx + 1.0f;
float tx = ((x1 > x2) ? (x1 - minx) : (maxx - x1)) / abs(x2 - x1);
float tx = ((x1 > x2) ? (x1 - minx) : (maxx - x1)) / std::abs(x2 - x1);
float miny = floorf(y1), maxy = miny + 1.0f;
float ty = ((y1 > y2) ? (y1 - miny) : (maxy - y1)) / abs(y2 - y1);
float ty = ((y1 > y2) ? (y1 - miny) : (maxy - y1)) / std::abs(y2 - y1);
float minz = floorf(z1), maxz = minz + 1.0f;
float tz = ((z1 > z2) ? (z1 - minz) : (maxz - z1)) / abs(z2 - z1);
float tz = ((z1 > z2) ? (z1 - minz) : (maxz - z1)) / std::abs(z2 - z1);
float deltatx = 1.0f / abs(x2 - x1);
float deltaty = 1.0f / abs(y2 - y1);
float deltatz = 1.0f / abs(z2 - z1);
float deltatx = 1.0f / std::abs(x2 - x1);
float deltaty = 1.0f / std::abs(y2 - y1);
float deltatz = 1.0f / std::abs(z2 - z1);
m_sampVolume.setPosition(i,j,k);