def convert_to_world_coordinates(self, vector, origin):
        """
        Give a vector in local coordinates, and convert it to world coordinates. The origin should be added as offset.
        For example, vector could be a relative position in local coordinates and origin could be ego car's position.
        If origin is set to 0, then no offset is applied and this API only calculates relative direction.

        In a word, for calculating **points transformation** in different coordinates, origin is required. This is
        because vectors have no origin but origin is required to define a point.
        """
        assert len(vector) == 2 or len(vector) == 3, "the vector should be in shape (2,) or (3,)"
        vector = vector[:2]
        vector = LVector3(*vector, 0.)
        vector = self.engine.origin.getRelativeVector(self.origin, vector)
        project_on_x = vector[0]
        project_on_y = vector[1]
        return np.array([project_on_x, project_on_y]) + np.asarray(origin)

        Give a vector in local coordinates, and convert it to world coordinates. The origin should be added as offset.
        For example, vector could be a relative position in local coordinates and origin could be ego car's position.
        If origin is set to 0, then no offset is applied and this API only calculates relative direction.

        In a word, for calculating **points transformation** in different coordinates, origin is required. This is
        because vectors have no origin but origin is required to define a point.
        
metadrive/base_class/base_object.py