Online Handwriting Recognition Method with a Non-Inertial Reference Frame Based on the Measurement of Linear Accelerations and Differential Geometry: An Alternative to Quaternions

This work describes a mathematical model for handwriting devices without a specific reference surface (SRS). The research was carried out on two hypotheses: the first considers possible circular segments that could be made during execution for the reconstruction of the trace, and the second is the combination of lines and circles. The proposed system has no flat reference surface, since the sensor is inside the pencil that describes the trace, not on the surface as in tablets or cell phones. An inertial sensor was used for the measurements, in this case, a commercial Micro-Electro Mechanical sensor of linear acceleration. The tracking device is an IMU sensor and a processing card that allows inertial measurements of the pen during on-the-fly tracing. It is essential to highlight that the system has a non-inertial reference frame. Comparing the two proposed models shows that it is possible to construct shapes from curved lines and that the patterns obtained are similar to what is recognized; this method provides an alternative to quaternion calculus for poorly specified orientation problems.


Introduction
Human communication modes have evolved from drawings to patterns such as letters or symbols; we have seen the representation of these patterns in stone, paper, and nowadays in digital systems.One of the most common ways of communication is through handwriting, which is nothing more than a set of letters or patterns that together encode a message, making it possible for people who know this code to receive and recognize it.Currently, with the growing use of information technologies, there is a need to digitize messages to make them reach a broader number of people, and it is also necessary to have a way to analyze what is digitized.Two essential concepts appear when discussing this handwriting analysis: online (recognition in real time) and offline (recognition in non-real time).There are various efforts to improve the online handwriting systems to reproduce faithfully the strokes of the pen movement [1][2][3][4][5][6][7][8], and these models are based on known and efficient data analysis methodologies.However, they require prior knowledge of the patterns; that is, they need to know in advance what the patterns should be like in order to reconstruct them, and in some other cases, it is necessary to have the trajectory of the stroke to perfect it.The works [1][2][3][4][5][6][7][8] use deep learning algorithms that insert the electrical characteristics of the sensors; in other cases, the focus is on optimizing the traces already made on a surface.
Although it is a simple task, handwriting is a highly complicated skill.It is necessary to have a mental picture or memory of what each letter looks like and then develop a motion plan to create it as it is stored in our memory.The development of higher-level handwriting skills (letter formation, sizing, spacing, alignment, and more) all begins with being able to copy simple shapes (prewriting shapes) [9][10][11].
From these prewriting shapes (i.e., horizontal lines, circles, vertical lines), it is time to move on to the letter drawing (how the letters are represented) and construction (how each letter is produced).Efficient construction typically leads to better legibility and speed.Widely known online writing systems have a fixed reference system, either through an artificial vision sensor, which establishes the usual order of a matrix in rows and columns and correlates them with the position in the viewing angle vision of the person who writes [12], or through a finite-dimensional tablet and a pen, establishing fixed references with an orthogonal Cartesian coordinate frame according to the tablet.This work intends to generate a trace as faithful as possible to a path made by the user without depending on a fixed surface or being in a specific vision area.The main idea is to establish a digital writing system with two-dimensional strokes that do not require a support surface; this is writing on the fly.
It is worth mentioning that the goal of the methods proposed in this work is online handwriting recognition without a fixed inertial frame of reference, like a screen, tablet, or any other reference surface.Given the above, we do not count on a fixed reference to establish a coordinate system, so the proposed methods must not rely on a fixed reference frame; this is the main differentiator against classic online handwriting recognition methods and devices, and quaternions are a popular and efficient alternative to solving this problem and creating orientation systems using IMUs [13][14][15][16][17][18][19][20][21][22].However, their use implies a more complex mathematical model than the one presented here.
The present work focuses on generating patterns with defined shapes from geometric characteristics, representing the information of the letters in two formats: the points in Cartesian coordinates to graph the strokes directly or the polar coordinates of the stroke that allow the generating of normalized vector features instantly.Furthermore, the methods presented here do not require prior knowledge of the patterns; they trace them on the fly.Finally, this work seeks to generate high-quality patterns to guarantee better performance in future processing using an artificial intelligence system, as mentioned in [23][24][25].The quality of a prediction system's results is largely based on the quality of the input data.
The system developed for the experimentation comprises three parts: the perception system, consisting of a three-axis IMU (Inertial Measurement Unit), a data acquisition and processing board, and a delivery system for the trace display.

