Search - User list
Full Version: setting point normals
Root » Technical Discussion » setting point normals
symek
hi everyone,

one question:

how can i set points normals to align curve which they belong to?

I have path, and i would like to copy some geometry on every point of this path but it must me aligned to this path. When I create curve it have no such attribute like point normal, so i'm doing this with point sop, but cannot elaborate how to set these normals aligning path.

thanks for help.

PS if there is different way to copy geo on curve points and face it correct - fine, but the question stiil is interesting.
there is a simple trigonometric expression with tangent to find angle (not vector) of movement upon last and next position but it is much longer way i supose to do simple task. So… help!
stevenong
Hi Symek,

You can create the normals like so:


The Sort SOP is used to shift the point numbers by 1 & in the Point SOP, select “Create Normals” & type the following in the respective parameters:
$TX-$TX2
$TY-$TY2
$TZ-$TZ2

With this setup, we're calculating the vector of the current point from the next & using it as point normal.

However, one thing you might notice is the normal for point 0 is wrong so we'll fix it like so:
if($PT==0,(point(“../curve1”,1,“P”,0)-point(“../curve1”,0,“P”,0)),$TX-$TX2)
if($PT==0,(point(“../curve1”,1,“P”,0)-point(“../curve1”,0,“P”,0)),$TY-$TY2)
if($PT==0,(point(“../curve1”,1,“P”,0)-point(“../curve1”,0,“P”,0)),$TZ-$TZ2)

I used the if() function to check whether the point is point 0 & if true, use the position of point1 to subtract the position of point 0.

I hope the above helps!

Cheers!
steven
MichaelC
And in answer to the PS part of your question, are you using the Sweep SOP? The Sweep SOP can be used to align a copied object on a curve. The object will be aligned with it's Z facing down the Curve, and will allow you to twist and roll objects on the curve. You can make adjustments to the alignment by placing an edit or transform SOP between the Geometry's SOP and the Sweep SOP.
symek
hallo!

i really thank you for answers - it is a big help!

Sweep sop is not a god idea because of futher purpose of my work . With point and copy sops i can deal with it, with sweep cannot.

thanks again!
old_school
If you are using the Copy SOP, then you may also want to supply an up-vector along with your normal. The Copy SOP uses the normal to align the Z-axis and the up-vector aligns the Y-axis. The resultant X-axis is defined by the cross-product of the normal (or velocity) and the up-vector.

You can add and/or access the up-vector using the Point SOP > Particle folder > Up Vector parameter which defaults to $UPX $UPY and $UPZ. Generally one would delete the expressions then use 0 1 0 or whatever your up vector is.

Using a properly formed up-vector will stop your copies from twisting in the wind and your rotate Z in the Copy SOP will start at the up-vector.

The Sweep SOP builds it's own local frame of reference (look-at normal and up-vector). It helps if it has a backbone curve which in essence defines the up-vector so use the same technique for the copy SOP.
symek
O! God! I must really go deep into this topic following your answer! thanks again and need time to elaborate this.
adam_glazier
Just adding some notes too correct stevenong's post.

curve1 should feed into the left Point SOP input and the also feed into the Sort SOP which then feeds into the right input of the Point SOP.

The code needed to create normals within the Point SOP was missing the 0,1,2 within the point() expression. Here is the correct code:
if($PT==0,(point(“../curve1”,1,“P”,0)-point(“../curve1”,0,“P”,0)),$TX-$TX2)
if($PT==0,(point(“../curve1”,1,“P”,1)-point(“../curve1”,0,“P”,1)),$TY-$TY2)
if($PT==0,(point(“../curve1”,1,“P”,2)-point(“../curve1”,0,“P”,2)),$TZ-$TZ2)

Thanks stevenong for answering the question…it came in handy tonight
symek
o man, you bumped my thread with more than 3 years history… little embarrassing.
adam_glazier
And you just bumped it again! heheheh.

This forum is a gold mine. The value of search rivals water
goldfarb
yep..this thread is so old there is now an HDA on the Exchange:
http://www.sidefx.com/index.php?option=com_wrapper&Itemid=149 [sidefx.com]

“Tangent”
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB