## Hey i kinda need help vectorizing the line below. Mod_normal is a scalar while P1, P2, P3, Prime are points in [xyz] format.

### Muhamad Amirulfaris Abdullah (view profile)

さんによって質問されました 2019 年 7 月 29 日

さんによって 回答されました 2019 年 8 月 6 日
V1 = P2 - prime; V2 = P3 - prime;
alpha = norm(cross_product((V1), (V2)))/ ( Mod_normal);
V1 = P3 - prime; V2 = P1 - prime;
beta = norm(cross_product((V1), (V2)))/ ( Mod_normal);
V1 = P1 - prime; V2 = P2 - prime;
alpha2 = norm(cross_product((V1), (V2)))/ ( Mod_normal);
gamma = 1 - alpha - beta;
gamma2 = 1 - alpha2 - alpha;
gamma3 = 1 - beta - alpha2;
checklist = [alpha, beta,alpha2, gamma2,gamma3, gamma];

#### 4 件のコメント

2019 年 7 月 31 日
What do you mean by "vectorizing the line below"?

### Muhamad Amirulfaris Abdullah (view profile)

2019 年 7 月 31 日
I think it would be easier if I give the code. I attached the code below. I was trying to speed up the code. BAsically the inputs of the function are Three vector points of xyz which is P1 P2 and P3. with P0 as testing pint. The function calculates the distance between point P0 and triangle P123. I was trying to code an alternate method besides David Eberly's pointtriangle distance code. I was wondering if there is any way which i can speed up the code

### Muhamad Amirulfaris Abdullah (view profile)

2019 年 7 月 31 日
here is the link of the cross product function that i create instead of the built in function cross.

サインイン to comment.