Materials and Methods
The hardware of the digital writing system comprises an IMU, a data acquisition and processing system, a 3D printed case and a workstation.A pictorial representation of the inertial system and the IMU's inner axis are shown in Figure 1; the IMU used is the MPU6050 module, of which the 3-axis accelerometer and the 3-axis gyroscope are used, and an Arduino UNO board is used for data acquisition, information processing, and communication to the workstation, the latter being the one that allows viewing the reconstructed trace according to the proposed mathematical models (see Figure 2).A simple user-friendly case for the prototype was made with a 3D printer, with the components placed inside and aligned in the desired position (see Figure 1) for the proper operation of the device, as shown in Figure 3.The IMU is fixed to the casing so the user can draw freely, always maintaining the sensing plane between the pen's tip and the sensor.In this way, although the velocity and acceleration vectors are three-dimensional, only the axes of the sensor plane perpendicular to the pen are sensed.An algorithm is proposed to reproduce cursive handwriting strokes, using only the IMU data and without a fixed reference frame.In the cursive (often referenced as italic) handwriting style, letters are mainly constructed based on curved shapes, unlike the block letter style.Cursive handwriting has a greater dominance of curvatures, and several characters are usually embedded in a single continuous line.The hypothesis is that any cursive trace can be reproduced by linking a multiplicity of circular sections one after another, by knowing the variation of the slope concerning the arc the trace describes between any  A simple user-friendly case for the prototype was made with a 3D printer, with the components placed inside and aligned in the desired position (see Figure 1) for the proper operation of the device, as shown in Figure 3.The IMU is fixed to the casing so the user can draw freely, always maintaining the sensing plane between the pen's tip and the sensor.In this way, although the velocity and acceleration vectors are three-dimensional, only the axes of the sensor plane perpendicular to the pen are sensed.An algorithm is proposed to reproduce cursive handwriting strokes, using only the IMU data and without a fixed reference frame.In the cursive (often referenced as italic) handwriting style, letters are mainly constructed based on curved shapes, unlike the block letter style.Cursive handwriting has a greater dominance of curvatures, and several characters are usually embedded in a single continuous line.The hypothesis is that any cursive trace can be reproduced by linking a multiplicity of circular sections one after another, by knowing the variation of the slope concerning the arc the trace describes between any A simple user-friendly case for the prototype was made with a 3D printer, with the components placed inside and aligned in the desired position (see Figure 1) for the proper operation of the device, as shown in Figure 3.The IMU is fixed to the casing so the user can draw freely, always maintaining the sensing plane between the pen's tip and the sensor.In this way, although the velocity and acceleration vectors are three-dimensional, only the axes of the sensor plane perpendicular to the pen are sensed.A simple user-friendly case for the prototype was made with a 3D printer, with the components placed inside and aligned in the desired position (see Figure 1) for the proper operation of the device, as shown in Figure 3.The IMU is fixed to the casing so the user can draw freely, always maintaining the sensing plane between the pen's tip and the sensor.In this way, although the velocity and acceleration vectors are three-dimensional, only the axes of the sensor plane perpendicular to the pen are sensed.An algorithm is proposed to reproduce cursive handwriting strokes, using only the IMU data and without a fixed reference frame.In the cursive (often referenced as italic) handwriting style, letters are mainly constructed based on curved shapes, unlike the block letter style.Cursive handwriting has a greater dominance of curvatures, and several characters are usually embedded in a single continuous line.The hypothesis is that any cursive trace can be reproduced by linking a multiplicity of circular sections one after another, by knowing the variation of the slope concerning the arc the trace describes between any An algorithm is proposed to reproduce cursive handwriting strokes, using only the IMU data and without a fixed reference frame.In the cursive (often referenced as italic) handwriting style, letters are mainly constructed based on curved shapes, unlike the block letter style.Cursive handwriting has a greater dominance of curvatures, and several characters are usually embedded in a single continuous line.The hypothesis is that any cursive trace can be reproduced by linking a multiplicity of circular sections one after another, by knowing the variation of the slope concerning the arc the trace describes between any given pair of consecutive points P i and P i+1 (see Figure 4), that is, its curvature K (Equation ( 1)).
dius equal to the distance from the tip of the pen to the center of the IMU is assumed.On the other hand, method two uses the linear accelerations directly from the IMU, unlike method one, without any transformation, which reduces the error in the trace reconstruction as it eliminates any assumption regarding any parameter used in the calculations, in addition to allowing the reconstruction of straight lines.Method one is based only on circular sections, and it works in the way described below.First, suppose that a reconstructed trace is known from the respective in-plane trace velocities; considering the curvature measurement at point  of a curve (Equation ( 2)), we have For the practical calculation of the curvature K an angle τ, defined between the tangents to the trace at P and P ′ , it is calculated first by means of two consecutive data points obtained from the IMU, then the arc length S between P i and P i+1 is calculated from the same consecutive data points, and then the quotient between the angle τ and the arc length S gives the curvature of the piece of trace between P i and P i+1 .
where K : Curvature ∆τ : Rotation angle ∆S : Arc length between P and P ′ For the reconstruction of the trace, once the curvature between P i and P i+1 is known, a curvature radius is calculated, along with its corresponding center.As the hypothesis is that the trace can be reconstructed by circular sections, once the radius and center of curvature are known, the angular section of the corresponding circle between the two points P and P ′ is calculated based on the arc length previously calculated.All the data are acquired and processed in the Arduino UNO board, and then send to the workstation.
Finally, with all the above data, the circular sections a are plotted through any suitable software in the workstation.
Two different approaches to the proposed algorithm were developed and implemented, called method one and method two.For method one the velocity of the trace is used as the input data, as the selected IMU gives out a rotational velocity.First, this velocity must be transformed to a linear velocity, and for this transformation a turning radius equal to the distance from the tip of the pen to the center of the IMU is assumed.On the other hand, method two uses the linear accelerations directly from the IMU, unlike method one, without any transformation, which reduces the error in the trace reconstruction as it eliminates any assumption regarding any parameter used in the calculations, in addition to allowing the reconstruction of straight lines.
Method one is based only on circular sections, and it works in the way described below.First, suppose that a reconstructed trace is known from the respective in-plane trace velocities; considering the curvature measurement at point P of a curve (Equation ( 2)), we have where → T : Tangent vector to the curve at a point k : Curvature in absolute value S : Arc length Then, under the hypothesis that the trace can be considered as a multiplicity of linked circular sections, the mean arc curvature (the curvature in the section between P i and P i+1 ) can be expressed as in Equation ( 3), where the change in the tangent vector (Equation ( 4)) to the curve to be reconstructed is the difference in linear speeds ( → v i+1 − → v i ) between the points P i and P i+1 of the trace; this is assumed to be true, since the tangent vector and linear velocity vector are analogous, as long as the linear velocity component which is tangent to the trajectory is considered.Also, the trace is assumed to be in a plane, so the velocity of the trace can be decomposed into two x and y components (Equation ( 7)).
where k m : Mean curvature ∆ T : Change in unit tangent vector ∆S : Change in arc length where Ti+1 : Unittangent vector at next position Ti : Unittangent vector at current position → v i+1 : Velocity vector at next position → v i : Velocity vector at current position where Then the k m i−th curvature and the r i−th radius of curvature at the point P i−th are given by Equations ( 8) and ( 9), respectively.
And for the i th iteration: where R i is the two-dimensional rotation matrix and C i is the center of the circle of radius r i (see Figures 5 and 6).where  is the two-dimensional rotation matrix and  is the center of the circle of radius  (see Figures 5 and 6).In a circle, the arc length is given as the product of the radius and its respective angle in radians, hence we have ∆ = Since we are dealing with plane curves, it turns out that the curvature has a sign that indicates whether the curve turns to the left or to the right.Such a sign is defined as 1 if the unit tangent vector and the unit normal vector at a point on the curve, both considered to be the base of the plane, coincide with the orientation of the canonical base of the plane, which is the base with unit vectors  and ; otherwise, the value of the sign is −1.One can calculate the sign either by calculating the determinant of the base change matrix, or by calculating the inner product of the unit normal vector with  (of the IMU inner axis).Thus, we introduce  as the sign of the rotation angle, and it is defined as follows: So that, if the rotation is performed in a clockwise direction, then  = −1; otherwise, when the rotation is performed in counterclockwise direction, we obtain  = 1.In the case where  = 0, no rotation is being performed.
For    (See Figure 6) In a circle, the arc length is given as the product of the radius and its respective angle in radians, hence we have ∆S = r i θ i Since we are dealing with plane curves, it turns out that the curvature has a sign that indicates whether the curve turns to the left or to the right.Such a sign is defined as 1 if the unit tangent vector and the unit normal vector at a point on the curve, both considered to be the base of the plane, coincide with the orientation of the canonical base of the plane, which is the base with unit vectors i and j; otherwise, the value of the sign is −1.One can calculate the sign either by calculating the determinant of the base change matrix, or by calculating the inner product of the unit normal vector with j (of the IMU inner axis).Thus, we introduce σ i as the sign of the rotation angle, and it is defined as follows: So that, if the rotation is performed in a clockwise direction, then σ i = −1; otherwise, when the rotation is performed in counterclockwise direction, we obtain σ i = 1.In the case where σ i = 0, no rotation is being performed.
For t i ≤ t ≤ t i+1 (See Figure 6) So that, if the rotation is performed in a clockwise direction, then  = −1; otherwise, when the rotation is performed in counterclockwise direction, we obtain  = 1.In the case where  = 0, no rotation is being performed.
For    (See Figure 6)  The Equation ( 11) can be rewritten in terms of Cartesian coordinates as Equation ( 15), where φ i (t) is the angle between two successive points and (h i , k i ) are the Cartesian coordinates of the center of the circle (see Figure 5) Following the construction of letters, it is crucial to recognize that another shape prevails mainly, in addition to the curves; this is the straight line.As mentioned above, efficient construction of the letters generally leads to better legibility and speed, so it is essential to add straight lines to the curves in the process of handwriting generation, since this gives a better projection of the image stored in human memory of what each letter looks like.According to this, the method considering only circular sections can be modified so it can reproduce straight lines, and this modification was called method two.
Method two is based on circular sections and straight lines; assuming a reconstructed trace, knowing its accelerations in the plane and considering the measurement of curvature at point P of a curve (Equation ( 17)), we have where → P (t) is a vector defining a point, given by In addition, the radius of curvature r(t) of the vector The known data are the i th accelerations (a i x and a i y ) of point P, obtained in the plane of movement of the trace, and the time difference (∆t) between the values obtained for accelerations in the plane.Assuming initial conditions of zero, we have Then, if we rewrite Equation (19) in Cartesian coordinates, we obtain Next, the center of the circle is where ni is the unit normal vector to the curve at P i and is expressed in Cartesian coordinates as The angle of rotation θ i is Then, Observe that the condition a i x a i+1 y − a i+1 x a i y ̸ = 0 in Equation ( 25) is sufficient to guarantee the existence of P i+1 .Otherwise, r i (t) given in Equation ( 21) is undefined and so is P i+1 .

Results
We use patterns of shapes and letters to test the previously established algorithm.In the case of the simulations, these patterns are the points from an equation describing a particular shape.In the second part, we prove the algorithm's reconstruction of a natural trace using the electronic prototype.The pairs (x, y) to reconstruct the patterns were calculated using Equations ( 15) and ( 16) for method one, based only on circle sections; for method two, based on circle sections and straight lines, Equations ( 24) and ( 25), are used.

Simulation
The main characteristic of these patterns is that they have a curve morphology.The two primary shapes, curved and straight lines, can describe circles, parabolas, and, more critically, letters (see Figures 7-10).
The reference pattern is shown in Figure 7a.The vector time is defined as t = [0, 2π], the x coordinated as sin(t), and y coordinate as cos(t).It is a circle centered at the origin of the Cartesian coordinate system and drawn from the usual parametric equations.Figure 7b,c show the reconstruction of the reference pattern using method one and method two, respectively.The vector time remains equal; for method one the input was the linear velocity as (cos(t), −sin(t)) and for method two the input was the linear acceleration as (−sin(t), −cos(t)).In these methods, the reference pattern remains unchanged, as we again obtain a circle with a radius of one and a center at the origin.This is not surprising, since both methods construct a curve connecting circular arcs, the osculating circles, with the curve following the curvature vector estimated from the acceleration.The difference between the two methods is that method two considers the case when the curvature is close to zero, assuming a particular error.In such a case, method two constructs a straight-line segment whose extreme points are successive position estimates.
again obtain a circle with a radius of one and a center at the origin.This is not surprising, since both methods construct a curve connecting circular arcs, the osculating circles, with the curve following the curvature vector estimated from the acceleration.The difference between the two methods is that method two considers the case when the curvature is close to zero, assuming a particular error.In such a case, method two constructs a straightline segment whose extreme points are successive position estimates.Figure 8a shows a second reference pattern, this time a sinusoid curve; in Figure 8b we observe how method one fails to reconstruct a sinusoid curve as a reference pattern.The main reason behind such a result is that method one does not detect the abrupt curvature changes at the bottom portions of the pattern, i.e., where the curvature slope changes from positive to negative and when it achieves its maximum value.So, method one is unable to capture the quick variations of acceleration.Figure 8c shows how method two successfully reconstructs the reference pattern.It is a consequence of the refinement Figure 8a shows a second reference pattern, this time a sinusoid curve; in Figure 8b we observe how method one fails to reconstruct a sinusoid curve as a reference pattern.The main reason behind such a result is that method one does not detect the abrupt curvature changes at the bottom portions of the pattern, i.e., where the curvature slope changes from positive to negative and when it achieves its maximum value.So, method one is unable to capture the quick variations of acceleration.Figure 8c shows how method two successfully reconstructs the reference pattern.It is a consequence of the refinement of adding an exception that constructs straight-line segments when consecutive estimates of acceleration differ in absolute value from those below the considered error in the algorithm of method one.The advantage of straight-line segment construction is that it does not require the knowledge of the curvature sign, i.e., it does not consider when the curve is turning clockwise or counterclockwise.But it fails in reconstructing the smoothness of the curve.Figure 9 shows the cursive letter "a" as a reference pattern, and it is constructed via the parametric equations of a circle and ellipse.As one can see in Figure 9b, method one fails again to reconstruct the reference pattern because it is unable to properly follow the changes in those points at the curve with abrupt changes in slope, for instance in the small end loop of the letter "a".As evidence of the consistent behavior of method two, Figure 9c shows how such a method recovers the reference pattern acceptably, conserving as much as possible the topology of the trace, despite the different metric features.The pattern of the letter "a" is made up of two pairs of equations.The first forms most of the letter, which is the semi-circle, and the second is an ellipse that makes up the residual part of the letter.The connection between both equations forms a straight line, and it is observed that method one fails when trying to complete the letter just when the straight curve begins.Figure 9 shows the cursive letter "a" as a reference pattern, and it is constructed via the parametric equations of a circle and ellipse.As one can see in Figure 9b, method one fails again to reconstruct the reference pattern because it is unable to properly follow the changes in those points at the curve with abrupt changes in slope, for instance in the small end loop of the letter "a".As evidence of the consistent behavior of method two, Figure 9c shows how such a method recovers the reference pattern acceptably, conserving as much as possible the topology of the trace, despite the different metric features.The pattern of the letter "a" is made up of two pairs of equations.The first forms most of the letter, which is the semi-circle, and the second is an ellipse that makes up the residual part of the letter.The connection between both equations forms a straight line, and it is observed that method one fails when trying to complete the letter just when the straight curve begins.
shows how such a method recovers the reference pattern acceptably, conserving as much as possible the topology of the trace, despite the different metric features.The pattern of the letter "a" is made up of two pairs of equations.The first forms most of the letter, which is the semi-circle, and the second is an ellipse that makes up the residual part of the letter.The connection between both equations forms a straight line, and it is observed that method one fails when trying to complete the letter just when the straight curve begins.As one can see in Figure 10, the reference pattern is the letter e.It is, in a general fashion, an interesting challenge to any same-purpose algorithm, since, despite its intrinsic simplicity, it combines critical features, namely, the topological as well as the metric.It means that there must be, in the reconstructed pattern, an adequate balance between the characteristic upper loop and the bottom ending curve.Both methods reach the goal; the first method produces the letter up to a rotation and a homothety (the reasons for these effects have yet to be studied further).Meanwhile, the second method produces the letter up to just a homothety.As one can see in Figure 10, the reference pattern is the letter e.It is, in a general fashion, an interesting challenge to any same-purpose algorithm, since, despite its intrinsic simplicity, it combines critical features, namely, the topological as well as the metric.It means that there must be, in the reconstructed pattern, an adequate balance between the characteristic upper loop and the bottom ending curve.Both methods reach the goal; the first method produces the letter up to a rotation and a homothety (the reasons for these effects have yet to be studied further).Meanwhile, the second method produces the letter up to just a homothety.

