# How could I set a point's normal, to a direction between two half-edges?

## Recommended Posts

Hi;

Using a point wrangle, I retrieved angle between two half-edges of a point:

```int SelectedPoint = 1;

int SelectedPointHedge = pointhedge(0,SelectedPoint);
int AngleSrcPtnum = hedge_srcpoint(0,(hedge_presrcpoint(0, SelectedPointHedge)));
int AngleDestPtnum = hedge_dstpoint(0, SelectedPointHedge);

vector SelectedPointPos = point(0, "P", SelectedPoint);
vector pApos = point(0, "P", AngleSrcPtnum);
vector pBpos = point(0, "P", AngleDestPtnum);

vector V1 = normalize(pApos - SelectedPointPos);
vector V2 = normalize(pBpos - SelectedPointPos);

How could I set(rotate) that point's normal, to a direction between two connected half-edges?

Thanks for helping.

Angles.hip

cross product

##### Share on other sites

4 minutes ago, MilesS1 said:

cross product

Hi;

Unfortunately,  I'm not good at math so I don't know how to use cross product.

##### Share on other sites

That's fine, check this out:

##### Share on other sites

2 hours ago, MilesS1 said:

That's fine, check this out:

I checked it, but Cross Product gives me a new vector that is perpendicular to two other vectors, which is not what I need.

##### Share on other sites

if you average the cross products of the vector of the edge directions of the corners: cross(normalize(pos1-pos2), {0,1,0}) and  cross(normalize(pos0-pos1), {0,1,0}), you should have your vector (or the anti vector not sure from the top of my head)

Edited by acey195
##### Share on other sites

Hi,

yes with the cross product you can create a rotation axis (check file).

AnglesRot.hipnc

##### Share on other sites

since your vectors V1 and V2 are already normalized, to get your desired vector V just get the average and normalize again, you'll get the middle vector

`v@V = normalize(avg(V1,V2));`

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

×
×