# align to normal

## Recommended Posts

hello! tell me please how can i align the object to the single point with normal?. for example, i have grid with all normals up and i want rotate it so it normals are equal to the normal of some point. i tried Align SOP , copy SOP, sweep SOP..

##### Share on other sites

hello! tell me please how can i align the object to the single point with normal?. for example, i have grid with all normals up and i want rotate it so it normals are equal to the normal of some point. i tried Align SOP , copy SOP, sweep SOP..

use a point SOP on your grid. Then in your normals parameter use a point() expression in X, Y, Z respectively. I use "10" as the point number. Just replace that with whatever point you want the normals to match.

`point("../myPoint", 10, "N", 0), point("../myPoint", 10, "N", 1), point("../myPoint", 10, "N", 2)`

##### Share on other sites

use a point SOP on your grid. Then in your normals parameter use a point() expression in X, Y, Z respectively. I use "10" as the point number. Just replace that with whatever point you want the normals to match.

`point("../myPoint", 10, "N", 0), point("../myPoint", 10, "N", 1), point("../myPoint", 10, "N", 2)`

no, i want rotate the grid not the grid's only normals!

the solution is to convert the direction (normal) to rotation vector (rotation matrix), but maybe some SOP can do it, without writing expressions or VOP SOP?

##### Share on other sites

This is what you want ?

Don't know the way without expressions. Sadly second posibility I know is with VOP SOP.

The biggest fun with Houdini is that you can use expressions everywhere. Later you can make your own asset that will make this.

EDIT: Never mind, I just found problem with my method.

Edited by SWANN
##### Share on other sites

Ok. Solved. Yellow nodes are only to help visualize.

EDIT: Actualy you need only four nodes that are in red box on picture.

rotate_grid_with_point_normal.hipnc

Edited by SWANN
##### Share on other sites

Ok. Solved. Yellow nodes are only to help visualize.

EDIT: Actualy you need only four nodes that are in red box on picture.

thank you very much, SWANN!

(the math solution wasn't very simple:

N1 - first normal, (of grid) - we know

N2 - final normal, (of point) - we know

Rxyz - rotation matrix ,

N2 = Rxyz*N1,

the alpha, beta, gamma(rx, ry,rz) we must find. three equations with sin and cos)

not very simple math for expressions))

Edited by mic
##### Share on other sites

thank you very much, SWANN!

(the math solution wasn't very simple:

N1 - first normal, (of grid) - we know

N2 - final normal, (of point) - we know

Rxyz - rotation matrix ,

N2 = Rxyz*N1,

the alpha, beta, gamma(rx, ry,rz) we must find. three equations with sin and cos)

not very simple math for expressions))

But propably it wil have better results. Metod posted by me gives good results but around zero it makes grid rotation that I don't like.

Edited by SWANN
##### Share on other sites

But propably it wil have better results. Metod posted by me gives good results but around zero it makes grid rotation that I don't like.

another solution i found:

xform axis SOP: scale = 0, recompute normals = 0, direction = N from point

by the way, invert transformation gives us perpendicular..

and the equations weren't so complex as i thought at first.. using tangents and projections two angles can be found.

## 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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×