# Constructing Swimming Training Model Based on Cyclic Coordinate Descent Algorithm

Authors: Haixiong Chen
Journal: Mobile Information Systems
 (2022)

---

## Abstract

In this paper, the cyclic coordinate descent algorithm is used to solve the target attitude of the constrained frame. The motion is smoothed by constructing the motion offset mapping curve near the constraint frame. The motion editing and redirection can be accomplished by adjusting the displacement ratio of root nodes and estimating the initial position. The cyclic coordinate descent algorithm generates the keyframe actions corresponding to the key moments in the virtual human swimming movement cycle division. Then, the spherical linear interpolation based on four elements is used to generate the intermediate frame action in the swimming movement. The simulation results of swimming training show that the method can generate a relatively smooth human swimming process. Finally, a simple simulation of the swimming training model based on the cyclic coordinate descent algorithm is carried out to achieve a more realistic simulation effect. The experimental results show that this method is relatively complete and retains the characteristics of the original motion well, and the redirected motion is smooth and natural.


---

## Body

## 1. Introduction

Swimming is a common and typical movement of the human body. Detailed data analysis can assist athletes in tracking and analyzing their sports in competitive sports. Ordinary people can benefit from keeping regular swimming diaries and tracking precise data to better organize their workouts and improve their swimming performance. Swimming, as the world’s third-largest activity, requires mature solutions that can assist users in completing their daily monitoring tasks. The following is a simple analysis of the process of swimming concerning the research results of kinematics, motion mechanics, sports biomechanics, anatomy, and other disciplines [1].The cyclic coordinate descent algorithm is a heuristic iterative search strategy in which each iteration traverses the kinematic chain from one end to the other. The traditional optimization method of cyclic coordinate descent has seen a resurgence of attention in machine learning. Its competitive performance on regularized smooth optimization issues is due to its simplicity, speed, and stability, as well as its competitive performance on normalized smooth optimization problems.Numerical solutions of inverse kinematic equations have been extensively and deeply studied, and a large number of results have been obtained [1]. The introduction of selected input data, analysis of data according to provided mechanical equations, and then, a collection of the output data are all characteristics of numerical methods. Kinematics, dynamics, and muscle analyses are the goals of both methodological groups. In this study, we plan to use these findings to shed insight on the resolution of the coordinate descent algorithm. The most commonly used iterative methods are the cyclic coordinate descent algorithm, which only changes the angle of one joint at a time, so an iteration can be completed quickly [2, 3].The human freestyle movement process and the whole swimming cycle show that a single-step process is decomposed into three stages: pulling water, pushing water, and swinging arms in the air. The moment when the water starts to pull water at the critical moment, the pulling, turning, and pushing means that the arm has just completed the preparation for pulling water. Entering the state of pushing water as well as when the arm has just finished pushing the water and is ready to swing in the air is the critical moment [4, 5]. Freestyle swimming requires and involves four movements, the body position, the arms movements, the breathing technique, and the leg action. The arm movement is the propulsion or the motor stroke. Freestyle or front crawl has a facedown swimming position which allows us to rotate our arms naturally and gives a good range of motion as compared to other strokes. In this study, the cyclic coordinate descent swimming training algorithm was used to solve the constraint frame target attitude, and near the constraint frame, the method of motion offset mapping curve was used to smooth the swimming training exercise and make the smooth transition between the frame and the constraints frame, by adjusting the root node displacement ratio and estimating the initial position, motion editing, and redirection. These offset mapping curves are sufficiently used to collect the smoothness and curvatures of the offset mapping constraints and results.Following the introduction, the decomposition of swimming training has been discussed in Section2. In this section, the period division of swimming training, key nodes, and frame division have been discussed. After that, the introduction to the cyclic coordinate descent algorithm has been discussed in Section 3. Further, the frame swimming training model based on cyclic coordinate descent algorithm and conclusion has been discussed in Section 4. It discusses the deep learning of the swimming training model using different simulations and the conclusion of the research paper, respectively. Finally, the concluding remarks have been discussed in Section 5.


## 2. Decomposition of Swimming Training

The swimming training decomposition explains the different stages of swimming training. It has been divided into several stages. The stages define the overall method of the training while swimming. These stages include a complete swimming cycle. The first stage defines the period division of the swimming training. The second stage explains the key nodes of the training and the third stage elaborates on the frame division of the swimming training.