Experimental Results
The samples for these experiments are a single trace without placing an additional processing signal, and were obtained using the hardware described in Section 2. The only preprocessing was placing the IMU's embedded 5 Hz low-pass filter before sending the data to the acquisition and processing board, and a sampling time of 10 ms was used for all the experiments.The experimental tests were carried out by tracing the curve in the air and trying to limit this to an imaginary plane mentally set in the air.The user traced the curve to be reconstructed, seeking to make circular patterns; however, the aim was to make the line as natural as possible without needing a template or forced position control, while not simply leaving the hand free to stroke at a speed that the person feels comfortable with.The test patterns drawn in the air by the person were the same as those used for the simulation.
For method one, only the result for the circular pattern is shown, since it was the only one successfully reconstructed (see Figure 11).Method one has impossibilities for pattern reconstruction in the case of significant curvature variations.In the case of method two, the patterns preserve the metric and the topology; however, it presents homothety.Method two performs better than method one, due to the generation of traverses.The fidelity concerning the original trace depends on the estimation of the initial conditions and how the speed is estimated, which is observed, above all, in the metric of the reconstructed trace.In the case of Figures 11 and 12, despite having a sinusoidal shape in their respective velocities and accelerations (see Figures 13 and 14), completing a cycle of 2, which in the case of Figure 12 is of higher quality compared to Figure 14, the circle drawn for the circular pattern is successful in both methods.Method one requires calculating linear velocities by setting the radius of gyration between the pen's tip and the sensor's center.This is because the IMU measures angular velocities.In method two, the linear accelerations are used directly from the IMU, so it is not necessary to assume conditions

