|
|
kurtz le pirate <kur### [at] gmailcom> wrote:
> On 01/05/2024 15:03, esfoster wrote:
> > Hello,
> >
> > I have a set of spheres defined with x, y, z, and size.
> >
> > I want to add a color to them based on their size. e.g larger particles green
> > and smaller particles blue and there would be a gradient assigned to fill the
> > particles in between.
> >
> > I have tried gradients and functions but have not yet gotten it to work.
> >
>
> What I would do :
>
> * First of all : apply jr's recommendation.
>
> * Then :
> - find minimum and maximum radius values
> - calc the interval for radii : dRad = rMax-rMin
> - calc the difference from one color to other color :
> dCol = Color1 - Color2
> - clac the ColorStep = dCol/dRad
>
>
> * finally in the loop of all spheres :
> - calc the color :
> theColor = Color1 + ColorStep*(AllSpheres[i][1]-rMin)
> - draw it
> sphere {
> AllSpheres[i][0], // sphere position
> AllSpheres[i][1] // sphere radius
> pigment { color theColor }
> }
>
>
>
> /just a thought. untested/
>
> --
> Kurtz le pirate
> Compagnie de la Banquise
Thank you to everyone who helped. I ended up making a Matlab script to
interpolate rgb triplets and applying them to my diameters after they were
sorted. Took some work but I loved the result.
Post a reply to this message
Attachments:
Download 'pout.txt' (130 KB)
|
|