How could I transform a point based on Normal?
6723 7 0- Masoud
- Member
- 407 posts
- Joined: Aug. 2015
- Offline
Hi;
As you can see in my attached image, I have a point on a surface.
Using point wrangle I found a primitive on a sphere, then I retrieved that primitive's Normal, and …
Problem is: When I try to move that point along it's local axis, it moves along XYZ of wold axis.
How could I covert it's movement from World to Local axis?
Thanks.
As you can see in my attached image, I have a point on a surface.
Using point wrangle I found a primitive on a sphere, then I retrieved that primitive's Normal, and …
Problem is: When I try to move that point along it's local axis, it moves along XYZ of wold axis.
How could I covert it's movement from World to Local axis?
Thanks.
Masoud Saadatmand (MSDVFX)
- Olaf Finkbeiner
- Member
- 323 posts
- Joined: Jan. 2015
- Online
- Masoud
- Member
- 407 posts
- Joined: Aug. 2015
- Offline
- anon_user_40689665
- Member
- 648 posts
- Joined: July 2005
- Offline
- Masoud
- Member
- 407 posts
- Joined: Aug. 2015
- Offline
Hi “cpb”;
Thank you, but my problem is not to retrieve Normals of scattered points.
Here is what I want to do:
1) I create some points on a geometry using scatter.
2) Then I find a primitive near to each point, and I assign the Normal of that primitive to that point.
3) Now I want to move scattered points. So I tried to use:
The problem is: it moves the point along World X-axis.
I attached my file here.
Thank you, but my problem is not to retrieve Normals of scattered points.
Here is what I want to do:
1) I create some points on a geometry using scatter.
2) Then I find a primitive near to each point, and I assign the Normal of that primitive to that point.
int PrimNumber; vector Prim_uv; float maxdist = 5; xyzdist(1, @P, PrimNumber, Prim_uv, ch("MaxDist")); if (PrimNumber!=-1) { @N = prim_normal(1, PrimNumber, Prim_uv); } @P.x += ch("x"); @P.z += ch("z");
3) Now I want to move scattered points. So I tried to use:
@P.x += ch("x");
The problem is: it moves the point along World X-axis.
I attached my file here.
Edited by Masoud - Oct. 19, 2017 03:20:10
Masoud Saadatmand (MSDVFX)
- anon_user_40689665
- Member
- 648 posts
- Joined: July 2005
- Offline
- bonsak
- Member
- 459 posts
- Joined: Oct. 2011
- Offline
This will move the scattered points parallel to the primitive the normal is coming from:
-b
int PrimNumber; vector Prim_uv; float maxdist = 5; xyzdist(1, @P, PrimNumber, Prim_uv, ch("MaxDist")); if (PrimNumber!=-1) { @N = prim_normal(1, PrimNumber, Prim_uv); } v@x = normalize(cross(@N, @P)); // Find the axis perpendicular to the normal v@z = normalize(cross(@N, @x)); // Find the axis perpendicular to the plane @N @x @P += @x*chf('X'); @P += @z*chf('Z');
-b
- Masoud
- Member
- 407 posts
- Joined: Aug. 2015
- Offline
Thank you “Bonsak”;
It works fine for me.
—————————–
and
Thank you “Cbp”, too;
You solution is great, but to be honest I didn't understand how it works. So I began to read about “VEX SOP geometry node” that you used in you solution.
—————————–
I used the code as Bonsak said. now each points moves along it's axis. But now new problem is I need to align all point's X axis to same direction.
It works fine for me.
—————————–
and
Thank you “Cbp”, too;
You solution is great, but to be honest I didn't understand how it works. So I began to read about “VEX SOP geometry node” that you used in you solution.
—————————–
I used the code as Bonsak said. now each points moves along it's axis. But now new problem is I need to align all point's X axis to same direction.
Masoud Saadatmand (MSDVFX)
-
- Quick Links