Known variables: h, w, a, b, c1, d1, e1, f1, and z°
Unknown variables: c2, d2, e2, f2, m, and n

I need to find m,n and then translate c1,d1 to c2,d2 and the same for e1,f1 to e2,f2. And, if it wasn't apparent, line cdef is always parallel to line abmn.

Other fun facts:
a = w/2
b = h/2

Halp!! Sad


Also... I am without my beloved TI calculator... lent it and never saw it again :'(


Yay example values:
  • Rectangle w × h
    800 × 600
  • Center Point (a,b)
    (400,300)
  • Point (c1,d1)
    (634,276)
  • Point (e1,f1)
    (738,380)
  • Angle
    135°
I forgot to mention, you can see the axes in the image above, but you should note that the Y axis is inverted. The higher up Y, the lower the coordinate. You can use your own values if you'd like and I can simply invert the Y axis when I use the formula for the purpose I need Smile
Important note: All variables with no subscript are now '1': a1, b1, m1, n1, h1, w1. This saves confusion.

Slope of line C1D1-E1F1, using y=mx+b:

y=mx+b
d1=mc1+b
b=d1-mc1

y=mx+b=mx+(d1-mc1)
y=m(x-c1)+d1
f1=m(e1-c1)+d1
f1-d1=m(e1-c1)
m=(f1-d1)/(e1-c1)

