Using edge attribute to set a point position using Geometry Nodes

(Using Blender 3.6.5)

Objective:
My mesh is a set of edges. A function is computed per edge, from its vertices position. This function returns a vector used to create a point cloud, with one point per edge.
The following figure shows a simplified graph miming the intended process. The Mesh Line node creates the edge. The position of the edge end points is recovered chaining Edge Vertices and Sample Index nodes. (NB: the Position socket of the Edge Vertices node is not directly used in this example, because in the complete case, other attributes stored per vertex are required also to compute the function of interest). Two Vector Math nodes are following to compute the edge middle position. The resulting vector is input in a Points node to create a single point. Edge and point are joined to form the output geometry.

Problem:
As shown in the Spreadsheet Editor using a Viewer node, the middle of the edge is correctly computed. But the point displayed in the 3D Viewport is positioned at an end of the edge, not at the middle. (NB: switching off the Viewer node does not change the displayed result).

Analysis:
The attribute computed at edge level is not transferred at vertex level, from the Mesh Line to the Point. The Point is receiving at its Position socket only Point data. This seems related to conflicts between Attribute Domains.

Tested approaches:
I tried different settings using Capture Attribute or Store Named attribute nodes without success.

Resources:
Here is the Blender file:

if it is just a line, you know the indices.

or this:

Be aware that edge vertices (vertex index) are on edge domain, that's why your node tree doesn't work. by first sampling the edge vertex index from edge to then sample on points you will get the right position.

• Thank you very much, your second proposal works fine in the complete case, where I am sampling more than the position. To improve my understanding, could I rephrase yours and lemon's explanations as: 1) vertices index is different between "edge" and "point" domains; 2) the "Edge Vertices" node returns index in "edge" domain, whatever its connections; 3) by connecting the "Viewer" node with domain selected as "Edge", I get right results because everything remains in "edge" domain, as in lemon's proposal; Commented Dec 27, 2023 at 14:40
• (cont) 4) by connecting the "Points" node, I am requesting data in "point" domain, but flowing backward in the graph, it ends up conflicting with the output of the "Edge Vertices" node in "edge" domain; it returns 0 on error, so the "first" node position is returned twice; 5) in your proposal, inserting downstream of the "Edge Vertices" node, two "Sample Index" nodes set on "Edge" and connected to the "Vertex Index i" output, we get the vertices index in "point" domain (is it like remapping the indexes ?); and from there, the input to the "Points" node is correct. Commented Dec 27, 2023 at 14:53

Another possibility (I've changed the calculation to be sure we are not using edge centers):

We stay in edge domain by creating points on this domain, then use edge endpoints to do the calculation (mean or other: here 75% from the last endpoint).

• Thank you very much. I discover and I appreciate the idea of "iterating" over all the edges just by using a "Mesh to Points" node. For the time being, I am debugging with one edge at a time, but I save the counsel for production code. Commented Dec 27, 2023 at 15:03