[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math

Search:


View post   

>> No.14972657 [View]
File: 4 KB, 592x228, file.png [View same] [iqdb] [saucenao] [google]
14972657

Is there a better way to calculate n given this starting information?
>p1, p2, v1

The way I'm doing it is as follows
>compute L as the distance between p1 and p2
:= sqrt((p2x-p1x)^2 + (p2y-p1y)^2 + (p2z-p1z)^2)
>create the vector v2 but subtracting p1 from p2
:= {p2x - p1x, p2y - p1y, p2z - p1z}
>calculate the angle, theta, between the 2 vectors with arccos of L and the dot product
:= arccos((p1x*p2x + p1y*p2y + p1z*p2z) / L)
>calculate n as hypotenuse * sin(theta)
:= L * sin(theta)

I feel like maybe I'm introducing extra steps, mainly with the points to vector conversion, and then I feel like I should be able to reduce the arccos to get theta and the subsequent sin on theta into a single operation?

Navigation
View posts[+24][+48][+96]