Skip to main content
gamedev.net
🔒 Locked

trigonometry problem *solved

Started by Dragon_Strike 14 replies 1.5k views
Original Post
Dragon_Strike
Dragon_Strike
im havin some trouble solving x from this problem... maybe someone could help me out? Image Hosted by ImageShack.us [Edited by - Dragon_Strike on January 12, 2007 7:48:13 AM]
Thermodynamics
Thermodynamics
And this is not homework?
[s]I am a signature virus. Please add me to your signature so that I may multiply.[/s]I am a signature anti-virus. Please use me to remove your signature virus.
Zakwayda
Zakwayda
Quote:
Original post by Dragon_Strike
...and what would it matter?
Most of the gdnet forums have a fairly strict 'no homework' policy.
Alrecenk
Alrecenk
Homework is strictly against the forum rules because this forum is primarily to discuss programming related problems and noone wants it full of school work. Explain how this is related to a game developement or atleast program developement problem and you'll get an answer much quicker.

edit: One of these days I will beat you to a post, jyk!
Dragon_Strike
Dragon_Strike
Quote:
Original post by jyk
Quote:
Original post by Dragon_Strike
...and what would it matter?
Most of the gdnet forums have a fairly strict 'no homework' policy.


ok.. well basically every question in this forum could be related to homework...

but no it is not homework.. its a problem from a math book ive got... "Math D Liber Pyramid"...

i hope i dont have to make a pic of the book page.. to prove that this is infact not a homework...

EDIT:: well its only indirectly related to programming.... im trying to work up on my trigonometry skills to solve some other problems... i wanted to know the distance between two spot lights...

I did not know u couldnt ask help with regular math problems in this forum... im sry.. and ill read up on the forum rules then...
Zakwayda
Zakwayda
Quote:
Original post by Alrecenk
edit: One of these days I will beat you to a post, jyk!
Hehe :)
Quote:
Original post by Dragon_Strike
ok.. well basically every question in this forum could be related to homework...

but no it is not homework.. its a problem from a math book ive got... "Math D Liber Pyramid"...

i hope i dont have to make a pic of the book page.. to prove that this is infact not a homework...
No one is trying to be difficult about it. It's just that this forum in particular has a fairly strict policy regarding homework questions, and Graham is pretty consistent about locking such threads.

As for the statement that 'every question in this forum could be related to homework', well, I suppose they could be, but usually you can get a pretty good idea whether they are or not by reading the post. The fact is, some questions are more suggestive of homework than others.

That said, you've said it's not homework, so at this point we should be able to turn our attention to the actual question you've posed :)
Thermodynamics
Thermodynamics
It looks like a good spot to use the law of sines.

Remember that the two legs of the inner triangle can be defined using the outer triangle.

Also I am not sure if it's necessary but the lower angles of the inner triangle will be complimentary to their adjacent angles.
[s]I am a signature virus. Please add me to your signature so that I may multiply.[/s]I am a signature anti-virus. Please use me to remove your signature virus.
Thermodynamics
Thermodynamics
Also, it would be helpful if you showed us, what you have tried, what you think you should be doing, or even what your book is currently discussing (since you said this came from a book.)
[s]I am a signature virus. Please add me to your signature so that I may multiply.[/s]I am a signature anti-virus. Please use me to remove your signature virus.
Dragon_Strike
Dragon_Strike
y ive been tryin with the sineus law... basiclt what i need to calculate x is the two inner legs... i also know that alla the lower angles depend on eachother...

starting form the left...

A
B = 180-13,3-A
C = 180-B
D = 180-28,2-C
E = 180-D


somehow i need to find a connection between the two outer triangles..
haphazardlynamed
haphazardlynamed
Quote:
Original post by Dragon_Strike
i wanted to know the distance between two spot lights...


I'm assuming here, that you have two spotlights, and they are both pointed to shine lightspots onto the ground for example.
And you want to know the distance between those points.


Well, the problem you Originally Asked, really isn't going to be very helpful in solving the spotlight situation, so I'd Skip It. In fact solving spotlight projection is going to be a lot more easily solved with vector operations than trig.

To solve spotlights, you just take the light vector from the center of each lightbulb, and intersect each one with the ground plane.
Then measure the distance between the intersection points.
If you want, you can also add an approximation for the radius of each lightspot (but really the center distances should be 'good enough')


To intersect the lightray with the ground plane. First take the coordinates of the litebulb relative to a point on the plane(some random origin reference)
Then project that rel_coordinate onto the plane's normal to find the distance of the light from the plane.
now, project the lightray vector onto the plane normal, and compare the resulting length with that of the distance from plane.
Using the resulting ratio, you can scale your lightray vector so it's endpoint reaches the ground - this is your intersection point.

So basically no trig is needed at all for that...
I sure haven't used trig in any of my games for ... forever
(pure vector/matrix is a Lot cleaner for 3d games, and since mouse input rotation stuff is generally some analog adjustment, who cares about any specefic degree/radian measure?)
haphazardlynamed
haphazardlynamed
Anyhow
the situation in the first picture Really doesnt seem related to calculating Spotlights to me, since with spotlights you'd have info about the lights coordinates relative to the surface; making things immensly easier.


To solve That one, since its Not HW, id do it using Relaxation...
define 4 lines with the propor angles between them, define 4 particles(intersections) that are constrained to slide along those lines
add an additional constraint of distance between the two known pairs...
add a constraint to force the 4 particles to be co-linear

loop through the various constraints till they all stabalize
when the floating point numbers cant see any more changes, you're close enough(fidelity limit of your game)




yeah that approach is ridiculous since the actual math could be solved directly, but its a lot easier and frankly... coding that up would be faster than solving it on paper... so in terms of runtime (not number of operations) it wins.
taby
taby
Have you tried to see if something like this works out?

450/24.8 = 18.145161290322580645161290322581
321/13.3 = 24.135338345864661654135338345865
x/28.2 = (450/24.8 + 321/13.3)/2

x/28.2 = 42.28049963618724229929662866844/2
x/28.2 = 21.14024981809362114964831433422
x = 28.2*21.14024981809362114964831433422
x = 596.155044870240116420082464225
Dragon_Strike
Dragon_Strike
thx for all the answers...

the spot light problem made alot of more sense now... ill try it out later...

since ive alrdy started with this problem i might as well solve it properly..

taby: how can the average of the sinus equation of the outer triangles equal the sinus of the inner?

EDIT:: at closer thought.. i dont think that solution is correct...

[Edited by - Dragon_Strike on January 12, 2007 2:49:32 AM]
Dragon_Strike
Dragon_Strike
Quote:
Original post by Dragon_Strike
thx for all the answers...

the spot light problem made alot of more sense now... ill try it out later...

since ive alrdy started with this problem i might as well solve it properly..

taby: how can the average of the sinus equation of the outer triangles equal the sinus of the inner?

EDIT:: at closer thought.. i dont think that solution is correct...


EDIT2:: Solved it... as u said i used the sinus law for the outer and inner triangles... thx
grhodes_at_work
grhodes_at_work
With regard to the homework discussion, I would like to thank everyone who replied, with very good and appropriate answers! The Forum FAQ has some more details on my position on this.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.