Created
September 9, 2020 08:10
-
-
Save kellyelton/aee606081a0add085646565f15aab7db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright Kelly Elton 2020 | |
# All Rights Reserved | |
set x to 0 | |
set y to 0 | |
function add with othervector vector | |
return vector | |
x: .x + othervector.x | |
y: .y + othervector.y | |
function distance with tovector vector | |
set left to .math.pow | |
value: tovector.x - .x | |
power: 2 | |
set right to .math.pow | |
value: tovector.y - .y | |
power: 2 | |
return .math.sqrt | |
value: left + right | |
function normalize | |
set distance to .math.sqrt | |
value: .x * .x + .y * .y | |
return vector | |
x: .x / distance | |
y: .y / distance | |
operator + with othervector vector | |
return add with othervector: othervector |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment