Optimize calculate_volumetric_multiplier

This commit is contained in:
Scott Lahteine 2015-02-23 18:10:35 -08:00
parent 3ba47ea277
commit 0cf0c20532

View File

@ -4695,18 +4695,9 @@ bool setTargetedHotend(int code){
float calculate_volumetric_multiplier(float diameter) { float calculate_volumetric_multiplier(float diameter) {
float area = .0; if (!volumetric_enabled || diameter == 0) return 1.0;
float radius = .0; float d2 = diameter * 0.5;
return 1.0 / (M_PI * d2 * d2);
radius = diameter * .5;
if (! volumetric_enabled || radius == 0) {
area = 1;
}
else {
area = M_PI * pow(radius, 2);
}
return 1.0 / area;
} }
void calculate_volumetric_multipliers() { void calculate_volumetric_multipliers() {