Grasshopper

algorithmic modeling for Rhino

I need to create a HSV color, or, which is simpler, HSV to RGB converter to create a color then with rgb.

It seems pretty easy, however both of the methods below fail for some reason:

http://stackoverflow.com/questions/1335426/is-there-a-built-in-c-ne...

http://www.xtremevbtalk.com/showthread.php?t=302304

They both do create incorrect color.

I am attaching the C# implementation component.

I would be very thankful if anybody suggest why this works in a wrong way.

Views: 646

Attachments:

Replies to This Discussion

Try this: *attached *

I got the conversion algorithm from here: http://www.rapidtables.com/convert/color/hsv-to-rgb.htm

Let me know if this helps. I am not sure if it's perfect, but I tested it for most of the values in the table at the bottom of the page and received the same output RGB values, so I'm presuming that it's at least close to the answer you are after.

To be honest, the code from SO confused me, because it wasn't written for GH components, which behave differently because of the way that they recalculate themselves when new data is sent to the component. This behavior obviates the need for the while-loops that you see in the SO code. Good luck!

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service