From 85fa1fc7b08b2543a61b9cf80ce0a19db93660ff Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Tue, 3 Sep 2019 17:48:15 +0200 Subject: [PATCH] MacroRugoCompound: limit generated aprons fields precision to 3 decimals --- src/macrorugo/macrorugo_compound.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/macrorugo/macrorugo_compound.ts b/src/macrorugo/macrorugo_compound.ts index 44e24b7e..d2f7c882 100644 --- a/src/macrorugo/macrorugo_compound.ts +++ b/src/macrorugo/macrorugo_compound.ts @@ -1,3 +1,4 @@ +import { round } from "../base"; import { CalculatorType } from "../compute-node"; import { ParamCalculability } from "../param/param-definition"; import { Props } from "../props"; @@ -181,10 +182,11 @@ export class MacrorugoCompound extends MacroRugo implements Observer { lastBorder = 0; for (const xCenter of xCenters) { this.addDefaultChild(); - this.children[this.children.length - 1].prms.ZF1.singleValue = + this.children[this.children.length - 1].prms.ZF1.singleValue = round( this.prms.ZRL.singleValue + xCenter / this.prms.BR.singleValue - * (this.prms.ZRR.singleValue - this.prms.ZRL.singleValue); - this.children[this.children.length - 1].prms.B.singleValue = (xCenter - lastBorder) * 2; + * (this.prms.ZRR.singleValue - this.prms.ZRL.singleValue) + , 3); + this.children[this.children.length - 1].prms.B.singleValue = round((xCenter - lastBorder) * 2, 3); lastBorder += this.children[this.children.length - 1].prms.B.singleValue; } } -- GitLab