Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type coord
- x as integer
- y as integer
- end type
- function dotProduct(u as coord, v as coord) as double
- return (u.x * v.x) + (u.y * v.y)
- end function
- function norm(u as coord) as double
- return sqr((u.x*u.x) + (u.y*u.y))
- end function
- dim as coord u = type(2, 3)
- dim as coord v = type(5, 1)
- print dotProduct(u, v)
- print norm(u), norm(v)
- print acos(dotProduct(u, v)/(norm(u)*norm(v)))
- sleep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement