#### Archived

This topic is now archived and is closed to further replies.

# Inverse of an angle, limited to 180 degrees, i think.

This topic is 5931 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok , this will probably be too simple for g_rhodes and such but maybe someone will help me here. I''m trying to simulate a mirror. I have a plane which arcs from 0 to 180 degrees. I know the product i need to solve for is the inverse of the angle i am viewing from. So if i am standing 45 degrees from the beginning of the arc then the mirror should reflect the scene from a 135 degree view on the otherside. _____________________________________-- plane 180degrees !center of plane 0 degrees /\ / \ / \ / \ / \ 45 degree(not really but i cant simulate it with my keyboard) So 180 degrees - 45 degree angle of view should reflect the remainder (135 degrees) My humble question is given only the 3d world position of the character, the plane, and the simple equation that allows me to know the resulting product. how do i calculate this? If the plane is at 100, 200, 0 and the character is at 110, 200, -10 (x,y,z) what is the relationship that yields the angle? Dreddnafious Maelstrom "If i saw farther, it was because I stood on the shoulders of giants." Sir Isaac Newton

##### Share on other sites

To evaluate the angle between the mirror plane and a vector, use the dot product of the vector and the mirror''s normal.

To find the reflected vector v'', using the normalized normal N,

v'' = v - 2 * Dot(v, N)

Cédric

##### Share on other sites
I was going to post another method, but a direct formula is always nice!

##### Share on other sites
I believe it does but let me be sure.

V'' is a vector product that will be my camera veclookat vector(direct x)

V = the vector coords where my character is standing.

N is the "normalized normal" (is this just the surface of the mirror?) If so what data type is this? my guess is the vector of the center of the surface of the mirror, but that is of course only a guess.

Which leads to the next. is any portion of the equation you have given me to normalize the normal? or does it assume N = the normalized normal. Sorry, dot products and such are still a challenge to me.

Yes, i think you do understand my question, im trying to code a "mirror" algo and am failing miserably. So im trying to orient a camera from the mirror to the vector on the opposite angle from which the players viewpoint is.

ie if the player is 30degrees to the right of a line drawn perpindicular to the mirror plane , the camera should point 30 degrees left of that same line. Then of course i will render that camera''s view, onto the surface of the mirror.

Thanks for your help, and any more would be appreciated.

Dreddnafious Maelstrom

"If i saw farther, it was because I stood on the shoulders of giants."

Sir Isaac Newton

##### Share on other sites
Here''s a spiffy picture I drew up. Hope it explains some of the concept. It''s in 2D so you can get a better grasp of what we''re doing in 3D:

##### Share on other sites
That''s really spiffy, Zipster.

I''ll try to clear things up, but you should probably read one of the introduction on vectors in the Articles section. Your terminology is... not what I am used to.

Your camera is looking in direction V. This vector intersects the plane of the mirror at point P. V'' is the reflected vector. If you want to know what should be the ''color'' to put at a certain point on the mirror (such as in a ray-tracing simulation), start a new ray at point P, with direction V''.

I haven''t used the position of the camera C anywhere, because I didn''t that was what you were looking for. Do you have problems finding P, the intersection between the look-at vector and the plane of the mirror?

And yes, N is the normal of the surface of the mirror.

I hope it clears things up a little.

Cédric

##### Share on other sites
Nah, you guys have nailed it. will read the stuff about vectors though, thanks for that heads up.

I think i''ll need to educate myself on normalizing normals and perhaps vectors before i bother you guys again, but i just want to say Thank you for taking the time to help me. and @ Zipster, WOW thanks for the cool visual, that really hit home. I understand what i must do now, just have to study up on some of the terminology so i can really relate to the answers.

ty,ty,ty.

Dreddnafious Maelstrom

"If i saw farther, it was because I stood on the shoulders of giants."

Sir Isaac Newton

##### Share on other sites
Ahhhhh!!! Wow! I do get it! I''ll bet i know how to "normalize" a normal now also, let me check. Cool! it''s not often i get to have an Ahhhhhh! moment at work. Thanks again.

Dreddnafious Maelstrom

"If i saw farther, it was because I stood on the shoulders of giants."

Sir Isaac Newton

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633682
• Total Posts
3013314
×