I want to get the P.x value of one specific point in VEX.

204   3   1
Member
8 posts
Joined: Jan. 2017
Offline
See image: I'm trying to get the P.x value of Point5 to add to the position of @P.x. But I only get value 0 in my vector. Input geo 0 is a line.

What I want to achieve is having the middle point of my line in the center of the scene after the chramp. As if I copy paste the P.x value of pt5 in a transform. Or is there another way?

```@numpt -= 1;
float ramp = float(@ptnum)/float(@numpt);
ramp = chramp('ramp',ramp);
@P.x = ramp*ch('scale')*ch('rampscale');

v@middle = point(0,'P',5);
```

Thanks!
Edited by joostjordens - Oct. 18, 2018 19:28:46

Attachments:
PositionofPT5.PNG (367.3 KB)

Director, Artist
joostjordens.com
Member
1310 posts
Joined: Sept. 2015
Offline
From what your saying did you want to make sure pt. 5s' x value becomes 0, while at the same time overall having some control of the lines shape with a ramp?

If so, this does it. And because I am using a B-spline controls like you used, it's necessary to put additional control handles on each side of the target control that is going to be for your pt that you want to make sure is 0.

This way with the fit functions you don't have to ‘fiddle’ around and manually bring it to 0.

Also while being able to transform the whole line to any value - while pt.5s' x value remains 0.
Edited by BabaJ - Oct. 18, 2018 21:25:13

Attachments:
Move Px to Centerx.hiplc (79.4 KB)

Member
7 posts
Joined: July 2018
Offline
vertex, point, prim, detail functions will get you an attribute information of the geometry from your node's input.
You must calculate ramp of the middle point by yourself.

```@numpt -= 1;

float middle_ramp = chramp('ramp', float(@numpt/2)/float(@numpt))*ch('scale')*ch('rampscale');

float ramp = float(@ptnum)/float(@numpt);
ramp = chramp('ramp',ramp);
@P.x = ramp*ch('scale')*ch('rampscale')-middle_ramp;

v@middle = point(0,'P',5);
```
Member
8 posts
Joined: Jan. 2017
Offline
Thank you @BabaJ & @HaloFX!
Edited by joostjordens - Oct. 23, 2018 08:12:02
Director, Artist
joostjordens.com