Jump to content

poing


zbhoudini

Recommended Posts

i have a problem with my vex learning,i don't know how to express some certain point's position with vex;for example,there are three points,point1,point2,point3;how to write expression like this:first i use import() to get position from point1,then i want to assign point1'position to point2'position(point2.P=point1.P),how to do this?anyone help me?thank u.

Link to comment
Share on other sites

i have a problem with my vex learning,i don't know how to express some certain point's position with vex;for example,there are three points,point1,point2,point3;how to write expression like this:first i use import() to get position from point1,then i want to assign point1'position to point2'position(point2.P=point1.P),how to do this?anyone help me?thank u.

In VEX you're working with just one "current" point (implicit model) which VEX engine gives to your code. You can't "say" in your code "Please take that point number 25 and set it's coordinate to {0.0f, 0.0f, 0.0f}". If you need that particular "point number 25" you could say "if current point has a number equal to 25 do something". But even if you can't operate on particular point of geometry directly (you can do that using Python) you still can fetch attributes from "any point" in different ways:

1. One of the forms of import():

int import(string attrib_name, type result&; int input; int pt_num)

2. Using point clouds

How your task could be done:

...

vector p;

// First input is 0, second 1 and so on. Suppose your SOP has two inputs,
// first for actual geometry, second for sampling purposes
int	  input = 1;

// ptnum is a global variable which gives a number of current point, "ptnum - 1" is a previous point
int	  pt_num = ptnum - 1;

import("P", p, input, pt_num);
P = p;

But also you have to check correctness of pt_num. For point with number 0 you'll get pt_num == -1 which is wrong. Probably it could be Npt - 1.

Edited by hoknamahn
Link to comment
Share on other sites

In VEX you're working with just one "current" point (implicit model) which VEX engine gives to your code. You can't "say" in your code "Please take that point number 25 and set it's coordinate to {0.0f, 0.0f, 0.0f}". If you need that particular "point number 25" you could say "if current point has a number equal to 25 do something". But even if you can't operate on particular point of geometry directly (you can do that using Python) you still can fetch attributes from "any point" in different ways:

1. One of the forms of import():

int import(string attrib_name, type result&; int input; int pt_num)

2. Using point clouds

How your task could be done:

...

vector p;

// First input is 0, second 1 and so on. Suppose your SOP has two inputs,
// first for actual geometry, second for sampling purposes
int	  input = 1;

// ptnum is a global variable which gives a number of current point, "ptnum - 1" is a previous point
int	  pt_num = ptnum - 1;

import("P", p, input, pt_num);
P = p;

But also you have to check correctness of pt_num. For point with number 0 you'll get pt_num == -1 which is wrong. Probably it could be Npt - 1.

thank you hoknamahn!

i have a sin() wave curve with 50 points in node's input 2,a grid with 4 rows and 50 columns.what i want to do is ptnum0's position of sin()curve correspond to grid's punum[0-3],curve ptnum1-grid ptnum[4-8];

this is my code,but failed.

vector positionfrominput2,current;int i,j;
for(i=0;i<50;i++)
		for(j=4*i;j<4*i+4;j++)
{
  import("P",positionfrominput2,1,i);
  import("P",current,0,j);
  current.y=positionfrominput2.y;
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...