Python:ベクトル演算

最終更新日24 Oct 2014 14:12

import math;
import numpy;
loc = numpy.array([100., 100.]);
vel = numpy.array([30., 10]);
 
loc += vel
 
# reseting speed to a default value, maintaining direction
numpy.linalg.norm(vel)
print(vel)
vel *= 200
print(vel)
loc += vel
print(loc)
print("x=%d"%loc[0])

サポートサイト Wikidot.com