Оптимизация нормализации вектора / Optimization of vector normalization

This commit is contained in:
Andrey Pokidov 2024-12-05 00:48:12 +07:00
parent 75e5c02609
commit 320e20997c
4 changed files with 14 additions and 14 deletions

View file

@ -73,10 +73,10 @@ namespace BasicGeometry
return 0;
}
float module = MathF.Sqrt(squareModule);
float multiplier = Math.Sqrt(1.0f / squareModule);
this.x1 /= module;
this.x2 /= module;
this.x1 *= multiplier;
this.x2 *= multiplier;
return 1;
}

View file

@ -77,11 +77,11 @@ namespace BasicGeometry
return 0;
}
float module = MathF.Sqrt(squareModule);
float multiplier = Math.Sqrt(1.0f / squareModule);
this.x1 /= module;
this.x2 /= module;
this.x3 /= module;
this.x1 *= multiplier;
this.x2 *= multiplier;
this.x3 *= multiplier;
return 1;
}

View file

@ -73,10 +73,10 @@ namespace BasicGeometry
return 0;
}
double module = Math.Sqrt(squareModule);
double multiplier = Math.Sqrt(1.0 / squareModule);
this.x1 /= module;
this.x2 /= module;
this.x1 *= multiplier;
this.x2 *= multiplier;
return 1;
}

View file

@ -77,11 +77,11 @@ namespace BasicGeometry
return 0;
}
double module = Math.Sqrt(squareModule);
double multiplier = Math.Sqrt(1.0 / squareModule);
this.x1 /= module;
this.x2 /= module;
this.x3 /= module;
this.x1 *= multiplier;
this.x2 *= multiplier;
this.x3 *= multiplier;
return 1;
}