From af00d6db1dc36f21081781f4c15e4762c2eb25b3 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Sun, 12 Jan 2020 22:32:26 +0100 Subject: [PATCH] #3338 BBTK Feature New Normal - MAthOperation round rint floor trunc --- packages/std/src/bbstdMathOperation.cxx | 5 +++++ packages/std/src/bbstdMathOperation.h | 2 +- packages/vtk/src/bbvtkCreateImage.cxx | 5 +---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/std/src/bbstdMathOperation.cxx b/packages/std/src/bbstdMathOperation.cxx index ee22c24..a0cd944 100644 --- a/packages/std/src/bbstdMathOperation.cxx +++ b/packages/std/src/bbstdMathOperation.cxx @@ -87,6 +87,11 @@ void MathOperation::Process() if (bbGetInputType()==19) bbSetOutputOut( (int)bbGetInputIn1() % (int)bbGetInputIn2() ); if (bbGetInputType()==20) if (bbGetInputIn1()<(int)bbGetInputIn2()) { bbSetOutputOut(1); } else { bbSetOutputOut(0); } ; if (bbGetInputType()==21) if (bbGetInputIn1()>(int)bbGetInputIn2()) { bbSetOutputOut(1); } else { bbSetOutputOut(0); } ; + if (bbGetInputType()==22) bbSetOutputOut( round( bbGetInputIn1() ) ); + if (bbGetInputType()==23) bbSetOutputOut( rint( bbGetInputIn1() ) ); + if (bbGetInputType()==24) bbSetOutputOut( floor( bbGetInputIn1() ) ); + if (bbGetInputType()==25) bbSetOutputOut( ceil( bbGetInputIn1() ) ); + if (bbGetInputType()==26) bbSetOutputOut( trunc( bbGetInputIn1() ) ); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) diff --git a/packages/std/src/bbstdMathOperation.h b/packages/std/src/bbstdMathOperation.h index 8d6d8ee..a167679 100644 --- a/packages/std/src/bbstdMathOperation.h +++ b/packages/std/src/bbstdMathOperation.h @@ -42,7 +42,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(MathOperation,bbtk::AtomicBlackBox); BBTK_CATEGORY("empty"); BBTK_INPUT(MathOperation,In1,"First input",double,""); BBTK_INPUT(MathOperation,In2,"Second input",double,""); - BBTK_INPUT(MathOperation,Type,"Type (defalult 0): 0 adition (default), 1 sustraction In1-In2, 2 multiplication In1*In2, 3 divisiuon In1/In2, 4 sqrt In1, 5 log In1, 6 exp In1, 7 incremental int [In1..In2], 8 random int [In1..In2], 9 sin In1-rad, 10 cos In1-rad, 11 tan In1-rad, 12 asin In 1, 13 acos In1, 14 atan In1, 15 atan2 In1 In2 , 16 min, 17 max, 18 abs In1, 19 module In1%In2 , 20 lessThan In1In2",int,""); + BBTK_INPUT(MathOperation,Type,"Type (defalult 0): 0 adition (default), 1 sustraction In1-In2, 2 multiplication In1*In2, 3 divisiuon In1/In2, 4 sqrt In1, 5 log In1, 6 exp In1, 7 incremental int [In1..In2], 8 random int [In1..In2], 9 sin In1-rad, 10 cos In1-rad, 11 tan In1-rad, 12 asin In 1, 13 acos In1, 14 atan In1, 15 atan2 In1 In2 , 16 min, 17 max, 18 abs In1, 19 module In1%In2 , 20 lessThan In1In2, 22 round In1, 23 rint In1, 24 floor In1, 25 ceil In1, 26 trunc In1",int,""); BBTK_OUTPUT(MathOperation,Out,"Output",double,""); BBTK_END_DESCRIBE_BLACK_BOX(MathOperation); diff --git a/packages/vtk/src/bbvtkCreateImage.cxx b/packages/vtk/src/bbvtkCreateImage.cxx index 007c347..c534252 100644 --- a/packages/vtk/src/bbvtkCreateImage.cxx +++ b/packages/vtk/src/bbvtkCreateImage.cxx @@ -99,10 +99,7 @@ void CreateImage::Process() spc[2]=1; } //EED 2017-12-7 - if (imageoutput!=NULL) - { - imageoutput->Delete(); - } + if (imageoutput!=NULL) {imageoutput->Delete();} imageoutput = vtkImageData::New(); imageoutput->Initialize(); imageoutput->SetSpacing( spc ); -- 2.45.0