diff --git a/CSFDemo/CSFDemo.cpp b/CSFDemo/CSFDemo.cpp index 5a909eb..1b57022 100644 --- a/CSFDemo/CSFDemo.cpp +++ b/CSFDemo/CSFDemo.cpp @@ -60,6 +60,8 @@ int main(int argc,char* argv[]) cfg.readConfigFile("params.cfg", "time_step", time_step); std::string terr_pointClouds_filepath; cfg.readConfigFile("params.cfg", "terr_pointClouds_filepath", terr_pointClouds_filepath); + std::string height_diff_threshold; + cfg.readConfigFile("params.cfg", "height_diff_threshold", height_diff_threshold); CSF csf; //step 1 Input the point cloud @@ -78,6 +80,7 @@ int main(int argc,char* argv[]) csf.params.interations = atoi(iterations.c_str()); csf.params.rigidness = atoi(rigidness.c_str()); csf.params.time_step = atof(time_step.c_str()); + csf.params.height_diff_threshold = atof(height_diff_threshold.c_str()); //step3 do filtering std::vector groundIndexes, offGroundIndexes; diff --git a/CSFDemo/params.cfg b/CSFDemo/params.cfg index 2832910..7dcc6cf 100644 --- a/CSFDemo/params.cfg +++ b/CSFDemo/params.cfg @@ -4,4 +4,5 @@ cloth_resolution=0.5 rigidness=3 iterations=500 class_threshold=0.5 -time_step=0.65 \ No newline at end of file +time_step=0.65 +height_diff_threshold=0.3 \ No newline at end of file diff --git a/python/CSF/CSF.py b/python/CSF/CSF.py index 9300e43..07e371b 100644 --- a/python/CSF/CSF.py +++ b/python/CSF/CSF.py @@ -555,6 +555,7 @@ class Params(object): cloth_resolution = property(_CSF.Params_cloth_resolution_get, _CSF.Params_cloth_resolution_set) rigidness = property(_CSF.Params_rigidness_get, _CSF.Params_rigidness_set) interations = property(_CSF.Params_interations_get, _CSF.Params_interations_set) + height_diff_threshold = property(_CSF.Params_height_diff_threshold_get, _CSF.Params_height_diff_threshold_set) def __init__(self): _CSF.Params_swiginit(self, _CSF.new_Params()) diff --git a/python/CSF/CSF_wrap.cxx b/python/CSF/CSF_wrap.cxx index 2ef9c9c..58738e2 100644 --- a/python/CSF/CSF_wrap.cxx +++ b/python/CSF/CSF_wrap.cxx @@ -5614,7 +5614,7 @@ SWIG_AsVal_bool (PyObject *obj, bool *val) return success; } - /* Require the given PyArrayObject to to be Fortran ordered. If the + /* Require the given PyArrayObject to be Fortran ordered. If the * the PyArrayObject is already Fortran ordered, do nothing. Else, * set the Fortran ordering flag and recompute the strides. */ @@ -14242,6 +14242,58 @@ SWIGINTERN PyObject *_wrap_Params_interations_get(PyObject *SWIGUNUSEDPARM(self) } +SWIGINTERN PyObject *_wrap_Params_height_diff_threshold_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Params *arg1 = (Params *) 0 ; + double arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + double val2 ; + int ecode2 = 0 ; + PyObject *swig_obj[2] ; + + if (!SWIG_Python_UnpackTuple(args, "Params_height_diff_threshold_set", 2, 2, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Params, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Params_height_diff_threshold_set" "', argument " "1"" of type '" "Params *""'"); + } + arg1 = reinterpret_cast< Params * >(argp1); + ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Params_height_diff_threshold_set" "', argument " "2"" of type '" "double""'"); + } + arg2 = static_cast< double >(val2); + if (arg1) (arg1)->height_diff_threshold = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Params_height_diff_threshold_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Params *arg1 = (Params *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + double result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Params, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Params_height_diff_threshold_get" "', argument " "1"" of type '" "Params *""'"); + } + arg1 = reinterpret_cast< Params * >(argp1); + result = (double) ((arg1)->height_diff_threshold); + resultobj = SWIG_From_double(static_cast< double >(result)); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_new_Params(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; Params *result = 0 ; @@ -15194,6 +15246,8 @@ static PyMethodDef SwigMethods[] = { { "Params_rigidness_get", _wrap_Params_rigidness_get, METH_O, NULL}, { "Params_interations_set", _wrap_Params_interations_set, METH_VARARGS, NULL}, { "Params_interations_get", _wrap_Params_interations_get, METH_O, NULL}, + { "Params_height_diff_threshold_set", _wrap_Params_height_diff_threshold_set, METH_VARARGS, NULL}, + { "Params_height_diff_threshold_get", _wrap_Params_height_diff_threshold_get, METH_O, NULL}, { "new_Params", _wrap_new_Params, METH_NOARGS, NULL}, { "delete_Params", _wrap_delete_Params, METH_O, NULL}, { "Params_swigregister", Params_swigregister, METH_O, NULL}, diff --git a/setup.py b/setup.py index cbccb61..3c2fc54 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ setup( name="cloth_simulation_filter", - version="1.1.5", + version="1.1.6", author="Jianbo Qi", url="http://ramm.bnu.edu.cn/projects/CSF/", long_description=readme_content, diff --git a/src/CSF.cpp b/src/CSF.cpp index 5fb04c3..8a3dcc4 100644 --- a/src/CSF.cpp +++ b/src/CSF.cpp @@ -32,6 +32,7 @@ CSF::CSF(int index) { params.cloth_resolution = 1; params.rigidness = 3; params.interations = 500; + params.height_diff_threshold = 0.3; this->index = index; } @@ -43,7 +44,8 @@ CSF::CSF() { params.cloth_resolution = 1; params.rigidness = 3; params.interations = 500; - this->index = 0; + params.height_diff_threshold = 0.3; + this->index = 0; } CSF::~CSF() @@ -140,7 +142,7 @@ Cloth CSF::do_cloth() { height_num, params.cloth_resolution, params.cloth_resolution, - 0.3, + params.height_diff_threshold, 9999, params.rigidness, params.time_step diff --git a/src/CSF.h b/src/CSF.h index 5ef8d9b..feca5d9 100644 --- a/src/CSF.h +++ b/src/CSF.h @@ -49,6 +49,7 @@ struct Params { double cloth_resolution; int rigidness; int interations; + double height_diff_threshold; }; #ifdef _CSF_DLL_EXPORT_