Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test
function VectorLengh(A) return math.sqrt(A[1]*A[1],A[2]*A[2],A[3]*A[3]) end function VectorBetweenPoints(A,B) return {B[1]-A[1],B[2]-A[2],B[3]-A[3]} end function GetAngleBetween3dVectors(A,B) return (A[1]*B[1]+A[2]*B[2]+A[3]*B[3])/(VectorLengh(A)*VectorLengh(B)) end function SolveSolution(V1,V2,V3) local P1 = {table.unpack(V1)} local P2 = {table.unpack(V2)} local P3 = {table.unpack(V3)} local P1P2 = VectorBetweenPoints(P1,P2) local P2P1 = VectorBetweenPoints(P2,P1) local P1P3 = VectorBetweenPoints(P3,P1) local P2P3 = VectorBetweenPoints(P3,P1) local a = VectorLengh(P1P3)*(GetAngleBetween3dVectors(P1P2,P1P3)) local b = VectorLengh(P2P3)*(GetAngleBetween3dVectors(P2P1,P2P3)) local x0 = (P1[1]+a/b*P2[1])/(1+a/b) local y0 = (P1[2]+a/b*P2[2])/(1+a/b) local z0 = (P1[3]+a/b*P2[3])/(1+a/b) return x0,y0,z0 end print(SolveSolution({7,9,0},{19,9,0},{13,6,0}))
run
|
edit
|
history
|
help
0
Hello 2
855
zzz
Surface Area of things (Incomplete)
python like round function in lua
ok
test3
Lua stuff
Visala Test
Enums in Lua (library)