algorithmic modeling for Rhino
Hi,
I'm trying to make a component in C# through visual studio. The idea is that I want to be able to import a coloured mesh, and use the colour value at any point on the mesh. I have made a little method that should be able to find the colour for the closest meshPoint for a point.
public
double GetBrightness()
{
Color tempColor = mesh.ColorAt(mesh.ClosestMeshPoint(point));
return tempColor.GetBrightness();
}
I plug in a mesh that I have sprayed beforehand. But when I try to get the output from the method all brightness-values are just 1.0, even though this is not the case. Anyone who knows what I might be doing wrong? (The ClosestMeshPoint Method works just fine btw)
hope you can help
Timo
Tags:
I think I wrote the Mesh.ColorAt() function. There could be a bug in there but I'll need some time to figure that out as I'm up to my neck in meetings at the moment.
--
David Rutten
david@mcneel.com
Seattle, WA
Actually the [Mesh Eval] component also doesn't return a colour so I think whatever the bug is, it's my fault not yours. I'll see if I have some time today to narrow it down, but it may take a few days.
--
David Rutten
david@mcneel.com
Seattle, WA
Hi David. Thanks a lot for your quick reply.
I'm looking forwar to hear more from you regarding this. When have a mesh-input and I plug in a painted mesh, will the color values then be transfered with the mesh?
I'm just thinking that if this is the case I will be able to program my own component that can calculate a color value anywhere on the mesh from barycentric coordinates. I would like to be able to avoid having a color input parameter in my component, and just store the color information in the mesh.
Is the problem fixed now because I cannot make it work as well. Thanks.
This method has been broken for a long time.
This is probably not it but in the line if (argb < 0) { return Color.Transparent; }
if you are using a signed integer and the alpha channel (the first 8 bits) is 255, wouldn't it always be negative?
(I'm using the browser to read the Rhinocommon source so I can't test it.)
I still see Mesh.ColorAt() not working. It always returns Transparent.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by