Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slider Epsilon is always 1 #234

Closed
MaxBZorn opened this issue Feb 1, 2024 · 2 comments
Closed

Slider Epsilon is always 1 #234

MaxBZorn opened this issue Feb 1, 2024 · 2 comments

Comments

@MaxBZorn
Copy link

MaxBZorn commented Feb 1, 2024

Describe the bug

In GrasshopperInOut.cs, SetInputSliderValues(List variables),
double eps = Convert.ToDouble(slider.Slider.Epsilon);
is always 1.
It should be calculated as in SetGenepoolValues(List variables) when not an integer:

private void SetInputSliderValues(List<Variable> variables)
     {
         int i = 0;

         foreach (GH_NumberSlider slider in Sliders)
         {
             decimal min = slider.Slider.Minimum;
             decimal max = slider.Slider.Maximum;
             decimal value = slider.Slider.Value;
             Guid id = slider.InstanceGuid;

             decimal lowerBond;
             decimal upperBond;
             bool isInteger;
             string nickName = slider.NickName;
             if (nickName == "")
             {
                 nickName = "param" + i++;
             }

             double eps = Convert.ToDouble(slider.Slider.Epsilon);
             switch (slider.Slider.Type)
             {
                 case GH_SliderAccuracy.Even:
                     lowerBond = min / 2;
                     upperBond = max / 2;
                     isInteger = true;
                     break;
                 case GH_SliderAccuracy.Odd:
                     lowerBond = (min - 1) / 2;
                     upperBond = (max - 1) / 2;
                     isInteger = true;
                     break;
                 case GH_SliderAccuracy.Integer:
                     lowerBond = min;
                     upperBond = max;
                     isInteger = true;
                     break;
                 default:
                     lowerBond = min;
                     upperBond = max;
                     isInteger = false;
                     break;
             }
             if (!isInteger)
             {
                 eps = Math.Pow(10, -slider.Slider.DecimalPlaces);
             }
             variables.Add(new Variable(Convert.ToDouble(lowerBond), Convert.ToDouble(upperBond), isInteger, nickName, eps, Convert.ToDouble(value), id));
         }
     }
@hrntsm
Copy link
Owner

hrntsm commented Feb 2, 2024

Hi @MaxBZorn ,
Thanks for the issue.

I have checked it in my environment, but I am still able to get values other than 1 for eps with the current implementation without any problem.
Could you please let me know your environment so I can check the cause?

@hrntsm
Copy link
Owner

hrntsm commented Jun 22, 2024

There is no response, so I will close it.
Please reopen if progress is made.

@hrntsm hrntsm closed this as completed Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants