2016/12/27

Color Ramping using linear approximation

R colorRAmpPalette method with linear approximation: Input C1=(r1,g1,b1), C2=(r2,g2,b2), C3=(r3,g3,b3) and k as number of colors to generate Idea: A walk from C1 to C3 passing through C2 with equal steps. Implement The result color list denote by RC Step1 : the first half colors list distance for one step from C1 to C2 denoted by D1: (C2-C1)/((k-1)/2) RC = C1 + 1:int(k/2) * D1 Step 2: if k is odd, add C2 into this list RC = RC + C2 Step 3: the other half color list distance for one step from C2 to C3 denoted by D2: (C3-C2)/((k-1)/2) RC = RC + (C2 + 1:int(k/2) * D2) Step 4: All the element in RC must between 0 and 255

沒有留言:

CC Copyright

創用 CC 授權條款
本著作由Chunhung Chou製作,以創用CC 姓名標示-相同方式分享 3.0 Unported 授權條款釋出。