Difference between revisions of "Talk:Sqrt - Math"

2 bytes added ,  11:42, 13 July 2023
m
Line 21: Line 21:
; Pythagorean theorem for 3D planes: sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)
; Pythagorean theorem for 3D planes: sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)


float dist = Math.sqrt(Math.pow((coords[3] - coords[0]), 2) + Math.pow((coords[4] - coords[1]), 2) + Math.pow((coords[5] - coords[2]), 2))
float fDist = Math.sqrt(Math.pow((coords[3] - coords[0]), 2) + Math.pow((coords[4] - coords[1]), 2) + Math.pow((coords[5] - coords[2]), 2))
Debug.trace("Travelled " + dist + " units.")
Debug.trace("Travelled " + fDist + " units.")
EndEvent
EndEvent
</source>
</source>
--[[User:Ingvion|Ingvion]] ([[User talk:Ingvion|talk]]) 10:13, 13 July 2023 (EDT)
--[[User:Ingvion|Ingvion]] ([[User talk:Ingvion|talk]]) 10:13, 13 July 2023 (EDT)
67

edits