Jump to content
  • Advertisement
Sign in to follow this  
Boku San

Finding the angle between faces in a pyramid

This topic is 5424 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

so.... you need to find angle between faces, in mathematical sense, or you need to find angle that turns one face into other when you horisontally rotate it? Second angle is 2pi/n where n is number of sides of piramid.

if you know how to find angle between vectors, and you know how to find normals, you can apply teh knowledge - find normals, find angle between normals, you'll have angle between faces.

Normal is given by cross product of 2 edges, that is, if triangle have points ABC, normal is (A-B)x(B-C) where x is cross product.

Sometimes you need to make normal N to be unit-length ,it's confusingly called normalize, it's can be done by N=N*(1/sqrt(DotProduct(N,N)))
You can find angle between vectors N1,N2 by
a=acos(DotProduct(N1,N2)/sqrt(DotProduct(N1,N1)*DotProduct(N2,N2));
if(a>pi*0.5)a=pi-a;
This formule works bad for small angles. It might be better to use
asin(Length(CrossProduct(N1,N2))/sqrt(DotProduct(N1,N1)*DotProduct(N2,N2))
where Length returns length of the vector,that is, length(a)=sqrt(DotProduct(a,a))

You'll need to search for cross product and dot product if you don't know what's it all about.

*******************************************

I'll anyway try to solve it more optimally(w/o cross products and renormalizations):

Let angle between normals is a.
Geometrically i can see a formule( very hard to explain in ascii art, or in words)
1:
2*sin(a/2)=2*sin(pi/n)*sin(angle_between_base_and_any_face)
(hope i'm right...)
where 2*sin(a/2) it's distance between unit-length normal vectors. Difference of unit-length normal vectors is horisontal due to symmetry. So it's equal to distance between projections of normals onto horisontal planes, it's 2*sin(pi/n)*sin(angle_between_base_and_face)
Let s it's radius of circle drawn inside base:
s=r*cos(pi/n)
then from definition of sin,
sin(angle_between_base_and_face) = h/sqrt(s2+h2)
so from 1 we have
sin(a/2)=sin(pi/n)*h/sqrt((r*cos(pi/n))2+h2)
and replacing cos2 by 1-sin2
sin(a/2)=sin(pi/n)*h/sqrt(r2*(1-sin(pi/n)2)+h2)
so a=2*asin(sin(pi/n)*h/sqrt(r2*(1-sin(pi/n)2)+h2))

Hope it's right.... evening there, i might have made some typos.

[Edited by - Dmytry on October 11, 2004 4:32:24 PM]

Share this post


Link to post
Share on other sites
Advertisement
In fewer words you need to make vectors out of two sides of each triangle.
The cross product is just an operation that can be performed on two vectors that will return a third, and it will be perpedicular to the plane created by the first two.
That is your "normal" or "direction this thing faces".

Dot product is another vector operation, except it returns a decimal number, and it happens to turn out that if you take the inverse-cos of that number, you get the angle between the two vectors (the angle you happen to be looking for).

Share this post


Link to post
Share on other sites
do you know anything about vectors if so well in 2-d you could find the outside angles by A X B = [A]sin(<) But this does have a some involvement. If you haven't learned about vectors forget you even saw that. Some else may know the vector equation to find these angles in the 3-D.

this is how i would go about it. i'm a junior at LSU, I have to take all those classes

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by halfangel
do you know anything about vectors if so well in 2-d you could find the outside angles by A X B = [A]sin(<) But this does have a some involvement. If you haven't learned about vectors forget you even saw that. Some else may know the vector equation to find these angles in the 3-D.

this is how i would go about it. i'm a junior at LSU, I have to take all those classes


I'm sorry A and B being Vectors and [A] are the magnitudes of the vectors. Label your pyramid to get your vectors piece by piece. then solve for you angle, swaping the formula around to be (<)=sin(-1) ((A X B)/[A]

if you don't know the cross product you can use the matrix to find it

| Ax Ay Az|
| Bx By Bz| = (AyBz-AzBy, AzBx-AxBz, AxBy-AyBx)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by halfangel
do you know anything about vectors if so well in 2-d you could find the outside angles by A X B = [A]sin(<) But this does have a some involvement. If you haven't learned about vectors forget you even saw that. Some else may know the vector equation to find these angles in the 3-D.

this is how i would go about it. i'm a junior at LSU, I have to take all those classes


I'm sorry A and B being Vectors and [A] are the magnitudes of the vectors. Label your pyramid to get your vectors piece by piece. then solve for you angle, swaping the formula around to be (<)=sin(-1) ((A X B)/[A]

if you don't know the cross product you can use the matrix to find it

| Ax Ay Az|
| Bx By Bz| = (AyBz-AzBy, AzBx-AxBz, AxBy-AyBx)

Share this post


Link to post
Share on other sites
Using just trig. A line from the center of the base to the center of a side is the hypotheneous of a right triangle. That right triangle is formed by a line from the center of the base to the center of a side and from the center of the side toward the apex. It doesn't go all the way to the apex, but rather stops at a point where a line from the center of the base through that point would be perpendicular to the side. Once you have that length you can use the angle of a side with the base to project the point onto the base, i.e. now that length is the hypotheneous. You can draw a line parallel to the side and it intersects a line from the center to a corner. The distance between the projection of the point on the side to the base to that intersection is the side of a right triangle with one angle half the angle between the two faces. You have the lengths of two sides of that right triangle.

Oops, stopped too soon. The distance from the projection of the point on the side to the base to the intersection with the line to the corner becomes the hypotheneous of a right triangle. The right angle is the intersection of a line connecting the projection of the points on two adjacent side with the line to the corner. The length of that is half the distance between the points on the side.

That doesn't tell you exactly how to calculate it, but it does give you a geometric construction. You should be able to fairly easily draw it using just a top and front view.

[Edited by - LilBudyWizer on October 12, 2004 3:40:07 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by LilBudyWizer
Using just trig. A line from the center of the base to the center of a side is the hypotheneous of a right triangle. That right triangle is formed by a line from the center of the base to the center of a side and from the center of the side toward the apex. It doesn't go all the way to the apex, but rather stops at a point where a line from the center of the base through that point would be perpendicular to the side. Once you have that length you can use the angle of a side with the base to project the point onto the base, i.e. now that length is the hypotheneous. You can draw a line parallel to the side and it intersects a line from the center to a corner. The distance between the projection of the point on the side to the base to that intersection is the side of a right triangle with one angle half the angle between the two faces. You have the lengths of two sides of that right triangle.

Oops, stopped too soon. The distance from the projection of the point on the side to the base to the intersection with the line to the corner becomes the hypotheneous of a right triangle. The right angle is the intersection of a line connecting the projection of the points on two adjacent side with the line to the corner. The length of that is half the distance between the points on the side.

That doesn't tell you exactly how to calculate it, but it does give you a geometric construction. You should be able to fairly easily draw it using just a top and front view.


it's somewhat similat to how i derived my formule:
(truing to explain...)

If N1 it's [unit-length] normal of one face and N2 it's normal of other face, ||N1-N2|| it's 2*sin(a/2) where a it's angle between normals(1).(edit: it's just yet another angle-between-vectors formule.)

You can easily see that N1-N2 is horisontal. So N1-N2=(N1 projected onto z=0 plane) - (N2 projected onto z=0 plane).
Both normals have equal angles between 'em and z direction, and both projections have length
sin(angle between normal and z direction)

Angle between projections of normals is 2*pi/n.
And length of difference of projections of normals is sin(angle between normal and z direction)*2*sin(pi/n)
using (1)
2*sin(a/2)=sin(angle between normal and z direction)*2*sin(pi/n)

then, angle between normal and z direction = angle between face and base.

edit: how to follow formules : do some drawings, and try to find the formule yourself...

[Edited by - Dmytry on October 12, 2004 7:08:30 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

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!