1 Attachment(s)
Calculate Slope of a triangle
The picture attached gives the example I need a solution to.
I showed this to my math prof and he couldn't figure it out but then he teaches math class's of a lower level so his practice in this category is lost.
I need the angle of the triangle...If you need to picture this in your head, assume the triangle is a piece of a cliff...The two bottom points are on the ground and the top point is in the air.
I need to know the slope or steepness of the triangle to the ground.
If the triangle is 60-90 degree then I consider it a cliff.
An explanation of the steps would be ncie, some pictures would be nice, the answer would be nice, any sort of help would be nice.
Thanks in advance.
Re: Calculate Slope of a triangle
I guess your talking about a 2D triangle in a 3D world?
Which angle do you need?
The steepness along a border line, measured to the botton line?
The steepness of the triangle itself (along the height) to the bottom?
??????
Re: Calculate Slope of a triangle
I need the angle from the triangle to the flat ground.
I assume I have to define two planes to work with which I can't find any info on for 3D planes. I got an equation from NoteMe:
Angle = inverse_cos((A * B) / (|A| * |B|))
I assume it is correct. A and B are planes and this equation will define the angle between the two planes, I just don't know how to define the planes from the points I have.
Re: Calculate Slope of a triangle
If you know the points you could use the distance formula and then the inverse of trig ratio's to find the angle measure. Or do I not understand the question?
Re: Calculate Slope of a triangle
I bet you got the question dead on.
I'm just not up to par on my math skills involving the knowledge I am trying to answer.
I just need to find the angle of the cliff...picture a cliff in real life. Driving down the road and you see a tall mountain beside you. How would you go about finding the angle from the ground to the cliff.
(Obviously a 100% steep cliff would be a completely 90 degree drop, straight up and down.)
Re: Calculate Slope of a triangle
Just to make sure that I got the question right, I want to show you a picture. Does this look like something your trying to find? I mean is it the angle with the weird looking symbol?
Also, I think you need to tell me what kind of information you already have: like the length of certain sides of the triangle, points on a graph of different vertexes of the triangle, and that sort of stuff.
Re: Calculate Slope of a triangle
If you assume that triangle you posted is a side view.
The bottom being the ground, the hypontenuse being the cliff slope.
So techinically yes theta is the angle I need.
This is all in 3D though, so this is where I am getting confused.
I will ALWAYS have the 3 points (vertices) which make up the triangle.
Code:
\
\
\
A\
-----------------
I need angle A. All coordinates making up the triangle will be in 3D. The coordinates of the ground I suppose could be found, the points will be in surrounding nodes in my quad tree.
The point of this is to aid in terrain texturing. Any triangle with an angle between 60-90 or the respected opposite will be considered a cliff and textured as such.
Edit: Sorry for the crappy triangle. This forum likes to resize posts after a post and often disregards trailing spaces. You should get the point though.
Re: Calculate Slope of a triangle
Ok..I see what you need now. It might take me a little while to figure out how to do this in 3D, but I'll get back to you as soon as I can.
Re: Calculate Slope of a triangle
Here is the distance formula for 3-dimensional space... This is to calculate the distance between two points... sqrt( (x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2 )
Once you know the length of the sides, you can use the Law of Cosines to find the angle measures..
If you need any furthere assistance, let me know.
Re: Calculate Slope of a triangle
did you manage to work this out? I'm doing something very similar and I'm loading in a collection of triangles each with xyz values and I'm trying to check them to see if any of them are over a certain steepness
I've been able to pick up alot of these triangles by using inverse tan but it's missing alot more I think the problem is that I don't always have 2 points at ground level I might have 1 on the ground 1 partway up the cliff and 1 at the top or even 2 at the top and 1 at the bottom