Show how to properly extract coordinates in the presence of rigid bodies.
8 def print_coordinates(reference_frame, coords):
9 print(reference_frame.get_global_coordinates(coords))
14 def visit(node, reference_frame, reference_frame_factory, particle_factory,
15 segment_factory, ball_factory):
16 if reference_frame_factory.get_is(node):
18 reference_frame, reference_frame_factory.get(node))
19 print(
"reference frame is now", reference_frame)
20 elif segment_factory.get_is(node):
21 segment = segment_factory.get(node)
22 print(
"segment", node.get_name())
24 coords = segment.get_coordinates()
25 for i
in range(0, len(coords[0])):
26 print_coordinates(reference_frame, [coords[0][i],
29 elif particle_factory.get_is(node):
30 particle = particle_factory.get(node)
31 print(
"particle", node.get_name(), print_coordinates(reference_frame, particle.get_coordinates()))
32 elif ball_factory.get_is(node):
33 particle = ball_factory.get(node)
34 print(
"ball", node.get_name(), print_coordinates(reference_frame, particle.get_coordinates()))
35 for c
in node.get_children():
36 visit(c, reference_frame, reference_frame_factory, particle_factory,
37 segment_factory, ball_factory)
43 RMF.ReferenceFrameFactory(fh),
44 RMF.ParticleFactory(fh),
45 RMF.SegmentFactory(fh),