Jump to content
• Advertisement

#### Archived

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

# How do you reverse a normalized normal?

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

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I dont really know what I'm talking about but... I have a planes normal: normal.x = 0 normal.y = 0 normal.z = 1 but I want it to point in the opposite direction. I am under the impression that a normalized normal = 1 so I cannot simply do this: normal.x = 0 normal.y = 0 normal.z = -1 What must I do? [edited by - Green on September 15, 2002 7:53:11 PM]

#### Share this post

##### Share on other sites
Advertisement
reversing a vector is just changing all the signs..there''s no problem with that. The length stays at 1.

Runicsoft -- home of my open source Function Parser and more

#### Share this post

##### Share on other sites
How come I get the same positive result in both these cases, when my ray and ray vector are the same:

Case 1:
normal[2].x = 0;
normal[2].y = 0;
normal[2].z = 1;

Case 2:
normal[2].x = 0;
normal[2].y = 0;
normal[2].z = -1;

Given formula:

d = D3DXVec3Dot(&normal, &point);
numer = D3DXVec3Dot(&normal, &ray) - d;
denom = D3DXVec3Dot(&normal, &rayVector);
Distance = -(numer / denom);

#### Share this post

##### Share on other sites
length of vector = sqrt(x2+y2+z2)

Notice that the answer is always positive (assuming real numbers but come on...) regardless of the sign of the components. Whenever you square a real number you get a positive number. By the way, to reverse any direction vector, just scale it (multiply all of its components) by -1.

_____________________________

And the Phoenix shall rise from the ashes...

--Thunder_Hawk -- ¦þ
______________________________

#### Share this post

##### Share on other sites
Wow,

that explains why this entire week of working on collision detection and frustum culling was so difficult. I was getting positive numbers even though my normal''s direction was negative!

Doh!

Thanks for stopping the horror.

Lifes pretty funny when your a newb!

#### Share this post

##### Share on other sites
the inverse of Vector V is simply -V

maybe this need an operator.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

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

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633724
• Total Posts
3013554
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!