Okay, I give up: I need someone who knows geometry.

I'm trying to enclose a rectangle of known dimensions within an ellipse and expand the ellipse thirty feet from each angle. No, Pythagorean theorum didn't work (why????????), I tried expanding the rectangle theoretically by thirty feet at all diagonals, I tried magic.

I have Pythagged, sined, cosined, tangented and right now I could pass my junior trig and geometry with a A, but I cannot make a fucking ellipse that's perimeter entirely encloses a rectangle of known dimensions that is at least one hundred feet from the closest point in the rectangle.

What. Do. I. Need. To. Do?

Assume all measurements in feet, m is the multiplier to get the ratio to recalculate w, h to a, b for second rectangle and expanded ellipse.

Formula to calculate an ellipse: https://www.mathsisfun.com/geometry/ellipse-perimeter.html <--approximation 3

Current Rectangle:
w = 2640
h = 450
d = Sqr(x) = (w ^ 2) + (h ^ 2) = 2678.0776
p of rec = 6180
p of ellipse = 5487.4475

Increasing the diagonal by 100 at all angles
d2 = 2678.0776 + (100*4) = 3078.0776

(Corrected 30 to 100; I couldn't make thirty work at all).

I thought it was working with this formula:
New Rectangle:
m = d2/d = 3078.0776/2678.0776 = 1.1493
a = w * m = 2640 * 1.1403 = 3034.3126
b = h * m = 450 * 1.1403 = 517.2123
p of new rect: 7.103.0501
p of new ellipse = 6304.7578

It could work, but I'm not sure, because when I start expanding the rectangle itself and apply the formula to get real ellipse and new ellipse, it doesn't work and I don't know why. The only explanation I have is that I'm changing the height and width too much, but the same results occur no matter what I do.

Second group:
w = 10560
h = 24390
d = Sqr(x) = (w ^ 2) + (h ^ 2) = 26,577.9175
p of rect = 69,900
p of ellipse = 57,070.34402

Increasing the diagonal by 100 at all angles
d2 = 26577.9175 + (100*4) = 26977.9175

I thought it was working with this formula:
m = d2/d = 26977.9175/26577.9175 = 1.015
a = w * m = 10560 * 1.015 = 10718.92893
b = h * m = 24390 * 1.015 = 24757.07165
p of rect: 70952.00116
p of new ellipse = 57,747.0583

What is wrong with my brain that this isn't working? I verified my results with google and it agrees something is wrong with either a.) my brain or b.) geometry. I think it's geometry. I get ellipse calculations are complicated, but I double checked that part a few times and it's working, I think. At least, google thinks so when I enter my numbers to get the smallest ellipse but this is making no sense why I can't get that second one to work.

I'm listening to country music and not like, Girl in a Country Song but stuff like The Dance and The Thunder Rolls and Straight Tequila Night and The Bluest Eyes in Texas and I'd Be Better Off (In a Pine Box) (On a Slow Train Down to Georgia) (this is the South; we like to be detailed about how you are breaking our hearts, fucker). This is Southern wake after the death of grandma level shit here; this is when we drink Southern Comfort and Wild Turkey and a metric ton of margaritas (if your Southern is Texan), eat potato salad and fried anything, and everyone gets drunk, talks about their rifles and family scandals and at some point one to three parents have a knock-down drag out among the funeral flowers and someone hides in the closet with a brownie and...we're not talking about my childhood, right.

...this is where I am right now. Fix my geometry or I won't be understandable when I talk to anyone not in a central Texas bar; I already have too many vowels in my words and all my gerunds are missing a very important ending 'g'. I will write all my entries in the dialect of a central Texas rural farmer if I have to, and don't think I won't.

This has been a mathematical cry for help.

ETA: Oh God, I Want to Be Loved Like That just came up on rotation. Help.

ETA 2: If you saw an ealirer version, I was using '30 feet' not '100 feet'; I switched when testing the formuals to 100 because thirty simply didn't work and I wanted a dramatic change. All math here is based on an increase of 100 from all angles, or an increase of 200 of each diagonal.

ETA 3: Aded figures worked out in pencil, verified in excel and google, cited my formulas, and still WHAT.




Answered by [personal profile] edgewitch: Link to solution with proof!.
edgewitch: a nearly full moon with white leaves and fireflies (Default)

From: [personal profile] edgewitch Date: 2015-05-24 04:48 pm (UTC)
If I understand correctly, you're trying to define an ellipse that intersects a given rectangle only at the corners. The fact that this rectangle is a specific amount larger than some other given rectangle doesn't really matter, since you want this to work for an arbitrary rectangle.

The problem I see is that, given a rectangle, you can draw an infinite number of ellipses that go only through the corners, it just depends on the tangent of the ellipse at the corner. We have to add another restriction. Let me try it with the restriction that the ellipse has to be the same aspect ratio as the rectangle.


So we have an ellipse centered at (0,0): x2/aE2 + y2/bE2 =1
where aE is the radius on the x axis and bE is the radius on the y axis
And we have a point(the corner of the rectangle(also centered at (0,0) )): (xR, yR) = (aR/2, bR/2)
where aR is the width of the rectangle and bR is the height.
Now we add the restriction that aR/bR = aE/bE

You've said we know what the length and width of the rectangle are, so aR/bR = some constant, let's call it K.
Now we can say that aE/bE = K and therefore aE = K * bE
With all of that, we can get the ellipse equation in terms of only one variable (bE):

(aR/2)2/(K * bE)2 + (bR/22)/bE2 =1

Solve for bE and get:
bE = Sqrt( (aR/2)2/K2 + (bR/2)2 )

Now to account for the difference between the first rectangle and the second, keeping both rectangles the same aspect ratio. Say the first rectangle is width w and height h. If we center it at (0,0) the upper right corner will be at (w/2, h/2).
The distance of this point from the origin will be d = Sqrt( (w/2)2+ (h/2)2). Without figuring out the angle of the diagonal, we can still say that sin(θ) = (h/2d) and that sin(θ) = bR/(2*(d+N)) where N is the distance the corner of the new rectangle needs to be from the corner of the original rectangle and bR continues to be the height of the new rectangle that needs to intersect our ellipse only at the corners.
Thus, h/2d = bR/(2*(d+N)) and therefore
bR = h(d+N)/d
and by similar reasoning with cos(θ),
aR = w(d+N)/d

Pulling that all together, using your original example of a starting rectangle of width 2640 and height 450 with a desired extra distance of 30, we get
d= sqrt((2640/2)^2 + (450/2)^2) ≈ 1339
aR = 2640(1339+30)/1339 ≈ 2699
bR = 450(1339+30)/1339 ≈ 460
Bringing back the stuff from before:
K = 2699/460 = 5.867
bE = Sqrt( ( (2699/2)^2/5.867^2 )+ (460/2)^2 ) ≈ 325.28
And so
aE = 5.867 * 325.28 ≈ 1908.41
Using approximation 2 from the link,
P ≈ 3.14 * (3(1908+325) - Sqrt( (3(1908)+325) (1908+3(325)) ) ≈ 7922.22

That is, the ellipse that goes through a rectangle the same shape but 30 units larger than the rectangle that is 2640x450 AND itself fits inside an even larger rectangle that is the same shape as both previously mentioned rectangles will be about 651 units tall and 3817 units wide. The perimeter will be about 7922 units long.

Someone pls check my work, I'mma go hunt down my ADHD meds.


edgewitch: a nearly full moon with white leaves and fireflies (Default)

From: [personal profile] edgewitch Date: 2015-05-24 09:28 pm (UTC)
Glad you like it :) Does it do everything you needed? I went with the aspect ratio constraint because it would be fairly easy to do. I have no idea if it gives the ellipse with the smallest perimeter or area. Though it might... I don't really remember how to approach optimization problems in geometry.

Profile

seperis: (Default)
seperis

Tags

Page Summary

Quotes

  • If you don't send me feedback, I will sob uncontrollably for hours on end, until finally, in a fit of depression, I slash my wrists and bleed out on the bathroom floor. My death will be on your heads. Murderers
    . -- Unknown, on feedback
    BTS List
  • That's why he goes bad, you know -- all the good people hit him on the head or try to shoot him and constantly mistrust him, while there's this vast cohort of minions saying, We wouldn't hurt you, Lex, and we'll give you power and greatness and oh so much sex...
    Wow. That was scary. Lex is like Jesus in the desert.
    -- pricklyelf, on why Lex goes bad
    LJ
  • Obi-Wan has a sort of desperate, pathetic patience in this movie. You can just see it in his eyes: "My padawan is a psychopath, and no one will believe me; I'm barely keeping him under control and expect to wake up any night now to find him standing over my bed with a knife!"
    -- Teague, reviewing "Star Wars: Attack of the Clones"
    LJ
  • Beth: god, why do i have so many beads?
    Jenn: Because you are an addict.
    Jenn: There are twelve step programs for this.
    Beth: i dunno they'd work, might have to go straight for the electroshock.
    Jenn: I'm not sure that helps with bead addiction.
    Beth: i was thinking more to demagnitize my credit card.
    -- hwmitzy and seperis, on bead addiction
    AIM, 12/24/2003
  • I could rape a goat and it will DIE PRETTIER than they write.
    -- anonymous, on terrible writing
    AIM, 2/17/2004
  • In medical billing there is a diagnosis code for someone who commits suicide by sea anenemoe.
    -- silverkyst, on wtf
    AIM, 3/25/2004
  • Anonymous: sorry. i just wanted to tell you how much i liked you. i'd like to take this to a higher level if you're willing
    Eleveninches: By higher level I hope you mean email.
    -- eleveninches and anonymous, on things that are disturbing
    LJ, 4/2/2004
  • silverkyst: I need to not be taking molecular genetics.
    silverkyst: though, as a sidenote, I did learn how to eviscerate a fruit fly larvae by pulling it's mouth out by it's mouthparts today.
    silverkyst: I'm just nowhere near competent in the subject material to be taking it.
    Jenn: I'd like to thank you for that image.
    -- silverkyst and seperis, on more wtf
    AIM, 1/25/2005
  • You know, if obi-wan had just disciplined the boy *properly* we wouldn't be having these problems. Can't you just see yoda? "Take him in hand, you must. The true Force, you must show him."
    -- Issaro, on spanking Anakin in his formative years
    LJ, 3/15/2005
  • Aside from the fact that one person should never go near another with a penis, a bottle of body wash, and a hopeful expression...
    -- Summerfling, on shower sex
    LJ, 7/22/2005
  • It's weird, after you get used to the affection you get from a rabbit, it's like any other BDSM relationship. Only without the sex and hot chicks in leather corsets wielding floggers. You'll grow to like it.
    -- revelininsanity, on my relationship with my rabbit
    LJ, 2/7/2006
  • Smudged upon the near horizon, lapine shadows in the mist. Like a doomsday vision from Watership Down, the bunny intervention approaches.
    -- cpt_untouchable, on my addition of The Fourth Bunny
    LJ, 4/13/2006
  • Rule 3. Chemistry is kind of like bondage. Some people like it, some people like reading about or watching other people doing it, and a large number of people's reaction to actually doing the serious stuff is to recoil in horror.
    -- deadlychameleon, on class
    LJ, 9/1/2007
  • If imitation is the sincerest form of flattery, then Fan Fiction is John Cusack standing outside your house with a boombox.
    -- JRDSkinner, on fanfiction
    Twitter
  • I will unashamedly and unapologetically celebrate the joy and the warmth and the creativity of a community of people sharing something positive and beautiful and connective and if you don’t like it you are most welcome to very fuck off.
    -- Michael Sheen, on Good Omens fanfic
    Twitter
    , 6/19/2019
  • Adding for Mastodon.
    -- Jenn, traceback
    Fosstodon
    , 11/6/2022

Credit

November 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2022
Page generated Apr. 23rd, 2025 11:10 am
Powered by Dreamwidth Studios