I have a list triangles like in the form of
type alias Vertex = {position: vec3}
List (Vertex,Vertex,Vertex)
now I want to calculate the the normal vertex of every vertex of a triangle. Therefor I need to calculate the normal of the triangle first, which is not the problem. I can model a triangle with normal like this :
type alias Triangle = {normal: Vertex, points: (Vertex,Vertex,Vertex)}
Then map over the original list and calculate normals for the triangle.
But then I need to find all triangles set share the same point to calculate the normal for this point from all the normals of this triangles. And then I would need to update this all the triangles with the result to store the normal in all its vertices. Te result would then be in the format of:
type alias Vertex = {position: vec3, normal: vec3}
List (Vertex,Vertex,Vertex)
So I have the feeling working with lists is maybe not the best idea but I have no clue where to start.