Ticket #945 (closed task: fixed)

Opened 5 years ago

Last modified 5 years ago

soy._datatypes.BodyPosition as list-like object

Reported by: ArcRiley Owned by: JonNeal
Priority: Medium Milestone: beta3
Component: soy._datatypes Version: Trunk
Keywords: API Cc:

Description (last modified by ArcRiley) (diff)

Easy one:

Write a datatype called BodyPosition. The __cinit__ will take the Body it's to use as a required argument and store it in self.

It will appear and work much like a Python list, except no .append .remove .pop etc (since it's size is immutable). Attempts to access or set (__getitem__ and __setitem__ python methods) dimensions > 3 will raise a IndexError: position index out of range

Setting one of it's items via BodyPosition[0] = will set the parent instance's ._position[0]. A similar interface could be available via BodyPosition.x (x property).

Body.position.get should return an instance of this class. Body.position.set should accept a tuple, list, or BodyPosition. The latter will copy another Body's .position at that moment.

Change History

comment:1 Changed 5 years ago by ArcRiley

  • Description modified (diff)

comment:2 Changed 5 years ago by ArcRiley

  • Description modified (diff)

comment:3 Changed 5 years ago by JonNeal

  • Owner set to JonNeal

comment:4 Changed 5 years ago by JonNeal

  • Status changed from new to assigned

comment:5 Changed 5 years ago by JonNeal

  • Status changed from assigned to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.