Changed abs() to std::abs() in a few places.
This commit is contained in:
parent
4dd6b296c1
commit
8b866c9c47
@ -249,7 +249,7 @@ namespace PolyVox
|
|||||||
float AStarPathfinder<VolumeType, VoxelType>::SixConnectedCost(const Vector3DInt32& a, const Vector3DInt32& b)
|
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.
|
//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;
|
return faceSteps * 1.0f;
|
||||||
}
|
}
|
||||||
@ -270,9 +270,9 @@ namespace PolyVox
|
|||||||
//Can't say I'm certain about this heuristic - if anyone has
|
//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.
|
//a better idea of what it should be then please let me know.
|
||||||
uint32_t array[3];
|
uint32_t array[3];
|
||||||
array[0] = abs(a.getX() - b.getX());
|
array[0] = std::abs(a.getX() - b.getX());
|
||||||
array[1] = abs(a.getY() - b.getY());
|
array[1] = std::abs(a.getY() - b.getY());
|
||||||
array[2] = abs(a.getZ() - b.getZ());
|
array[2] = std::abs(a.getZ() - b.getZ());
|
||||||
|
|
||||||
//Maybe this is better implemented directly
|
//Maybe this is better implemented directly
|
||||||
//using three compares and two swaps... but not
|
//using three compares and two swaps... but not
|
||||||
|
@ -302,7 +302,7 @@ namespace PolyVox
|
|||||||
{
|
{
|
||||||
//All four vertices of a given quad have the same material,
|
//All four vertices of a given quad have the same material,
|
||||||
//so just check that the first pair or vertices match.
|
//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.
|
//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
|
//Adjacent quads must share two vertices, and the second quad could be to the
|
||||||
|
@ -123,15 +123,15 @@ namespace PolyVox
|
|||||||
int dk = ((z1 < z2) ? 1 : ((z1 > z2) ? -1 : 0));
|
int dk = ((z1 < z2) ? 1 : ((z1 > z2) ? -1 : 0));
|
||||||
|
|
||||||
float minx = floorf(x1), maxx = minx + 1.0f;
|
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 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 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 deltatx = 1.0f / std::abs(x2 - x1);
|
||||||
float deltaty = 1.0f / abs(y2 - y1);
|
float deltaty = 1.0f / std::abs(y2 - y1);
|
||||||
float deltatz = 1.0f / abs(z2 - z1);
|
float deltatz = 1.0f / std::abs(z2 - z1);
|
||||||
|
|
||||||
m_sampVolume.setPosition(i,j,k);
|
m_sampVolume.setPosition(i,j,k);
|
||||||
m_result.previousVoxel = Vector3DInt32(i,j,k);
|
m_result.previousVoxel = Vector3DInt32(i,j,k);
|
||||||
|
@ -108,15 +108,15 @@ namespace PolyVox
|
|||||||
int dk = ((z1 < z2) ? 1 : ((z1 > z2) ? -1 : 0));
|
int dk = ((z1 < z2) ? 1 : ((z1 > z2) ? -1 : 0));
|
||||||
|
|
||||||
float minx = floorf(x1), maxx = minx + 1.0f;
|
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 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 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 deltatx = 1.0f / std::abs(x2 - x1);
|
||||||
float deltaty = 1.0f / abs(y2 - y1);
|
float deltaty = 1.0f / std::abs(y2 - y1);
|
||||||
float deltatz = 1.0f / abs(z2 - z1);
|
float deltatz = 1.0f / std::abs(z2 - z1);
|
||||||
|
|
||||||
m_sampVolume.setPosition(i,j,k);
|
m_sampVolume.setPosition(i,j,k);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user