Search found 12 matches
- Fri Mar 11, 2022 6:49 pm
- Forum: General
- Topic: HSV to RGB solution
- Replies: 25
- Views: 13323
Re: HSV to RGB solution
yeah, I have no idea what could be the cause of that. But, I hacked together this little vision representation of what I'm trying to accomplish here. The dot following the circle represents H and the dot following the triangle represents the 'ratio' between whichever to colors it falls between, or ...
- Wed Mar 09, 2022 8:22 pm
- Forum: General
- Topic: HSV to RGB solution
- Replies: 25
- Views: 13323
Re: HSV to RGB solution
Good, but there are still problems. A blue hue is supposed to be at 240°; however, if you look at the image obtained with the main.lua program above, you'll see that primary colours invade the neighbouring secondary colour's hue, forming triangles, instead of being uniformly changing vertical bars....
- Tue Mar 08, 2022 10:22 pm
- Forum: General
- Topic: HSV to RGB solution
- Replies: 25
- Views: 13323
Re: HSV to RGB solution
Did you measure using LuaJIT? Can you show your benchmark? I've found two major problems with your formulation. First, when h = 0 it returns no results. This is bad; h = 0 should be a valid input. Second, v is not working as it should: you always get one component equal to 1, so you can never produ...
- Mon Mar 07, 2022 10:40 pm
- Forum: General
- Topic: HSV to RGB solution
- Replies: 25
- Views: 13323
Re: HSV to RGB solution
That select function is an interesting take, but, it broke on the second vertex, and on the third it didn't return one of the color values. It works for me, I can't reproduce the results you're reporting. Also I already tried that clamp function, and the min/max method appears to be slightly slower...
- Sat Mar 05, 2022 12:43 am
- Forum: General
- Topic: HSV to RGB solution
- Replies: 25
- Views: 13323
Re: HSV to RGB solution
I realized I forgot to incorporate the value, I also made some slight changes. local ceil = math.ceil local abs = math.abs local function clamp(v, min, max) if v < min then return min end if v > max then return max end return v end function HSV(h, s, v) v = v or 1; s = (1 - s) * v or 0 local vert = ...
- Sat Mar 05, 2022 12:06 am
- Forum: General
- Topic: HSV to RGB solution
- Replies: 25
- Views: 13323
Re: HSV to RGB solution
r, g, b = select(4 - vert, g, b, r, g, b) return r, g, b However, select() breaks traces, so it's not very recommended. The `if` version will probably perform better. I'd remove the last `if`, though: assume that if it's not 1 or 2, it must be 3. Also, clamp() could be improved: local min, max = ma...
- Sat Mar 05, 2022 12:04 am
- Forum: General
- Topic: HSV to RGB solution
- Replies: 25
- Views: 13323
Re: HSV to RGB solution
that is quite an interesting solution, I might try that. Although I think the if statements are easier on the eyes personally.darkfrei wrote: ↑Fri Mar 04, 2022 8:15 amCode: Select all
r, g, b = vert==1 and r,g,b or vert==2 and b,r,g or g,b,r return r, g, b
Also broke when shifting to vertex 2
- Fri Mar 04, 2022 2:01 am
- Forum: General
- Topic: HSV to RGB solution
- Replies: 25
- Views: 13323
HSV to RGB solution
Hello! I have been working on a different method for converting HSV to RGB and I figured I would share it. I was also wonder if there was a solution to shifting 3 return values other than using that if-statement block at the bottom? local ceil = math.ceil local abs = math.abs local function clamp(v,...
- Tue Apr 21, 2020 2:42 am
- Forum: Support and Development
- Topic: Crash
- Replies: 7
- Views: 3819
Re: Crash
I solved the problem thanks for the support, was really helpful!
- Wed Apr 15, 2020 12:32 am
- Forum: Support and Development
- Topic: Crash
- Replies: 7
- Views: 3819
Re: Crash
The disk thing is a good idea and is gonna need to me implemented anyways, I went ahead and made a much smaller and quicker and just generally less messy version of this and its working a lot better. With that being said, is there a fast and efficient way of storing tables on disk?