[ot|[spam][crazy] Struggles with OOP and Trees

Undiscussed Horrific Abuse, One Victim of Many gmkarl at gmail.com
Fri Mar 18 05:56:51 PDT 2022


Hierarchical particles.

When I was an adolescent I made 3d graphics engines a lot, so I'm probably
remembering the object and transformation hierarchies they have, a little.

def update(self, ms):
  for child in self.children:
    child.update(ms)
  self.pos +=

I think I'd like to figure out how to integrate a constant acceleration.
There are also libraries for symbolic integration, I understand.

I guess for now I'll just write the same old thing.

def update(self, ms):
  for child in self.children:
    child.update(ms)
  self.pos += self.vel * ms
  self.vel += self.accel * ms
  self.age += ms

---

Maybe it could be nice to write some code to transform between graphs and
property matrices.  Trying to keep the code small and abbreviated enough to
consider using it.

I'm imagining maybe the properties of objects would refer to a matrix.

@property
def pos(self):
  return self.prop_matrix[self.particle_index, 0:3]

Seems it could be helpful, if the code is reusable, to define a mapping
between names and ranges of a property vector.

Let's think about how this could be used.

I could write the update function once on all the particles, if I used
operators that broadcast over the particle index.

I'm wondering whether to have the index be the first or second dimension.
I'm considering trying the first because the transformers library uses the
first dimensions as batch dimensions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/html
Size: 2272 bytes
Desc: not available
URL: <https://lists.cpunks.org/pipermail/cypherpunks/attachments/20220318/41c99075/attachment.txt>


More information about the cypherpunks mailing list