### 2.1. Period Division

The complete cycle of swimming can be regarded as a compound step. This process consists of two single steps that are with arms and legs. Both arms and legs coordinate alternately to complete the action. The swimming movement cycle is divided according to the arm movement standard. A single step includes three stages pulling water, pushing water, and swinging an arm in the air, and two key moments [6]. The modeling adopted in this paper is to divide the complex step which consists of four stages and four critical moments, left hand pull water, push water, and right-hand pull water, push water. Define a complete cycle starting from the left hand, as shown in Figure 1.Figure 1
Sequence diagram of the swimming movement cycle.Generally, one breath is taken in the process of each arm stroke. Take inhaling to the right as an example. The mouth and nose gently exhale once the right hand enters the water. Row your right arm under your shoulder, start turning your head to the right, and increase your expiratory volume. When the right arm is about to finish pushing the water, exhale forcefully [7]. When the right arm comes out of the water, open your mouth and inhale until reaching the front half of the arm in the air, and start to turn your head to restore [8]. Then, until the arm enters the water, there is a short breath-holding process, and the face turns forward and downward. When the head is stable, enter the water with the right arm, and begin the following phase of the process by softly inhaling.


### 2.2. Key Nodes

According to the period diagram above, the key moments of swimming are defined as follows:(i)
Water entryEntering the water refers to the middle moment when the arm has just completed the arm swing and is preparing to enter the water-pulling state, which is the dividing point between the two stages.(ii)
Pull, retweet, and push momentThe moment of pull, retweet, and push refers to the middle moment when the arm completes the water-pulling action to prepare for entering the water-pushing state, which is the dividing point between the two stages.(iii)
The moment of water comes outThe exit moment refers to the middle moment when the arm is ready to enter the air swing arm stage after the arm has just completed the water pushing action, and it is the demarcation point of the two stages [9].In this study of the swimming movement modeling, the starting time of the arm also corresponds to the coming-out time of the other arm. In the actual modeling, the two moments are overlapped. There are three types of cross positions in freestyle stroke: front cross, middle cross, and back cross. Front cross-refers to when one arm enters the water, the other arm has swung forward to the front of the shoulder and is about equal to the plane [10]. Beginners can use the front cross to practice freestyle movement and breathing. The middle cross occurs when one arm is like water, and the other arm is in the inward stroke phase at the water’s level. The back cross is when one arm enters the water, and the other arm strokes under the abdomen, with the hand about equal to the level of the water.


### 2.3. Frame Divided

According to the analysis, a complete swimming cycle can be divided into four stages and four critical moments. Taking the left hand as an example, the analysis is as follows:Frame 0:The left hand enters the water to prepare for the transition from aerial swing arm to pull water stage. At this time, the right hand comes out of the water to enter the air swing arm stage. The left leg has just finished kicking, and the right leg emerges from the water to prepare for kicking water.Frame 1:The left hand enters the moment of pulling and pushing, preparing for the arm from pulling to pushing. At this time, the right hand continues to be in the air swing stage; the right leg has just completed a kicking action. The left leg is ready to kick [11].Frame 2:The left hand just finished pushing into the air swing arm state. The right hand began to enter the water state, and the left leg just completed a kick action. The right leg is out of the water and ready to kick.Frame 3:The right hand enters the moment of pulling and pushing, preparing for the arm to turn from pulling to pushing. At this time, the left hand continues to complete the aerial swing, the right leg has just completed a kicking action. The left leg has emerged from the water and is ready to begin kicking.After completing the third frame, enter the first frame to start the cycle. The whole movement of swimming is divided into four stages by the above four key frame moments as the demarcation points, and the whole moving process is completed by the cycle of four stages [12]. In the motion modeling of this study, the pumping frequency of arms and legs is specified in a 1 : 2 manner, that is, after the arm completes one pumping cycle, the leg completes two pumping cycles.


## 2.1. Period Division

