Average value in a List of mesh's vertex normals


its the first time i use the forum and i’m a noob with c# :smiley:
i have a problem with a rhino script command.
i need the avarage vector in a mesh list normals.

thats the part of my script where i want to calculate it.

foreach (var meshval in meshlist)
Vector3f vettm = meshval.Normals.Average(Func<Vector3f,int> selector);

i realy dont know how to use the Average command in this situation. Can someone explain me that ?

Thank you very much.


I can’t seem to find the function Average over here…
Why not add all normals and divide the vector3d by the total loop?

So for exampel:

Dim m As Geometry.Mesh
Dim totalVector As Vector3d
For Each normal In m.Normals
     totalVector += normal
Dim average As Vector3d = totalVector / m.Normals.Count

Ty very much jordy for the reply.

it work :smiley: