A basic question about vex

   495   1   1
User Avatar
Member
1 posts
Joined: May 2023
Offline
I want the previous point on the curve to always be higher than the next one,I don't know what's wrong with the code.But I found that reading the P attribute of i-1 is always a fixed value

Attachments:
ques.png (804.6 KB)

User Avatar
Member
218 posts
Joined: May 2017
Offline
When running over detail you can use a for loop:
for (int i = 0; i < npoints(0); ++i)
{
    vector prev_pos = point(0, 'P', i - 1);
    setpointattrib(0, 'prev_pos', i, prev_pos, 'set');
}

As run over points you dont need to iterate again over all points:
v@prev_pos = point(0, 'P', @ptnum - 1);

Attachments:
prev_pos.jpg (39.7 KB)

  • Quick Links