The complete cycle of swimming can be regarded as a compound step. This process consists of two single steps that are with arms and legs. Both arms and legs coordinate alternately to complete the action. The swimming movement cycle is divided according to the arm movement standard. A single step includes three stages pulling water, pushing water, and swinging an arm in the air, and two key moments [6]. The modeling adopted in this paper is to divide the complex step which consists of four stages and four critical moments, left hand pull water, push water, and right-hand pull water, push water. Define a complete cycle starting from the left hand, as shown in Figure 1.Figure 1
Sequence diagram of the swimming movement cycle.Generally, one breath is taken in the process of each arm stroke. Take inhaling to the right as an example. The mouth and nose gently exhale once the right hand enters the water. Row your right arm under your shoulder, start turning your head to the right, and increase your expiratory volume. When the right arm is about to finish pushing the water, exhale forcefully [7]. When the right arm comes out of the water, open your mouth and inhale until reaching the front half of the arm in the air, and start to turn your head to restore [8]. Then, until the arm enters the water, there is a short breath-holding process, and the face turns forward and downward. When the head is stable, enter the water with the right arm, and begin the following phase of the process by softly inhaling.


## 2.2. Key Nodes

According to the period diagram above, the key moments of swimming are defined as follows:(i)
Water entryEntering the water refers to the middle moment when the arm has just completed the arm swing and is preparing to enter the water-pulling state, which is the dividing point between the two stages.(ii)
Pull, retweet, and push momentThe moment of pull, retweet, and push refers to the middle moment when the arm completes the water-pulling action to prepare for entering the water-pushing state, which is the dividing point between the two stages.(iii)
The moment of water comes outThe exit moment refers to the middle moment when the arm is ready to enter the air swing arm stage after the arm has just completed the water pushing action, and it is the demarcation point of the two stages [9].In this study of the swimming movement modeling, the starting time of the arm also corresponds to the coming-out time of the other arm. In the actual modeling, the two moments are overlapped. There are three types of cross positions in freestyle stroke: front cross, middle cross, and back cross. Front cross-refers to when one arm enters the water, the other arm has swung forward to the front of the shoulder and is about equal to the plane [10]. Beginners can use the front cross to practice freestyle movement and breathing. The middle cross occurs when one arm is like water, and the other arm is in the inward stroke phase at the water’s level. The back cross is when one arm enters the water, and the other arm strokes under the abdomen, with the hand about equal to the level of the water.


## 2.3. Frame Divided

According to the analysis, a complete swimming cycle can be divided into four stages and four critical moments. Taking the left hand as an example, the analysis is as follows:Frame 0:The left hand enters the water to prepare for the transition from aerial swing arm to pull water stage. At this time, the right hand comes out of the water to enter the air swing arm stage. The left leg has just finished kicking, and the right leg emerges from the water to prepare for kicking water.Frame 1:The left hand enters the moment of pulling and pushing, preparing for the arm from pulling to pushing. At this time, the right hand continues to be in the air swing stage; the right leg has just completed a kicking action. The left leg is ready to kick [11].Frame 2:The left hand just finished pushing into the air swing arm state. The right hand began to enter the water state, and the left leg just completed a kick action. The right leg is out of the water and ready to kick.Frame 3:The right hand enters the moment of pulling and pushing, preparing for the arm to turn from pulling to pushing. At this time, the left hand continues to complete the aerial swing, the right leg has just completed a kicking action. The left leg has emerged from the water and is ready to begin kicking.After completing the third frame, enter the first frame to start the cycle. The whole movement of swimming is divided into four stages by the above four key frame moments as the demarcation points, and the whole moving process is completed by the cycle of four stages [12]. In the motion modeling of this study, the pumping frequency of arms and legs is specified in a 1 : 2 manner, that is, after the arm completes one pumping cycle, the leg completes two pumping cycles.


## 3. Introduction of Cyclic Coordinate Descent Algorithm

