table = [2400,600,600]
lamp = [3600,900,300]
rug = [3000,5,2400]
I want to convert them into coordinates local to the house. The room relative to the house is at [12000,0,8000]
I want to keep the objects' names, but, so to speak, suffix them with .house to indicate house based coordinates, i.e.
table.house = [14400,600,8600]
lamp.house = [15400,900,8300]
- this being the sum of the coordinates of the table and the room ([2400,600,600] + [12000,0,8000]).
Using the following class, I can convert to house based coordinates:
- Code: Select all
self.house = room_coords + house
However, the entry must be in the form:
table = room_to_house_coords(table)
Is there any way of avoiding the repetition of the object, in this case 'table'?
Lastly, if I have a long list of room-coordinate based objects and want to convert them all to house-based ones, what is the best way of setting up such a loop? Would this involve extracting keys from the class dictionary?
Many thanks for your help.