# u_r_b_a_n

Members

10

122 Neutral

• Rank
Member
1. ## OpenGL Open GL rotation question!

I tried that and it doesn't work ... Coordinate system gets some weird rotation... I also tried reseting the window with glLoadIdentity() and it still doesn't work... Before and after drawing of any object i use glPushMatrix() and glPopMatrix()... Should i use perhaps gluLookAt() function ?
2. ## OpenGL Open GL rotation question!

I have an OpenGL window with drawn coordinate sistem and lines. Lines are rotating around center point (0,0,0) with: glRotatef(xRotAng, 0, 1, 0) glRotatef(yRotAng, 1, 0, 0) and coordinate sistem is translated for: glTranslatef(0.0f, 2.0f, -10.0f) and it's rotating with lines... How can i make coordinate sistem to rotate with the same rotation as lines, only it must rotate around it's axis?! tnx for help
3. ## solving equations problem

Hey! The first equation is right as it is... Thanks a loot for your help!! I'll go through your formulas and see if i can make anything out of them :)
4. ## solving equations problem

Quote:Original post by Lord Crc Unless I did something wrong, you end up with a system on the form of Au^2 + Buw + Cu^2 = 0 where u = sEP.X - K2 and w = sEP.Z - K7, and A, B and C are constants derived from your constants. That formula describes an ellipse, so afaik you have any number of solutions, each one lying on the ellipse described by the formula above. Then again, I might have screwed up along the way :) Hmm, it would be nice if you wrote what constants A,B and C represent, because i really don't know how u came up with this formula ... :)
5. ## Angle between two 3D points

As far as i know u can't calculate an angle between two points ... U can calculate an angle between two vectors (or lines)... I calculate an angle between one static line and a ray pointing from a model that i can drag with mouse... Here's how i do it: //calculations for angle between ray and point //edgingPoints are the edging points of a model lineHorizontal.X = (edgingPoints[4].X + 0.5f) - edgingPoints[4].X; lineHorizontal.Y = (edgingPoints[4].Y) - (edgingPoints[4].Y); lineHorizontal.Z = (edgingPoints[4].Z) - (edgingPoints[4].Z); lineRay.X = rayEnd.X - intersectionPointOnModel.X; lineRay.Y = rayEnd.Y - intersectionPointOnModel.Y; lineRay.Z = rayEnd.Z - intersectionPointOnModel.Z; double dot1Horizontal = lineHorizontal.X * lineRay.X + lineHorizontal.Z * lineRay.Z; double dot2Horizontal = lineHorizontal.X * lineHorizontal.X + lineHorizontal.Z * lineHorizontal.Z; double dot3Horizontal = lineRay.X * lineRay.X + lineRay.Z * lineRay.Z; double angleCosHorizontal = dot1Horizontal / (Math.Sqrt(dot2Horizontal) * Math.Sqrt(dot3Horizontal)); //conversion from radians to degrees: horizontalAngle = Math.Acos(angleCosHorizontal) * (180 / Math.PI)); Hope it helps with your problem...
6. ## solving equations problem

drew_benton i know what i must do ... but you didn't simplify the first equation as it could be... :) I've done some calculating and from the first equation i exposed sEP.Y (i'll write only Y) and got the following: Y = K2 + (X - K2)* Math.Sqrt( ( (K1+K3)^2 / acosVF^2*const ) - 1) where Y = sEP.Y and X = sEP.X. I'm pretty sure that's right... ...now i must do the same for third equation and then but it all together in second one, but im having problems with third equation, so i'll write it again for some mathematician out there to solve it :) Here it is: acosH = K1 * (X - K2) + K8 * (Z - K7) / Math.Sqrt(number) * Math.Sqrt( (X - K2)^2 + (Z - K7)^2 ) I must expose Z so i can calculate the sistem! All other numbers (except X) are given... Any help would be apretiated. Thanks.
7. ## solving equations problem

Sorry, im asking how to derive these equations (i need the equatins for sEP.X, sEP.Y and sEP.Z so i can calculate the coordinates)... I tried to solve them (i only got sEP.Y from the first equation) but the equations get pretty long and i'm sure i'm not calculating right ... So again, any help from mathematicians would be apretiated.
8. ## solving equations problem

Hello! I have a math problem in my program that i'm writing. I want to get new position of a point by inputing angles. I need to get x, y and z coordinates of a point sEP from three equations... I'll write them: .............K1 * (sEP.X - K2) + K3 * (sEP.X - K2) aCosVF = ----------------------------------------------------------------- , .............Math.Sqrt(number) * Math.Sqrt( (sEP.X - K2)^2 + (sEP.Y - K4)^2 ) .............K5 * (sEP.Y - K4) + K6 * (sEP.Z - K7) aCosVS = ----------------------------------------------------------------- , .............Math.Sqrt(number2) * Math.Sqrt( (sEP.Y - K4)^2 + (sEP.Z - K7)^2 ) .............K1 * (sEP.X - K2) + K8 * (sEP.Z - K7) aCosH = ----------------------------------------------------------------- , .............Math.Sqrt(number3) * Math.Sqrt( (sEP.X - K2)^2 + (sEP.Z - K7)^2 ) where K1,...,K7 and aCosVF, aCosVS and aCosH are given numbers. I need to get the coordinates from sEP, that means sEP.X, sEP.Y and sEP.Z. I'm not much of a mathematician so if anyone has the knowledge and time i would be most grateful!! PS: please ignore the dots in front of K1, K5 and Math.Sqrt because they are for aligning ... :) Thanks!!
9. ## OpenGL problem with openGL viewport, modelview matrix and projection matrix

I calculate colission with right mouse click and before that (with every click) i calculate viewport, modelview matrix and projection matrix... I use glPushMatrix/glPopMatrix only when drawing the scene because i dont only draw a model ... It's not a problem if only one openGL control (for solid model) is visible but as soon as i make second openGL control visible (wire model) viewport, modelview matrix and projection matrix are changed... I dunno how to solve this...
10. ## OpenGL problem with openGL viewport, modelview matrix and projection matrix

Hello. Im writing a program in Visual Studio .NET 2008 C#, where i create wire and solid model, and i have openGL control for both wire and solid view of model. I create my solid model from triangles (polygons). Control draw3D is for wire model and draw3Dpoly is for solid model. I also calculate collision point between ray and polygon and it works fine if only draw3Dpoly control is visible. But if i make draw3D control visible i don't get any collision detection because viewport, modelview matrix and projection matrix changes... I want to have both controls visible at all times. How can i prevent this matrix's to change or how to get viewport, modelview matrix and projection matrix of only one openGL control ? thanks for help