Experimental Results
The samples for these experiments are a single trace without placing an additional processing signal, and were obtained using the hardware described in Section 2. The only preprocessing was placing the IMU's embedded 5 Hz low-pass filter before sending the data to the acquisition and processing board, and a sampling time of 10 ms was used for all the experiments.The experimental tests were carried out by tracing the curve in the air and trying to limit this to an imaginary plane mentally set in the air.The user traced the curve to be reconstructed, seeking to make circular patterns; however, the aim was to make the line as natural as possible without needing a template or forced position control, while not simply leaving the hand free to stroke at a speed that the person feels comfortable with.The test patterns drawn in the air by the person were the same as those used for the simulation.
For method one, only the result for the circular pattern is shown, since it was the only one successfully reconstructed (see Figure 11).Method one has impossibilities for pattern reconstruction in the case of significant curvature variations.In the case of method two, the patterns preserve the metric and the topology; however, it presents homothety.Method two performs better than method one, due to the generation of traverses.The fidelity concerning the original trace depends on the estimation of the initial conditions and how the speed is estimated, which is observed, above all, in the metric of the reconstructed trace.In the case of Figures 11 and 12, despite having a sinusoidal shape in their respective velocities and accelerations (see Figures 13 and 14), completing a cycle of 2π, which in the case of Figure 12 is of higher quality compared to Figure 14, the circle drawn for the circular pattern is successful in both methods.Method one requires calculating linear velocities by setting the radius of gyration between the pen's tip and the sensor's center.This is because the IMU measures angular velocities.In method two, the linear accelerations are used directly from the IMU, so it is not necessary to assume conditions that increase the reconstruction's uncertainty.
After all the previous remarks, we can conclude that method two produces better results in the task of reproducing the critical reference patterns, since it preserves the main topological, as well as metric geometric, features up to rotations, dilations, and translations.Given the above, the remaining test patterns are reconstructed experimentally only using method two, since it successfully reconstructed all patterns (see Figures 13-20).For the parabolic pattern of Figure 15, the acceleration in the y-axis (see Figure 16) has a baseline; this is because, in the case of the morphology of this pattern, the displacement on this same axis has the same baseline.The letter a (see Figure 17) has a reconstruction based on the measured accelerations in Figure 18, while the letter e (see Figure 19) is reconstructed from the acceleration patterns measured in Figure 20 for both cases, maintaining the base circularity of the letter and allowing the identification of the mark with the naked eye.
curve to be reconstructed, seeking to make circular patterns; however, the aim was to make the line as natural as possible without needing a template or forced position control while not simply leaving the hand free to stroke at a speed that the person feels comfortable with.The test patterns drawn in the air by the person were the same as those used for the simulation.
For method one, only the result for the circular pattern is shown, since it was the only one successfully reconstructed (see Figure 11).Method one has impossibilities for pattern reconstruction in the case of significant curvature variations.In the case of method two the patterns preserve the metric and the topology; however, it presents homothety Method two performs better than method one, due to the generation of traverses.The fidelity concerning the original trace depends on the estimation of the initial conditions and how the speed is estimated, which is observed, above all, in the metric of the reconstructed trace.In the case of Figures 11 and 12, despite having a sinusoidal shape in their respective velocities and accelerations (see Figures 13 and 14), completing a cycle of 2 which in the case of Figure 12 is of higher quality compared to Figure 14, the circle drawn for the circular pattern is successful in both methods.Method one requires calculating linear velocities by setting the radius of gyration between the pen's tip and the sensor's center.This is because the IMU measures angular velocities.In method two, the linear accelerations are used directly from the IMU, so it is not necessary to assume conditions that increase the reconstruction's uncertainty.After all the previous remarks, we can conclude that method two produces better results in the task of reproducing the critical reference patterns, since it preserves the main topological, as well as metric geometric, features up to rotations, dilations, and translations.Given the above, the remaining test patterns are reconstructed experimentally only using method two, since it successfully reconstructed all patterns (see Figures 13-20).For the parabolic pattern of Figure 15, the acceleration in the y-axis (see Figure 16) has a baseline; this is because, in the case of the morphology of this pattern, the displacement on this same axis has the same baseline.The letter a (see Figure 17) has a reconstruction based on    After all the previous remarks, we can conclude that method two produces better results in the task of reproducing the critical reference patterns, since it preserves the main topological, as well as metric geometric, features up to rotations, dilations, and translations.Given the above, the remaining test patterns are reconstructed experimentally only using method two, since it successfully reconstructed all patterns (see Figures 13-20).For the parabolic pattern of Figure 15, the acceleration in the y-axis (see Figure 16) has a baseline; this is because, in the case of the morphology of this pattern, the displacement on this same axis has the same baseline.The letter a (see Figure 17) has a reconstruction based on the measured accelerations in Figure 18, while the letter e (see Figure 19) is reconstructed from the acceleration patterns measured in Figure 20 for both cases, maintaining the base circularity of the letter and allowing the identification of the mark with the naked eye.

Discussion
The main objective of this work is to demonstrate that it is possible to generate a noninertial frame online cursive-handwriting system from curvature models, since this is the predominant form in this type of writing.
In the comparison made between the two proposed methods, we can highlight the fact that both show that it is possible to construct letters from linking multiple circular

Discussion
The main objective of this work is to demonstrate that it is possible to generate a noninertial frame online cursive-handwriting system from curvature models, since this is the predominant form in this type of writing.
In the comparison made between the two proposed methods, we can highlight the fact that both show that it is possible to construct letters from linking multiple circular

Discussion
The main objective of this work is to demonstrate that it is possible to generate a non-inertial frame online cursive-handwriting system from curvature models, since this is the predominant form in this type of writing.
In the comparison made between the two proposed methods, we can highlight the fact that both show that it is possible to construct letters from linking multiple circular sections and that the patterns obtained are very similar to what is recognized.However, the legibility between one and the other is far from equal, since our understanding is much closer to forming letters when they are made up of curves and straight lines.Even in cursive writing, after all, the notes that only include straight lines or simple curves are the first that the human mind can identify.
That said, the method that uses circular sections and straight lines is the most complete in reconstructing cursive letters and for the generation of online handwriting with a noninertial frame of reference.This work obtains an object focused on feature engineering based on differential geometry, prioritizing the shapes that the patterns present and not the dimension or accuracy of the position of the points, since it is aiming to be used in machine learning algorithms where it is necessary to vectorize the normalized feature.
Making a qualitative visual comparison with the results previously reported in the literature [5,8], it is possible to affirm that the results obtained with method two are comparable in terms of the fidelity of tracking the fundamental shape of the stroke.It is worth noting that, in contrast to the methods reported in [5] and [8], the method proposed in this work does not rely on an exhaustive preprocessing of the data in order to obtain the reported results.
The movement of the pen could be performed in three dimensions.However, this work assumes that the strokes made by the person are limited to an imaginary plane mentally set to write in the air.Both methods can be expanded to the idea of tracing in three dimensions; however, reading three-dimensional traces could be unpractical.

