Skip to main content
Rollback to Revision 2
Source Link

In the middle of a face is an average color of all the vertices. For triangle this means:

Col_RGB = ((R1+R2+R3)/3, (G1+G2+G3)/3, (B1+B2+B3)/3)

Where each vert has color in form of (Rn, Gn, Bn) for n in (1..3).

Here is the implementation:

vert_cols = [( 50,  92, 124),
             (245,   8, 137), 
             ( 42,  23,  21)]
avg_col = tuple(sum(col)/len(col) for col in zip(*vert_cols))

If you want to do this fast use numpy:

import numpy

vert_cols = numpy.array([[ 50,  92, 124],
                         [245,   8, 137], 
                         [ 42,  23,  21]])
avg_col = numpy.mean(vert_cols, axis=0)

In the middle of a face is an average color of all the vertices. For triangle this means:

Col_RGB = ((R1+R2+R3)/3, (G1+G2+G3)/3, (B1+B2+B3)/3)

Where each vert has color in form of (Rn, Gn, Bn) for n in (1..3).

Here is the implementation:

vert_cols = [( 50,  92, 124),
             (245,   8, 137), 
             ( 42,  23,  21)]
avg_col = tuple(sum(col)/len(col) for col in zip(*vert_cols))

If you want to do this fast use numpy:

import numpy

vert_cols = numpy.array([[ 50,  92, 124],
                         [245,   8, 137], 
                         [ 42,  23,  21]])
avg_col = numpy.mean(vert_cols, axis=0)

In the middle of a face is an average color of all the vertices. For triangle this means:

Col_RGB = ((R1+R2+R3)/3, (G1+G2+G3)/3, (B1+B2+B3)/3)

Where each vert has color in form of (Rn, Gn, Bn) for n in (1..3).

added 464 characters in body
Source Link

In the middle of a face is an average color of all the vertices. For triangle this means:

Col_RGB = ((R1+R2+R3)/3, (G1+G2+G3)/3, (B1+B2+B3)/3)

Where each vert has color in form of (Rn, Gn, Bn) for n in (1..3).

Here is the implementation:

vert_cols = [( 50,  92, 124),
             (245,   8, 137), 
             ( 42,  23,  21)]
avg_col = tuple(sum(col)/len(col) for col in zip(*vert_cols))

If you want to do this fast use numpy:

import numpy

vert_cols = numpy.array([[ 50,  92, 124],
                         [245,   8, 137], 
                         [ 42,  23,  21]])
avg_col = numpy.mean(vert_cols, axis=0)

In the middle of a face is an average color of all the vertices. For triangle this means:

Col_RGB = ((R1+R2+R3)/3, (G1+G2+G3)/3, (B1+B2+B3)/3)

Where each vert has color in form of (Rn, Gn, Bn) for n in (1..3).

In the middle of a face is an average color of all the vertices. For triangle this means:

Col_RGB = ((R1+R2+R3)/3, (G1+G2+G3)/3, (B1+B2+B3)/3)

Where each vert has color in form of (Rn, Gn, Bn) for n in (1..3).

Here is the implementation:

vert_cols = [( 50,  92, 124),
             (245,   8, 137), 
             ( 42,  23,  21)]
avg_col = tuple(sum(col)/len(col) for col in zip(*vert_cols))

If you want to do this fast use numpy:

import numpy

vert_cols = numpy.array([[ 50,  92, 124],
                         [245,   8, 137], 
                         [ 42,  23,  21]])
avg_col = numpy.mean(vert_cols, axis=0)
added 134 characters in body
Source Link

In the middle of a face is an average color of all the vertices. For triangle this means:

Col_RGB = ((R1+R2+R3)/3, (G1+G2+G3)/3, (B1+B2+B3)/3)

Col_RGB = ((R1+R2+R3)/3, (G1+G2+G3)/3, (B1+B2+B3)/3)

Where each vert has color in form of RnGnBn(Rn, Gn, Bn) for n in (1..3).

In the middle of a face is an average color of all the vertices. For triangle this means:

Col_RGB = ((R1+R2+R3)/3, (G1+G2+G3)/3, (B1+B2+B3)/3)

Where each vert has color in form of RnGnBn for n in (1..3).

In the middle of a face is an average color of all the vertices. For triangle this means:

Col_RGB = ((R1+R2+R3)/3, (G1+G2+G3)/3, (B1+B2+B3)/3)

Where each vert has color in form of (Rn, Gn, Bn) for n in (1..3).

Source Link
Loading