require "matrix"
v1 = Vector[14.0, 21.0]
v2 = Vector[17.0, 17.0]
(v2 - v1).r
# => 5.0
# (v2 - v1).magnitude
# (v2 - v1).norm
# も同じ
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
31