One commonly used method is the cyclic coordinate descent algorithm, which was first proposed by Li-Chun Tommy Wang and Chin Cheng. The cyclic coordinate descent algorithm works by starting at the end of the motion chain and gradually changing each joint’s rotation angle [13, 14]. This algorithm gained popularity due to its ease of use, efficiency, and durability, as well as its competitiveness on smooth optimization issues. In the diagram of the cyclic coordinate descent algorithm, the end joint J0 is changed first, from J0 till the end effector E as vector V1 and from J0 to the target point D as vector V2. First, locate the angle α between the two vectors and their rotation axis V3. Take child chain under J0 and rotate it around the axis of rotation V3 by an angle alpha, and the end effector E gets to a new position, and then, take J1, the parent node of J0, and also go from J1 to E as vector V1. Take the vector V2 from J1 to D, find the angle β between vector V1 and V2 and its rotation axis V3, and let the subchain under J1 rotate the angle β about the rotation axis V3. The end effector reaches a new position and continues to take the parent node of J1, changing its rotation angle, all the way to the root node of JRoot. If E does not reach D after an iteration, a new round of movement is initiated from the end joint J0 until the distance between E and D is small enough or a certain number of cycles is reached. Figure 2 depicts a schematic illustration of the cyclic coordinate descent algorithm.Figure 2
Schematic diagram of cyclic coordinate descent algorithm.
(a)
Handling of jointJ0(b)
Handling of jointJ1The cyclic coordinate descent algorithm is a heuristic iterative search algorithm; each iteration is completed by going from the chain’s end to the fixed end [15]. This method only changes the angle of one joint at a time, as a result of which an iteration may be finished fast [16]. The cyclic coordinate descent algorithm can be used to solve inverse kinematics problems. The cyclic coordinate descent algorithm only changes the angle of one joint per iteration. The cyclic coordinate descent algorithm is efficient [17].


## 4. Frame Swimming Training Model on the Basis of Cyclic Coordinate Descent Algorithm

To provide a more realistic simulation effect, an accurate frame model of swimming training based on a cyclic coordinate descent technique is critical [18]. This section describes the swimming training model’s pseudocode implementation and simulation results based on the CCD algorithm. The first section explains the pseudocode implementation of swimming action. The second section explains the pseudocode implementation of the swimming motion path, and the last section explains the swimming training simulations.


### 4.1. Swimming Action Pseudocode Implementation

The pseudocode implementation of the cyclic coordinate descent algorithm used in this paper is as follows:Pseudocode 1
//SolveIK_CCD function is used for the CCD algorithm to solve inverse kinematics problemStep 1: SolveIK_CCD(CJoint&FixedJoint, CBone EndBone, Position Aim_pos){//FixedJoint Fixed the joints of the joint chain//EndBone End bone of the joint chain//Aim_pos- Desired target locationWhile (To reach the specified number of iterations && the distance between the current end bone position and the target position is greater than the specified error range){While (The fixed joint has not been rotated yet){Step 2: The angleθ between the vector v1 pointing from the current joint to the end bone and the vector v2 pointing from the current joint to the target position;Step 3: Take the cross product ofv1 and v2 to get the rotation axis vector v3 that is perpendicular to both v1 and v2;Step 4: The current joint rotates around the axis of the vectorv3 by an angle of θ;The parent joint of the current joint becomes the new current joint;}//end whileStep 5: Find the distance between the position of the current end bone and the target position;Step 6: The number of iterations is incremented by 1;}//end whileFunction returns;}//end SolveIK_CCDTaking the solution of the arm as an example, the shoulder joint is regarded as the fulcrum, and the palm bone is thought to be the joint chain’s final result. At this time, the fixed joint is the shoulder joint, and the end bone is the hand bone. The function call form is as follows:SolveIK_CCD(m_arrJoint[jLShoulder],m_arrBone[LHand],AimPos


### 4.2. Pseudocode Implementation of Swimming Motion Path

The swimming movement path of the virtual human is manually specified. The movement on the straight path can be directly generated simply by employing the cyclic coordinate descent algorithm and spherical linear interpolation described in the previous two sections. The movement on the curve corner can be processed by using the Bezier spline curve [18].Its implementation pseudocode is as follows:The middle frame of the corner is interpolated as follows:Pseudocode 2
For (intcounter=1; counter<The intermediate frames; counter++){Calculate the position coordinates of each intermediate point on the fitted Bezier curve with the counter/intermediate frame number as the parameter;Assign the calculated intermediate point coordinates to the coordinates of the root joint of the current frame;Push the current into the frame sequence:}


### 4.3. Swimming Training Simulation

According to the method introduced above, a 3D simulation environment of human swimming is established under the development of the Visual Studio 2008 platform and OpenGL environment [19, 20]. In this environment, various motion parameters can be set interactively, to realize swimming in various postures.The range of the motion characteristic parameters of this system is set as follows:(a)
The pull water percentage ranges from 1% to 100%(b)
The step length ranges from 0 to 10 cm(c)
The step frequency ranges from 1 to 1000 steps/min(d)
The frame rate ranges from 30 to 85 frames/secThe key frame sequence of one cycle of swimming is shown in Figure3.Figure 3
Sequence of key frames for one cycle of swimming motion.
(a)(b)(c)(d)(e)


