use BLI math length functions for distance compositor operations.

This commit is contained in:
Campbell Barton 2012-08-19 10:41:16 +00:00
parent 48eb27791b
commit 58ab8d5c0a
2 changed files with 3 additions and 5 deletions

@ -46,9 +46,7 @@ void DistanceRGBMatteOperation::deinitExecution()
float DistanceRGBMatteOperation::calculateDistance(float key[4], float image[4])
{
return sqrt(pow((key[0] - image[0]), 2) +
pow((key[1] - image[1]), 2) +
pow((key[2] - image[2]), 2));
return len_v3v3(key, image);
}
void DistanceRGBMatteOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)

@ -29,7 +29,7 @@ DistanceYCCMatteOperation::DistanceYCCMatteOperation() : DistanceRGBMatteOperati
float DistanceYCCMatteOperation::calculateDistance(float key[4], float image[4])
{
return sqrt(pow((key[1] - image[1]), 2) +
pow((key[2] - image[2]), 2));
/* only measure the second 2 values */
return len_v2v2(key + 1, image + 1);
}