ActionScript 3.0 Design Patterns

(Chris Devlin) #1

228 | Chapter 6: Composite Pattern


Moving a Kinematic Pair


As discussed before, our snake will be a composite object consisting of several con-


nected components that represent a kinematic chain. Kinematic chains are com-


posed of kinematic pairs: two rigid segments connected by a joint. How do


kinematic pairs move and orient themselves? The basic idea is that the parent seg-


ment pulls the child segment. In a simple kinematic pair, the only restriction on


movement is the joint. Because it’s the free end, the parent segment will move and


rotate independent of the child. The child will strive to rotate and orient itself to face


the joint, and move to keep up with its parent.


Figure 6-7 shows a four-step sequence by which a parent segment will pull a child in


a kinematic pair. Even though the parent pulls, the child segment does all the work.


Figure 6-7. Child segment keeping up with parent in a kinematic pair


1


Child

Parent

C 1

P 1

d

Child

C 1

P 1

Parent

P 2

Parent

Child P 1

C 1

P 2

Child

Parent

P 2

C 1

R

C 2

2


3 4

Free download pdf