Positioning Shape Inside of Ellipse

In summary: If you are stretching in only one direction and not in both then your values will not change proportionally. You also need to figure out if the object is symmetric about the centre or not.
  • #1
MaTHFRo
7
0
In a game I'm developing, I have an ellipse which contains a blue shape inside of it like follows:

http://img6.imageshack.us/img6/9518/screenshot20120815at938.png [Broken]

In the picture, the curves of the blue shape have the exact same arc as the area of the ellipse that it mirrors.

In this game, the blue shape can be stretched horizontally or vertically at any time. When it is stretched, I'd like for the enclosing ellipse to be able to increase in size so that it can fit the newly resized blue shape with the exact amount of border space around the blue shape as in the picture above. This seems like something that should be simple, yet I'm having so much trouble with it.

I've tried two things so far, increasing the size of the ellipse by the same proportion that the blue shape increased. Problem with this is the boundaries also will increase proportionally and will be small if the shapes are small and large if they're large.

I've also tried increasing the ellipse by the same amount as the blue shape. For instance if the blue shape is stretched by 5 pts, then I try to stretch the ellipse by 5 pts. Problem with this is eventually the blue shape out grows the ellipse.

So anyway, I was wondering how this could be done, if it's even possible. It seems like something that should be easy, but I just can't wrap my head around this...

Thanks,

MaTHFRo
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
Hey MaTHRo and welcome to the forums.

One suggestion I have is to solve the inequality for the ellipse and the object itself. I'm assuming both have the same centre (i.e. the centre of both objects is the same).

The equation of an ellipse is ((x-c)/a)^2 + ((y-d)/b)^2 = 1 where (c,d) is the centre and (a,b) are the lengths of ellipse for the x-stretch and y-stretch respectively.

If you can model your shape as an equation with a centre, then you can solve for a and b variables for the ellipse and then you can re-create the right ellipse using an appropriate parameterization.

So before I can explain what this means, I need to know if you can give me the equations corresponding to the shape. It seems that the bottom sides of the object are flat but the other horizontal ones are not.

What we should do first is solve for the a and b for the ellipse when the inside is just a box. The thing is that has many solutions so you need to give the size of the box relative to the size of the ellipse.

In other words given the stretch sizes of the ellipse, what is the size of the boxes sides? Are they proportional and how so?
 
  • #3
chiro said:
Hey MaTHRo and welcome to the forums.

One suggestion I have is to solve the inequality for the ellipse and the object itself. I'm assuming both have the same centre (i.e. the centre of both objects is the same).

The equation of an ellipse is ((x-c)/a)^2 + ((y-d)/b)^2 = 1 where (c,d) is the centre and (a,b) are the lengths of ellipse for the x-stretch and y-stretch respectively.

If you can model your shape as an equation with a centre, then you can solve for a and b variables for the ellipse and then you can re-create the right ellipse using an appropriate parameterization.

So before I can explain what this means, I need to know if you can give me the equations corresponding to the shape. It seems that the bottom sides of the object are flat but the other horizontal ones are not.

What we should do first is solve for the a and b for the ellipse when the inside is just a box. The thing is that has many solutions so you need to give the size of the box relative to the size of the ellipse.

In other words given the stretch sizes of the ellipse, what is the size of the boxes sides? Are they proportional and how so?

Thanks for the response Chiro. Yes, the ellipse and the blue shape both share the same center. The width and height of the ellipse is 75.5 and 54.5. The width and height of the rectangular area of the blue shape is 42.98 and 39.51 (the width and height of the entire blue shape are 60.5 and 39.5 respectfully). So are you recommending that I find this equation for the blue shape, I can use it to find the new center, then I plug that into the equation of the ellipse, and somehow that will give me the size I need?
 
  • #4
Not the new centre, but the parameters for the stretch of the ellipse (i.e. the a and b parameters in the equation of the ellipse).

If you are stretching in only one direction and not in both then your values will not change proportionally. You also need to figure out if you want to keep the ratio between the stretch parameters a and b.

Basically, you decide how you want the stretch parameters to change as you change the width of your box and then solve for those parameters a and b. Once you have these (the centres don't change) you use a parameterization for the ellipse in terms of t to draw it (unless you simply give some graphics library the centre and the stretch values for a and b).
 
  • #5
GG

I can offer a few suggestions to help with your issue.

Firstly, it may be helpful to consider using mathematical equations to determine the size of the ellipse and the blue shape as they are stretched. This will allow for more precise control and ensure that the boundaries of the ellipse and the blue shape are always proportional.

Secondly, you can try using a scaling factor to adjust the size of the ellipse as the blue shape is stretched. This factor can be based on the ratio between the current size of the blue shape and its original size. For example, if the blue shape is currently 10% larger than its original size, the scaling factor can be set to 1.1, which will increase the size of the ellipse by 10%.

Another option is to use a combination of both methods mentioned above. This could involve using mathematical equations to determine the initial size of the ellipse and blue shape, and then using a scaling factor to adjust their sizes as they are stretched.

Additionally, it may be helpful to consider the shape of the ellipse and the blue shape. If the blue shape is stretched in a specific direction, the ellipse may need to be stretched in a different direction to maintain its shape. This could involve using different scaling factors for the horizontal and vertical dimensions of the ellipse.

Overall, it is important to carefully consider the relationship between the ellipse and the blue shape, and how their sizes should change as the blue shape is stretched. By using mathematical equations and scaling factors, you can achieve precise and consistent results in your game.
 

1. What is the purpose of positioning a shape inside of an ellipse?

The purpose of positioning a shape inside of an ellipse is to create a visually appealing design that draws the viewer's attention. It can also be used to convey a specific meaning or message, depending on the context and placement of the shape within the ellipse.

2. How do you determine the correct position for a shape within an ellipse?

The correct position for a shape within an ellipse can be determined by using mathematical calculations based on the size and orientation of the ellipse and the desired placement of the shape. Alternatively, it can also be determined by experimenting with different positions until the desired effect is achieved.

3. What are some common shapes that are often positioned inside of ellipses?

Some common shapes that are often positioned inside of ellipses include circles, squares, triangles, and other geometric shapes. Additionally, more complex shapes such as stars, hearts, and letters can also be used to create unique designs within an ellipse.

4. Are there any limitations to positioning a shape inside of an ellipse?

Yes, there are some limitations when positioning a shape inside of an ellipse. The size and orientation of the ellipse can affect the positioning of the shape, and it may not always be possible to achieve the desired placement. Additionally, some shapes may not fit well within an ellipse and may need to be resized or modified to fit properly.

5. Can positioning a shape inside of an ellipse affect the overall composition of a design?

Yes, positioning a shape inside of an ellipse can greatly impact the overall composition of a design. It can add depth and dimension to a flat design, and it can also create a sense of movement and flow within the composition. However, it is important to carefully consider the placement of the shape to ensure that it complements the rest of the elements in the design.

Similar threads

Replies
49
Views
2K
  • Other Physics Topics
Replies
12
Views
3K
Replies
4
Views
1K
  • Calculus
Replies
6
Views
1K
  • Introductory Physics Homework Help
2
Replies
65
Views
5K
  • Introductory Physics Homework Help
Replies
10
Views
6K
  • Special and General Relativity
2
Replies
42
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Replies
9
Views
1K
Replies
17
Views
3K
Back
Top