# Rate of forward motion from rolling rectangle vs degrees turned

1. Jan 22, 2014

### brimby

1. The problem statement, all variables and given/known data

I'm looking for a formula that relates the distance traveled by a 'rolling' rectangle compared to a given amount of degrees it has turned.

And while I have you, another problem I have with the rolling rectangle is that its center point would move up and then down with each 90 degree turn forward as it arches over its corner. What formula might describe this change in y-position of the rectangle's center as it 'rolls' forward?

2. Relevant equations
See my attempt.

3. The attempt at a solution
The best I can come up with for the rolling rectangle's forward motion is:
Δ (x position) = Δ (rotational position) $\times$ (b + (a-b)/2) where b is the new "bottom" side of the rectangle after a 90 degree roll, and a is the old "bottom" side. Although this seems like too linear of a formula to me. PI has got to work in there somewhere, right?

And for the Δy of the rectangle as it bobs along... the best I can discern from my sketches is Δy = Δrotational position $\times$ ((a-b)/2) for ascending segments and the inverse for the descending segments. Again, seems too linear.

Thanks for any insight. My first post here.

2. Jan 22, 2014

### tiny-tim

hi brimby! welcome to pf!
each time the rectangle rotates 90° (π/2) from being flat on one side to the next side, how far horizontally does the centre go?

(π will come in if you use radians rather than degrees)
since one corner is fixed for a long time, won't all other points move along circles?

3. Jan 22, 2014

### brimby

Ok yes. So I guess it would be easier to think about the axis of rotation being centered on the corner rather than the center of the polygon. And in that case, for a given turning of degrees upon the corner, the center of the polygon would move along the circumference of a circle with a radius extending from center to corner.

I searched for a formula like this, and found tons of stuff about the section of the circumference being c = rΘ , which is nice, but I need to see the Δx and Δy separately. I did find this:

But it has a radius of 1. Would I simply multiply sinΘ or cosΘ by the radius for it to work on other sized shapes?

Thanks again.

Update: I just tried it (I'm programming a game for class), and it didn't work. When I multiplied by the radius, it moved wild and crazy. When I didn't multiply by the radius, it was small and jerky.

Any further clues for me? I tried the stackexchange forum sites, but those guys are so picky and uptight that my question got shut down on the math, physics and game development sites for who knows what reason. I'm done with those guys, so you're my best hope at this point.

Last edited: Jan 22, 2014
4. Jan 22, 2014

### haruspex

As tiny-tim indicates, a good start is to consider only multiples of pi/2, but that just gives the θ(a+b)/π formula you already had. For intermediate angles, you'll need to break it into two cases; the function will depend on whether it's rotating from lying on the short side to lying on the long side or vice versa. It might help to sketch the path of the rectangle's centre for a rotation of π.

5. Jan 22, 2014

### tiny-tim

hi brimby!
yes

and the angle of the arc will be the external angle of the polygon (ie 180° minus the internal angle … for a rectangle, obviously they're the same: 90°)
you'll need to find the two angles between the line from the centre to the corner and the two sides at the corner let's call them φ and ψ (for a rectangle, ψ = 90° - φ)

then the centre of the rectangle will go from angle φ to angle 90° + φ

at angle φ, its coordinates are (rcosφ, rsinφ) where r is the distance to the centre from the corner

the rest i'll leave to you

6. Jan 22, 2014

### brimby

Ok so I figured out that I must have my rotation in radians when applying sin or cos to them for proper calculation... and now my x movement works!

and then I discovered this formula:

yP2=yP1−r(1−cosθ)

which I believe would be

But something still isn't right with the y movement. I'm going to tinker around with it for a while and then rephrase my question. Thanks for the help!

7. Jan 22, 2014

### haruspex

For any angle or just up to π/2? Could you post your formula?

8. Jan 23, 2014

### tiny-tim

hi brimby!

(just got up :zzz:)
he he!
no, that should be ∆y = r∆(cosθ) (or r∆(sinθ): i'm not sure what your θ is)

since in the case of a rectangle your "other" θ is 90° - θ, that's:

r(cosθ - sinθ)

(where θ is the angle from the vertical)

9. Jan 23, 2014

### brimby

O man I'm getting really confused now. I'm getting lost on all the ψ stuff, internal/external angle stuff, and the cosΘ - sinΘ stuff. Maybe I need to take a step back and revisit a geometry book. Or do you have any good links for me? I hate to make you walk me through the whole process.

I'm picturing the movement better now though. For a rectangle the center point would make a series of linked McDonald's-type (rounded) M's. I think.

One specific question though: am I going to need different formulas depending on which side the rectangle is currently sitting on (it's rotation status)? I'm starting to get the picture that there isn't one equation that governs the movement through the whole 360°.

@Haruspex: the formula I used that I'm perceiving as possibly working for x is Δx = r(sin(ΔΘ)). The dimensions of my testing rectangle are 210x and 150y. I have really only tested it for the first push onto its side, so yes, I believe that's π/2. And after hearing all this new information, I'm sure it probably falls apart after the first push.:uhh:

10. Jan 23, 2014

### tiny-tim

yes

in clock terms, one arc will be from 10 o'clock to 1 o'clock (which is higher), then from 11 o'clock (mirror image of 1 o'clock) to 2 o'clock (mirror image of 10 o'clock), then start from 10 o'clock again …

so that's two different equations, and then you have to repeat

11. Jan 23, 2014

### brimby

I don't understand why the external/internal angle matters. Since I'm working with Δposition, don't I also need to use ΔΘ? Wouldn't the change in angle be the same no matter where I measured it from?

12. Jan 23, 2014

### tiny-tim

the external/internal angle tells you the general shape

Θ gives you the actual coordinates

you have to measure Θ from the centre of the circle (the corner of the rectangle), or your cosΘ and sinΘ formulas won't work

13. Jan 23, 2014

### haruspex

Yes.
For the purposes of getting the y-motion, it might help to represent the problem a little differently. Rotating the rectangle through π/2 moves the centre through the first half of the M. The second half of the M is the mirror image in the x direction, so for the y direction it's the same as just rotating it back to the start position.
Can you think of a way to write the angle of the (initial) base in this reciprocating model in terms of the angle in the original model?

14. Jan 23, 2014

### brimby

I drew some sketches, and maybe I'll put them on here when I get home, but the first one was an upright ellipse. On it I tracked the segment that would be traversed across π/2, which would start a little above the x axis in the second quadrant (not on the axis because it's the center point), and travel up past the y axis a little ways into the first quadrant. I then tracked the next π/2 segment on the same ellipse, which began a little before the y axis on quad 2 and ended a little before the x axis in quad 1.

So then I realized that I needed to rotate my ellipse. Since my rectangle is at 0 rotation when it is lying on its side, and since I am tracking the center point, the true x axis should go from the non-rotated rectangle's corner up through the rectangle's middle point. So what I drew was two ellipses. One skewed a bit to the left, and one a bit to the right.

And I finally see what the deal is with the external/internal angles. In the first π/2 rotation (coming from the far left, x-axis, second quad), the height of the point is within the angle of the rotation, but in the second segment of the rotation (first quad) to find the height of the point I would need to look at the 90 - Θ angle.

Next step is looking into how the radius changes around an ellipse, and exactly which trig functions I need to calculate the sides of the triangles in the angles.

Getting close! I think...

Thanks for the help, both of you.

15. Jan 23, 2014

### haruspex

Why would the radius change? Isn't it half a diagonal of the rectangle?

16. Jan 23, 2014

### brimby

Hmmm... for some reason I was thinking I was dealing with an ellipse since it's a rectangle rather than a square. But I guess not, huh?

Well that will make things a lot simpler!

17. Jan 24, 2014

### brimby

How does this math look for the first π/2 rotation?

And I understand what you mean now about φ and ψ, tiny-tim. You're saying I have to account for the fact that the center point does not sit on the axis when beginning the rotation, and goes past the next axis at the end of each quarter rotation.

#### Attached Files:

• ###### circleMath.jpg
File size:
70.1 KB
Views:
64
Last edited: Jan 24, 2014
18. Jan 24, 2014

### tiny-tim

hi brimby!
yes, that's right … you've chosen your coordinates with the origin (0,0) at one end of the diameter of that circle, so the coordinates of the centre of the rectangle are x = r(1 - cosθ) and y = rsinθ

but can you see that you're making things difficult for yourself in the future? …

when you plot the position of the rectangle, you instantly know where the corners of the rectangle are going to be (x = 0, a, a+b, 2a+b, 2a+2b, …), sooo it's easiest to plot the centre of the rectangle relative to the positions of those corners!

in other words: you really want your x and y in your diagram to be measured from the centre of the circle (not the end of the diameter): that will be x = rcosθ, y = rsinθ
yes

19. Jan 24, 2014

### brimby

Yeah I definitely don't want my coordinates to have an origin at the edge of the circle. But wouldn't my version work in terms of Δx? My example rectangle is lying horizontally at the start, and rolling to the right. So that x at the edge of the circle would be a qualifying Δx as it moves right, right? In that situation x = rcos(Θ) would describe the movement left to go until it completes it's 90° turn, which isn't what I want.

One of the big errors I think I have been making is using sin(ΔΘ) and cos(ΔΘ), but I looked back on your post and I think you suggested Δsin(Θ) and Δcos(Θ). I'll have to wait until I get off work before I can go test it though. I think at first I assumed it was the same, but just thinking about it right now... yeah, they are completely different.

Sorry for always switching between x and Δx. Δx is truly what I want, as it makes more sense in terms of running my program.

So as it stands right now, I think my equations for the first quarter turn are:

Δx = r(1 - Δcosθ)
Δy = r(Δsinθ)

But if that isn't right, just tell me I'm wrong again. I'll believe you

Last edited: Jan 24, 2014
20. Jan 24, 2014

### tiny-tim

hi brimby!
sorry, i'm not followng what you're trying to measure

(nor what ∆x is)
yeah!