Obviously, that's just slope=m=rise/run, but I wanted to make it explicit. We know that line ab-c2d2-e2f2-mn has the same slope, m=(f1-d1)/(e1-c1). Now we'll do y+mx+b again, but this time with a1 and b1 (to save confusion with the y-intercept=b.

y=mx+b
y=[(f1-d1)/(e1-c1)]x+b
b1=[(f1-d1)/(e1-c1)]a1+b
b=y_intercept=b1-[(f1-d1)/(e1-c1)]a1

Therefore, the equation for the line ab-c2d2-e2f2-mn is:

y=[(f1-d1)/(e1-c1)]x+(b1-[(f1-d1)/(e1-c1)]a1) {{Equation B}}

Without any of that, we know the value of n1:

n1 = b1+(h1/2)

Now we can find m easily:

y=mx+b
m1=m*n1+b
m1=[(f1-d1)/(e1-c1)]*n1+(b1-[(f1-d1)/(e1-c1)]a1)

That gives us m1 and n1. We still need c2, d2, e2, f2. Luckily, we know we have a quadrilateral, so we know that the distance from c1d1 to e1f1 is the same as the distance from c2d2 to e2f2. Therefore, we know that:

e2=c2+(e1-c1)
f2=d2+(f1-d1)

That means the only thing left to find is c2 and d2. Because we know we have a rectangle, it follows that a1b1m1n1 is perpendicular to c1d1c2d2. Luckily, we know that for lines y1=m1x+b1 and y2=m2x+b2, where the two lines are perpendicular, m1 = 1/m2 and m2=1/m1. Hence, if we now use m=the slope of c1d1c2d2:

y=mx+b
y=(1/[(f1-d1)/(e1-c1)])x+b
y=[(e1-c1)/(f1-d1)]x+b
d1=[(e1-c1)/(f1-d1)]*c1+b
b=d1-[(e1-c1)/(f1-d1)]*c1
y=[(e1-c1)/(f1-d1)]*x+(d1-[(e1-c1)/(f1-d1)]*c1) {{Equation B}}

Now we just find the intersection of Equations {{A}} and {{B}} by setting y=y.

[(e1-c1)/(f1-d1)]*x+(d1-[(e1-c1)/(f1-d1)]*c1) = [(f1-d1)/(e1-c1)]x+(b1-[(f1-d1)/(e1-c1)]a1)
x* ( [(e1-c1)/(f1-d1)] - [(f1-d1)/(e1-c1)] ) = b1-[(f1-d1)/(e1-c1)]*a1 - (d1-[(e1-c1)/(f1-d1)]*c1)
c2 = x = [b1-[(f1-d1)/(e1-c1)]*a1 - (d1-[(e1-c1)/(f1-d1)]*c1)]/([(e1-c1)/(f1-d1)] - [(f1-d1)/(e1-c1)])

Now just plug that into {{Equation B}, and you have d2 = y. And we're done!

m1=[(f1-d1)/(e1-c1)]*n1+(b1-[(f1-d1)/(e1-c1)]a1)
n1 = b1+(h1/2)
c2 = [b1-[(f1-d1)/(e1-c1)]*a1 - (d1-[(e1-c1)/(f1-d1)]*c1)]/([(e1-c1)/(f1-d1)] - [(f1-d1)/(e1-c1)])
d2 = [(e1-c1)/(f1-d1)]*x+(d1-[(e1-c1)/(f1-d1)]*c1) where x = c2
e2=c2+(e1-c1)
f2=d2+(f1-d1)
Goodness gracious! Thanks a whole lot, Kerm!

Before I indulge in this large solution, I'd first like to post how far I've gotten (partially for documentation for myself Razz )




Two new variables, G and j

j = a = h/2

G = 180-Z
G = 180-135 = 45

Segment abmn = sin(G) × j
Segment abmn = sin(45) × 400 = 282.8427125

Now we know lenght of abmn.

Still need to know mn, c2d2, and e2f2
Sadly, Kerm, your solution is not ideal. Its a pretty difficult one to implement, and since it is more of a linear-based solution (as opposed to angle-based?) I also hit an issue with 0°, 90°, 180°, 270°, and 360° angles

I've attempted to make the problem a little easier to read and work with. The ideal solution will work for the first example, as well as the following example.



Known: A, B, C, P, R, T, Z, h, w
Need: D, E, F; Length of dcef and ef segments

Known Data:
h = 600
w = 800

C is at (w/2,h2) = (400,300)
R is at (400,0)
P is at (400,600)

A is at (534,88)
B is at (740,296)
T is at (534,0)
Z is at (534,600)

∠TAB = 135°
∠ZAB = 45°

∠RCE = ∠TAB
∠PCE = ∠ZAB

Problem Solving
∠ZFE = 90 - ∠PCE
∠ZFE = 45°

segCP = segRC = 400
segCF = sin(∠PCF) × segCP
segCF = sin(45) × 400
segCF = 282.8427125



Now all I really need is the length of segEF to solve the problem, since we know that segDE = segAB.

So segDF = segDE + segEF
Indeed, as I said, I provided the vector component solution, which fails for angles z%90=0. An angle-magnitude solution may be able to avoid that weakness.
Definitely. I meant to note that I mentally made a mental note that you noted that in the beginning in our yesterday discussion yesterday.


For any of you people who dare to attempt the problem, here's a less-molested version of the diagram.

Still lost... Anyone with a bit of extra time on their hands, please help!

I haven't had the time to really sit down and attempt this many more times lately. Any insight or random suggestions would be nice Wink
swivelgames wrote:
Still lost... Anyone with a bit of extra time on their hands, please help!

I haven't had the time to really sit down and attempt this many more times lately. Any insight or random suggestions would be nice Wink
Why not just work through the angle-magnitude vector model of this particular problem? Or are you not sure where to begin with that? If you're not sure, I can take a little time and walk you through it. Smile
Yeah, I'm not sure where to start with that Sad

A walk through would be awesome! Smile Even if it takes a week or so to creep through the whole thing Laughing
*poke*
*poke* *poke*
Alright, someone posted a solution on to my question Math StackExchange (I know, bumping a REALLY old topic here Razz)

I did my best to convert it to JavaScript. As I am not in the slightest bit a mathematician, I'm a bit wary of my understanding of what he posted. Anyone who's willing is more than welcome to verify the code below matches the equation he wrote out in his answer Very Happy


Code:
var A = {"x": 534, "y": 88},
    B = {"x": 740, "y": 296},
    C = {"x": 400, "y": 300},
    D = {"x": 0, "y": 0},
    E = {"x": 0, "y": 0};

var DXnume = Math.pow(A.x,3)-(2 * Math.pow(A.x,2) * B.x) + (A.x * (Math.pow(B.x,2) + ((A.y - B.y) * (A.y - C.y)))) + ( (A.y - B.y) * (C.x * (A.y - B.y) + B.x * ( (-1 * A.y) + C.y))),
    DXdenom = Math.pow(A.x - B.x, 2) + Math.pow(A.y - B.y, 2);

D.x = DXnume/DXdenom;

var DYnume = ( Math.pow(A.x, 2) + (B.x * C.x) - (A.x * (B.x + C.x)) + (A.y * (A.y - B.y))) + Math.pow(A.x - B.x, 2) * C.y;
var DYdenom = DXdenom;

D.y = DYnume/DYdenom;

E.x = D.x + B.x - A.x;
E.y = D.y + B.y - A.y;
;

I'll be writing out the rest of the formulas he gave me once I have some free time ago. And, I apologize about the crappy code formatting above Razz

Isaac's answer: http://math.stackexchange.com/a/93830/19215
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement