""" Normalized vector is vector of length 1. Used where one direction is matter. E.g: direction of the view, direction of movement, etc. """ from structures import Vector, Point if __name__ == '__main__': p= Point(3,4) i = Point(1,2) pi = p.subtract(i) normalized_vector = pi.normalized() print("view vector: ", normalized_vector.x, normalized_vector.y) print("view vector length: ", normalized_vector.length())
""" Substraction is used to figure out vector from one point to another V = P(destination) - P(current) """ from structures import Vector, Point if __name__ == '__main__': destination = Point(0, -1) current_position = Point(1, 1) v = destination.subtract(current_position) print(v.x, v.y)