Conclusions
The methods shown are an alternative to the use of orientation-and trajectory-tracing tools for several reasons.The first reason is that they do not require a specific work area with special conditions such as a fixed work surface, or environmental conditions such as fixed lighting.
Comparing the two proposed models shows that it is possible to construct letters from circular sections and that the patterns obtained are similar to what is recognized, providing an alternative to quaternion calculus for poorly specified orientation problems.
The first method, based only on oscillating circles, has the advantage of a lower computational cost in the calculation.However, it has the disadvantage of not being sensitive to abrupt changes in trajectories.For method two, a combination of circles and straight lines is used; it was possible to observe that the recreation of the trajectory is faithful to the original trace, which make this method more suitable for an online handwriting system without an inertial reference frame and, even more, it could be extrapolated to other applications such as leader-follower robotic systems or teleoperation applications.

Figure 1 .
Figure 1.Digital writing system, a common pen with an IMU.

Figure 2 .
Figure 2. Physical digital writing system, connected to an UNO Arduino board.

Figure 3 .
Figure 3. Friendly prototype with the shape of a pen.

Figure 1 . 15 Figure 1 .
Figure 1.Digital writing system, a common pen with an IMU.

Figure 2 .
Figure 2. Physical digital writing system, connected to an UNO Arduino board.

Figure 3 .
Figure 3. Friendly prototype with the shape of a pen.

Figure 2 .
Figure 2. Physical digital writing system, connected to an UNO Arduino board.

Figure 2 .
Figure 2. Physical digital writing system, connected to an UNO Arduino board.

Figure 3 .
Figure 3. Friendly prototype with the shape of a pen.

Figure 3 .
Figure 3. Friendly prototype with the shape of a pen.

Figure 4 .
Figure 4. Let  be a second point over the curve close to point  .The point of contact to the tangent describes an arc ∆, and the tangent rotates through an angle ∆, known as the contingency angle.

Figure 4 .
Figure 4. Let P i+1 be a second point over the curve close to point P i .The point of contact to the tangent describes an arc ∆S, and the tangent rotates through an angle ∆τ, known as the contingency angle.

Figure 5 .
Figure 5. Three successive  points describing a trace with the circles associated with it.

Figure 5 .
Figure 5. Three successive P points describing a trace with the circles associated with it.

Figure 6 .
Figure 6.Three successive  points describing a trace.Figure 6.Three successive P i points describing a trace.

