vertex-points ( vertices edge-indices face-indices edge-pts face-points -- vertex-pts )


Vocabulary
euler.b-rep.subdivision

Inputs
verticesan object
edge-indicesan object
face-indicesan object
edge-ptsan object
face-pointsan object


Outputs
vertex-ptsan object


Definition


:: vertex-points
( vertices edge-indices face-indices edge-pts face-points -- vertex-pts )
vertices [| vertex |
0
double-4{ 0.0 0.0 0.0 0.0 } double-4{ 0.0 0.0 0.0 0.0 }
vertex edge>> [| valence face-sum edge-sum edge |
valence 1 + face-sum edge face>> face-indices at
face-points nth position>> v+
edge-sum edge next-edge>> vertex>> position>> v+
] each-vertex-edge
:> ( valence face-sum edge-sum ) valence >float
:> fvalence face-sum fvalence v/n
:> face-avg edge-sum fvalence v/n
:> edge-avg face-avg edge-avg v+
vertex position>> fvalence 2.0 - v*n v+ fvalence v/n
<vertex>
] map ; inline