Finding the percentage of a distance between 2 points with an offset

Prototype

New member
Joined
Nov 22, 2018
Messages
7
This one is tough to explain. Okay, so say you have a side of a square with a length of 40 inches. You are required to place 4 10x10in squares along the edge of the 40x40in square. In the center of each 10x10in square's edge, a point is placed. Another point is placed in the same place on the 40x40in square's edge, as shown below. The 40x40in square is purple, 10x10in squares are white. The way the points are placed is based on a percentage from the top right corner and the bottom right corner, such that the points are placed at 12.5%, 37.5%, 62.5%, and 87.5% of 40in.
math1.jpg
Points placed along the edges of the squares will connect together, like this:
math2.jpg

Now let's say that the purple square has a length of 43in, but we kept the original percentages. That would result in the points looking like this:
math3.jpg

As you can see, the 10x10in squares no longer line up. I'm looking for a formula that finds the percentages of the distance that puts x amount of squares evenly centered along the edge with a distance of n, leaving an offset on either side if n isn't an even multiple of 10. If some clarification is needed I'm more than happy to explain more, thank you all
 
Wrong category?

I apologize if the post was in the wrong category, I wasn't sure where else to post it.
 
This one is tough to explain. Okay, so say you have a side of a square with a length of 40 inches. You are required to place 4 10x10in squares along the edge of the 40x40in square. In the center of each 10x10in square's edge, a point is placed. Another point is placed in the same place on the 40x40in square's edge, as shown below. The 40x40in square is purple, 10x10in squares are white. The way the points are placed is based on a percentage from the top right corner and the bottom right corner, such that the points are placed at 12.5%, 37.5%, 62.5%, and 87.5% of 40in.
View attachment 10528
Points placed along the edges of the squares will connect together, like this:
View attachment 10529

Now let's say that the purple square has a length of 43in, but we kept the original percentages. That would result in the points looking like this:
View attachment 10530

As you can see, the 10x10in squares no longer line up. I'm looking for a formula that finds the percentages of the distance that puts x amount of squares evenly centered along the edge with a distance of n, leaving an offset on either side if n isn't an even multiple of 10. If some clarification is needed I'm more than happy to explain more, thank you all

I think you may be asking where to place the center of each small square so that the top edge of the top one is at the top edge of the large square, and the bottom of the lowest one is at the bottom edge of the bottom square, with equal spaces between squares.

To do that, imagine placing the top and bottom squares where you want them to be. Then there are 44 - 2*5 = 34 inches between the centers of the two squares you have placed; that space has to be filled by 5 + 10 + 10 + 5 = 30 inches of square, and three equal spaces between them. The spaces therefore have to add up to 33 - 30 = 3 inches, so each space is 3/3 = 1 inch. (This is how I think when I want to space picture frames on a wall, for example.) In terms of percentages, the top and bottom centers are 5/43 = 11.63% from the top and bottom, and the distance from one center to the next is 11/43 = 25.58%. I would never use percentages unless I had to; I would use the actual distances I calculated.

Algebraically, suppose you want to space N equal objects with height A in this manner along a wall of height B. Then the spaces total B - NA, so each of the N-1 spaces is (B - NA)/(N - 1).
 
Not quite

I actually intend to have zero distance between them, and have the extra distance on the top and bottom of the edge. I have a previous example made from trial and error that I'll post here. I'm wondering if there's a formula to figure out where to place the points so that you fit as many 10x10 as possible.
math4.jpg
As seen here there are 4 10x10 cubes placed on a side of a length of roughly 48 (hence the trial and error). If there was a formula to find the points of those 4 squares on any side length with maximum 10x10 squares that would be really helpful. Thank you!
 
I apologize if the post was in the wrong category, I wasn't sure where else to post it.
There is no need for concern. From the forum's guidelines:

… If you're not sure which board to use, feel free to guess. We can always move a thread later.


:idea: If you plan on using this forum again, you can familiarize yourself with the guidelines by starting with this summary. Cheers :cool:
 
I actually intend to have zero distance between them, and have the extra distance on the top and bottom of the edge. I have a previous example made from trial and error that I'll post here. I'm wondering if there's a formula to figure out where to place the points so that you fit as many 10x10 as possible.
View attachment 10531
As seen here there are 4 10x10 cubes placed on a side of a length of roughly 48 (hence the trial and error). If there was a formula to find the points of those 4 squares on any side length with maximum 10x10 squares that would be really helpful. Thank you!

This certainly isn't what you said before. But it's a lot easier.

Just subtract the total of the small squares from the large square to get the extra space needed, 43 - 4*10 = 3 inches, and divide that by 2 to get the space needed at each end, 3/2 = 1.5 inches. Then the small squares can fit in the 40 inches between those two marks (using, if you like, the same percentages that you had).

If you have to find where the centers are, rather than just fitting the top of each square to the bottom of the previous one, let me know. But it's not very hard.

If you didn't know how many could fit, you'd just divide the 43 by 10 to get 4 remainder 3, and that remainder is what you divide between top and bottom. For 48, you get quotient 4 and remainder 48 - 4*10 = 8, so there would be 4 inches at top and bottom.
 
Yes please

I apologize that I hadn't worded my original post very well, but at least the picture helps! I'd like to know where to place the points in that case, with the overhangs. I've figured out a method that works for an even number of 10x10 squares but a general method would be nice! Thank you
 
Last edited:
I apologize that I hadn't worded my original post very well, but at least the picture helps! I'd like to know where to place the points in that case, with the overhangs. I've figured out a method that works for an even number of 10x10 squares but a general method would be nice! Thank you

Can you show me the method you have, so I can be sure my approach matches your needs? I expect just a small adjustment will be needed.
 
Alrighty

So I'm writing an online guide (The context of my entire problem is modding a game, and I'm making a shape modding guide) And I had already made a list of steps for players to follow. I'll include it here:
portguideeven.jpg

Edit: Sorry that the text is small! I can write it out if you need me to. I've tested this method with a side length of 43 and 46 so far, and it has worked both times.
 
Last edited:
So I'm writing an online guide (The context of my entire problem is modding a game, and I'm making a shape modding guide) And I had already made a list of steps for players to follow. I'll include it here:
View attachment 10532

Edit: Sorry that the text is small! I can write it out if you need me to. I've tested this method with a side length of 43 and 46 so far, and it has worked both times.

I can almost read it, but it will be a lot easier if you type it out. It may also help if you tell me what a "port" is, as far as this task is concerned -- that is, not what it means in the game, but what the number represents (e.g. a coordinate).
 
Sure thing

The ports are just the points along the edges in this case, the percentages between 0 and 1 along the edge. The 10x10in squares have 1 port in the middle of each side.
Here are the steps written out:

Step 1: Find as many 10x10s you can fit (1, 2, 3, 4, etc) and make the ports as if the side was the multiple of ten to fit them (10, 20, 30, 40 respectively). If your cube number is an even number (2, 4, 6) Then follow the directions below

Step 2: Next, find the overhang on either side, for example if the side has an overhang of 3 on either side (26, 46, 66, etc). Take one side (3) and divide it by 2 to get 1.5.

Step 3: Divide that by your total side length (26 46, 66, etc) and make sure you keep this number! I will be referencing this number as "o".

Step 4: Take "o" and add it to all ports between 0 and 0.5 excluding the middlemost 2 ports (one left and one right) (for example, if you have 6 ports you would add "o" to ports 1 and 2).

Step 5: Next subtract "o" from all ports between 0.5 and 1 excluding the middlemost 2 ports (out of 6 ports you would subtract "o" from ports 5 and 6).

Step 6: Divide "o" by 2 and add that number to all ports between 0 and 0.5 including the middle left port, and subtract "o"/2 from all ports between 0.5 and 1 including the middle right port.
So for example, with 6 ports you would add "o"/2 to the first 3 and subtract "o"/2 from the last 3.
 