Figure 6 .
Figure 6.Three successive  points describing a trace.Figure 6.Three successive P i points describing a trace.

Figure 8 .
Figure 8. Parabolic pattern: (a) ideal case, (b) pattern generated through method one, and (c) pattern generated through method two.

Figure 9 .
Figure 9. Letter "a" pattern: (a) ideal case, (b) pattern generated through method one, and (c) pattern

Figure 8 .
Figure 8. Parabolic pattern: (a) ideal case, (b) pattern generated through method one, and (c) pattern generated method two.

Figure 9 .
Figure 9. Letter "a" pattern: (a) ideal case, (b) pattern generated through method one, and (c) pattern generated through method two.

Figure 9 .
Figure 9. Letter "a" pattern: (a) ideal case, (b) pattern generated through method one, and (c) pattern generated through method two.

Figure 10 .
Figure 10.Letter "e" pattern: (a) ideal case, (b) pattern generated through method one, and (c) pattern generated through method two.

Figure 10 .
Figure 10.Letter "e" pattern: (a) ideal case, (b) pattern generated through method one, and (c) pattern generated through method two.

Figure 11 .
Figure 11.Pattern of a circle generated through method one.

Figure 11 . 15 Figure 12 .
Figure 11.Pattern of a circle generated through method one.Micromachines 2024, 15, x FOR PEER REVIEW 11 of 15

Figure 12 .
Figure 12.Pattern of a circle generated through method two.

Figure 12 .
Figure 12.Pattern of a circle generated through method two.

Figure 13 .
Figure 13.Velocities (a)  and (b)  were measured through the IMU and used to reconstruct the circle.

Figure 14 .
Figure 14.Accelerations (a)  and (b)  were measured through the IMU and used to reconstruct the circle.

Figure 13 .
Figure 13.Velocities (a) V x and (b) V y were measured through the IMU and used to reconstruct the circle.

Figure 12 .
Figure 12.Pattern of a circle generated through method two.

Figure 13 .
Figure 13.Velocities (a)  and (b)  were measured through the IMU and used to reconstruct the circle.

Figure 14 .
Figure 14.Accelerations (a)  and (b)  were measured through the IMU and used to reconstruct the circle.

Figure 14 .
Figure 14.Accelerations (a) A x and (b) A y were measured through the IMU and used to reconstruct the circle.

Figure 15 .
Figure 15.Parabolic pattern generated through method two.

Figure 15 .
Figure 15.Parabolic pattern generated through method two.

Figure 15 .
Figure 15.Parabolic pattern generated through method two.

Figure 16 .
Figure 16.Accelerations (a)  and (b)  were measured through the IMU and used to reconstruct the parabolic pattern.

Figure 17 .
Figure 17.Reconstructed trace of the handwriting letter "a" generated through method two.

Figure 16 .
Figure 16.Accelerations (a) A x and (b) A y were measured through the IMU and used to reconstruct the parabolic pattern.

Figure 15 .
Figure 15.Parabolic pattern generated through method two.

Figure 16 .
Figure 16.Accelerations (a)  and (b)  were measured through the IMU and used to reconstruct the parabolic pattern.

Figure 17 .
Figure 17.Reconstructed trace of the handwriting letter "a" generated through method two.Figure 17.Reconstructed trace of the handwriting letter "a" generated through method two.

Figure 17 .
Figure 17.Reconstructed trace of the handwriting letter "a" generated through method two.Figure 17.Reconstructed trace of the handwriting letter "a" generated through method two.Micromachines 2024, 15, x FOR PEER REVIEW 13 of 15

Figure 18 .
Figure 18.Accelerations (a)  and (b)  were measured through the IMU and used to reconstruct the letter "a".

Figure 18 .
Figure 18.Accelerations (a) A x and (b) A y were measured through the IMU and used to reconstruct the letter "a".

Figure 18 .
Figure 18.Accelerations (a)  and (b)  were measured through the IMU and used to reconstruct the letter "a".

Figure 19 .
Figure 19.Reconstructed trace of the handwriting letter "e" through method two.

Figure 20 .
Figure 20.Accelerations (a)  and (b)  were measured through the IMU and used to reconstruct the letter "e".

Figure 19 .
Figure 19.Reconstructed trace of the handwriting letter "e" through method two.

Figure 18 .
Figure 18.Accelerations (a)  and (b)  were measured through the IMU and used to reconstruct the letter "a".

Figure 19 .
Figure 19.Reconstructed trace of the handwriting letter "e" through method two.

Figure 20 .
Figure 20.Accelerations (a)  and (b)  were measured through the IMU and used to reconstruct the letter "e".

Figure 20 .
Figure 20.Accelerations (a) A x and (b) A y were measured through the IMU and used to reconstruct the letter "e".