## 4.1. Swimming Action Pseudocode Implementation

The pseudocode implementation of the cyclic coordinate descent algorithm used in this paper is as follows:Pseudocode 1
//SolveIK_CCD function is used for the CCD algorithm to solve inverse kinematics problemStep 1: SolveIK_CCD(CJoint&FixedJoint, CBone EndBone, Position Aim_pos){//FixedJoint Fixed the joints of the joint chain//EndBone End bone of the joint chain//Aim_pos- Desired target locationWhile (To reach the specified number of iterations && the distance between the current end bone position and the target position is greater than the specified error range){While (The fixed joint has not been rotated yet){Step 2: The angleθ between the vector v1 pointing from the current joint to the end bone and the vector v2 pointing from the current joint to the target position;Step 3: Take the cross product ofv1 and v2 to get the rotation axis vector v3 that is perpendicular to both v1 and v2;Step 4: The current joint rotates around the axis of the vectorv3 by an angle of θ;The parent joint of the current joint becomes the new current joint;}//end whileStep 5: Find the distance between the position of the current end bone and the target position;Step 6: The number of iterations is incremented by 1;}//end whileFunction returns;}//end SolveIK_CCDTaking the solution of the arm as an example, the shoulder joint is regarded as the fulcrum, and the palm bone is thought to be the joint chain’s final result. At this time, the fixed joint is the shoulder joint, and the end bone is the hand bone. The function call form is as follows:SolveIK_CCD(m_arrJoint[jLShoulder],m_arrBone[LHand],AimPos


## 4.2. Pseudocode Implementation of Swimming Motion Path

The swimming movement path of the virtual human is manually specified. The movement on the straight path can be directly generated simply by employing the cyclic coordinate descent algorithm and spherical linear interpolation described in the previous two sections. The movement on the curve corner can be processed by using the Bezier spline curve [18].Its implementation pseudocode is as follows:The middle frame of the corner is interpolated as follows:Pseudocode 2
For (intcounter=1; counter<The intermediate frames; counter++){Calculate the position coordinates of each intermediate point on the fitted Bezier curve with the counter/intermediate frame number as the parameter;Assign the calculated intermediate point coordinates to the coordinates of the root joint of the current frame;Push the current into the frame sequence:}


## 4.3. Swimming Training Simulation

According to the method introduced above, a 3D simulation environment of human swimming is established under the development of the Visual Studio 2008 platform and OpenGL environment [19, 20]. In this environment, various motion parameters can be set interactively, to realize swimming in various postures.The range of the motion characteristic parameters of this system is set as follows:(a)
The pull water percentage ranges from 1% to 100%(b)
The step length ranges from 0 to 10 cm(c)
The step frequency ranges from 1 to 1000 steps/min(d)
The frame rate ranges from 30 to 85 frames/secThe key frame sequence of one cycle of swimming is shown in Figure3.Figure 3
Sequence of key frames for one cycle of swimming motion.
(a)(b)(c)(d)(e)


## 5. Conclusion

The construction of a swimming training model based on a cyclic coordinate descent algorithm and mapping human motion editing and redirection method make the character movement suitable for virtual scenes. A cyclic coordinate descent algorithm was used to solve the physiological constraints and the target pose of the constrained frame automatically. The motion was smoothed automatically by constructing the motion offset mapping curve near the constrained frame. The experimental results show that the method retains the characteristics of the original motion relatively well. The motion obtained by redirection is smooth and natural. In essence, the cyclic coordinate descent algorithm is an optimization method, but it avoids solving the Jacobian matrix and its inverse in the numerical iteration method. So, the speed is greatly improved. The procedure begins at the end of the joint chain and changes the angles of each joint in turn, bringing the end closer to the goal position with each modification. This process continued repeatedly until the distance between the end and the target position is within a specific error range, at which point the simulation of the swimming training model is complete. The cyclic coordinate descent algorithm makes swimming training movement data adapt to the change of new scene and can apply the same set of swimming training movement data to different models, which improves the reusability of swimming training movement data.



---

*Source: 2044060-2022-05-11.xml*