Question: Write a function called penMotion. It should take two arrays as input, one containing the x - coordinates of the pen stroke, and one containing

Write a function called penMotion. It should take two arrays as input, one containing the x-
coordinates of the pen stroke, and one containing the y-coordinates. The function should
return two arrays. The first should contain the arc-length value of each point on the stroke,
and the second should contain the pen speed at each point. The values must be returned in
that order.
The arc length, s(i), of the ith point on the stroke is computed as:
si=si-1+(xi-xi-1)2+(yi-yi-1)22
The first data point has an arc length value of zero.
The speed, v(i), of the ith point on the stroke is computed as:
vi=(xi-xi-1)2+(yi-yi-1)22ti-ti-1
where ti-ti-1 is the time between the two data points, which we will assume is 1.(This
assumption is valid if the data points are sampled at a constant rate.) Also, assume that the
first point on the stroke has a speed of zero, as it is not possible to calculate the speed using
this equation.
Hint: Your loops for computing arc length and speed should exclude the first data point on
the stroke.
 Write a function called penMotion. It should take two arrays as

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!