Last edited:
The ports are just the points along the edges in this case, the percentages between 0 and 1 along the edge. The 10x10in squares have 1 port in the middle of each side.
Here are the steps written out:

Step 1: Find as many 10x10s you can fit (1, 2, 3, 4, etc) and make the ports as if the side was the multiple of ten to fit them (10, 20, 30, 40 respectively). If your cube number is an even number (2, 4, 6) Then follow the directions below

Step 2: Next, find the overhang on either side, for example if the side has an overhang of 3 on either side (26, 46, 66, etc). Take one side (3) and divide it by 2 to get 1.5.

Step 3: Divide that by your total side length (26 46, 66, etc) and make sure you keep this number! I will be referencing this number as "o".

Step 4: Take "o" and add it to all ports between 0 and 0.5 excluding the middlemost 2 ports (one left and one right) (for example, if you have 6 ports you would add "o" to ports 1 and 2).

Step 5: Next subtract "o" from all ports between 0.5 and 1 excluding the middlemost 2 ports (out of 6 ports you would subtract "o" from ports 5 and 6).

Step 6: Divide "o" by 2 and add that number to all ports between 0 and 0.5 including the middle left port, and subtract "o"/2 from all ports between 0.5 and 1 including the middle right port.
So for example, with 6 ports you would add "o"/2 to the first 3 and subtract "o"/2 from the last 3.

First, let's try following these directions for your example (large square 48, small ones 10), to make sure I understand.

1: 48 / 10 = 4, remainder 8, so we can fit 4. Then, if we fit 4 squares together into a total height of 40, their centers (relative to the top of the top one) will be at 5, 15, 25, 35. But it appears from your explanation of "ports" that they are represented not by actual distances but by fractions of the total length, so my distances have to be divided by 40, giving 1/8, 3/8, 5/8, and 7/8, which I guess you get as decimals: 0.125, 0.375, 0.625, 0.875.

2: Because our excess is 8, I think you are taking the "overhang on either side" as 4. But you seem to be dividing by 2 again. In my original example, starting with 43, I subtracted 43-40 to get 3, which I divided in half; the 3 was the total excess, not the overhang "on each side". You may be wrong here, in virtue of not having stated how to find the "overhang". Or maybe I'm misreading something.

3: I divide my 4 by 48 and get the decimal 0.083... . That is my "o". It can be dangerous to tell mathematically challenged people to work with non-terminating decimals like this, but I'll be okay.

4: Now I shift the top port(s) down this amount, the bottom one(s) up by the same amount, and then do something different to the middle ones. This is wrong; if you have initially placed them next to one another, then you want to move all of them the same amount, so they will still be together. You should just be adding "o" to all of them; if that doesn't work, then it means you calculated something wrong. In my example, we move the centers to 0.208333, 0.458333, 0.708333, and 0.958333. The resulting absolute positions will be these times 48, namely 10, 22, 34, and 46. Hmmm ... these are not adjacent, so they are spread out too far. So your "o" (or my version of it) is wrong. And that is probably because you are using percentages of 40 and applying them to 48, which stretches out the blocks themselves.

Let's start over. I would leave the percentages for last; I'm guessing that the reason you want to start and end with percentages is that you already have some technique for finding the centers as percentages, and want to use that. I wouldn't. Here's my procedure:

I found that my blocks have to move 4 inches (half of the total excess); and I found the centers before that move to be 5, 15, 25, 35. So I just add 4 to each: 9, 19, 29, 39. Now, since you want to express these as percentages of the 48, we divide those by 48 and get 0.1875, 0.3958, 0.6042, 0.8125. Note that these differ by 0.208333, which corresponds to 10 inches, so they are adjacent.
 
Wow

That's a surprisingly simple solution, thank you very much for helping me! Works perfectly
 
Top