Оптимизация нормализации вектора / Optimization of vector normalization
This commit is contained in:
parent
75e5c02609
commit
320e20997c
4 changed files with 14 additions and 14 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue