Unless I’m missing something, it seems the “mod” function is returning bogus results.
Discovered this when writing a converter for HSV to RGB. Didn’t work with the built in “mod” funciton. I wrote a custom “mod” function for the script and everything was OK.
I’m using the rhino enabled vb script (am currently coding in the editscript Rhino editor).
Any code with the mod function will do, for example 0.5 Mod 2 should equal 0.5, but Rhino is returning 0.
Option Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version December 7, 2015 10:58:45 PM
Call Main()
Sub Main()
Call Rhino.Print("0.5 Mod 2 = 0.5, but 0.5 Mod 2 = " & 0.5 Mod 2 & " using Rhino Script.")
End Sub
For future reference, I’ve added a new Rhino.FMod function to the Rhino WIP which divides two floating-point numbers and returns the floating-point remainder. You should see this function in next week’s WIP release.