Post Difficult Questions Here

Users who are viewing this thread

For exercise 4, it says:

A person stands in an elevator which is moving down at constant speed of 2ms-1. The person has a mass of 70kg.
a) Add arrows to show the free-body diagram of the person
b) What are the sizes of Fn and Fg?

The elevator then slows down and stops at the next floor. The acceleration is a constant -1.0ms-2.
c) Add arrows to show the free-body diagram of the person at this deceleration stage. Your arrow lengths should be drawn relatively to those in a).
d) What is the resultant force acting on the person?
e) What are the sizes of Fn and Fg in this situation?
f) How far would the elevator travel whilst decelerating?

I tried summarizing it because I don't want to trouble you with this too much

 
Chewbacca said:
For exercise 4, it says:

A person stands in an elevator which is moving down at constant speed of 2ms-1. The person has a mass of 70kg.
a) Add arrows to show the free-body diagram of the person
The only forces that are acting on him are mg (downwards) and the normal force n, which is equal to mg (upwards).
b) What are the sizes of Fn and Fg?
mg.

The elevator then slows down and stops at the next floor. The acceleration is a constant -1.0ms-2.
c) Add arrows to show the free-body diagram of the person at this deceleration stage. Your arrow lengths should be drawn relatively to those in a).
Arrow downwards: mg.
Arrow upwards: Not sure... give me a few moments and I'll calculate this, as well as d and e still mg. The person is stationary (although of course, the elevator is moving), which means that the net forces acting of him are of zero force. I know you've summarized this, but make sure you haven't change the meaning.

d) What is the resultant force acting on the person?
Zero.
e) What are the sizes of Fn and Fg in this situation?
mg.
f) How far would the elevator travel whilst decelerating?
Well, the initial velocity is 2 m/s, and the acc. is -1 m/s^2. Distance would be 3 m.

I tried summarizing it because I don't want to trouble you with this too much
 
Doing immuno revision. Stumbled upon something I have no idea how to answer.

Can extinction coefficients of carbohydrate antigens be determined? If so, how?
I have a slight idea that carbs can have their extinction coefficients determined as well, no? But I have no idea what tests they run for carbs.
 
Small refresh on my previous query since it got buried, mostly as it's still stumping me and I need it done for tomorrow. :razz:

Kronic said:
Anyone know OpenGL and feel like telling me why I'm a spack and my skybox isn't rendering?

Code:
void Skybox()
{
	       // // Store the current matrix
        glPushMatrix();
     
        //// Reset and transform the matrix.
        glLoadIdentity();
        gluLookAt(0,0,0,   30,20,-10,   0,1,0); //Where we are, What we look at, and which way is up
     
        //// Enable/Disable features
		glPushAttrib(GL_ENABLE_BIT);
        glEnable(GL_TEXTURE_2D);
        glDisable(GL_DEPTH_TEST);
        glDisable(GL_LIGHTING);
        glDisable(GL_BLEND);
     
        // Just in case we set all vertices to white.
        glColor4f(1,1,1,1);
     
        // Render the front quad
        glBindTexture(GL_TEXTURE_2D, skybox_ft);
        glBegin(GL_QUADS);
            glTexCoord2f(0, 0); glVertex3f(  0.5f, -0.5f, -0.5f );
            glTexCoord2f(1, 0); glVertex3f( -0.5f, -0.5f, -0.5f );
            glTexCoord2f(1, 1); glVertex3f( -0.5f,  0.5f, -0.5f );
            glTexCoord2f(0, 1); glVertex3f(  0.5f,  0.5f, -0.5f );
        glEnd();
     
        // Render the left quad
        glBindTexture(GL_TEXTURE_2D, skybox_lf);
        glBegin(GL_QUADS);
            glTexCoord2f(0, 0); glVertex3f(  0.5f, -0.5f,  0.5f );
            glTexCoord2f(1, 0); glVertex3f(  0.5f, -0.5f, -0.5f );
            glTexCoord2f(1, 1); glVertex3f(  0.5f,  0.5f, -0.5f );
            glTexCoord2f(0, 1); glVertex3f(  0.5f,  0.5f,  0.5f );
        glEnd();
     
        // Render the back quad
        glBindTexture(GL_TEXTURE_2D, skybox_bk);
        glBegin(GL_QUADS);
            glTexCoord2f(0, 0); glVertex3f( -0.5f, -0.5f,  0.5f );
            glTexCoord2f(1, 0); glVertex3f(  0.5f, -0.5f,  0.5f );
            glTexCoord2f(1, 1); glVertex3f(  0.5f,  0.5f,  0.5f );
            glTexCoord2f(0, 1); glVertex3f( -0.5f,  0.5f,  0.5f );
     
        glEnd();
     
        // Render the right quad
        glBindTexture(GL_TEXTURE_2D, skybox_rt);
        glBegin(GL_QUADS);
            glTexCoord2f(0, 0); glVertex3f( -0.5f, -0.5f, -0.5f );
            glTexCoord2f(1, 0); glVertex3f( -0.5f, -0.5f,  0.5f );
            glTexCoord2f(1, 1); glVertex3f( -0.5f,  0.5f,  0.5f );
            glTexCoord2f(0, 1); glVertex3f( -0.5f,  0.5f, -0.5f );
        glEnd();
     
        // Render the top quad
        glBindTexture(GL_TEXTURE_2D, skybox_up);
        glBegin(GL_QUADS);
            glTexCoord2f(0, 1); glVertex3f( -0.5f,  0.5f, -0.5f );
            glTexCoord2f(0, 0); glVertex3f( -0.5f,  0.5f,  0.5f );
            glTexCoord2f(1, 0); glVertex3f(  0.5f,  0.5f,  0.5f );
            glTexCoord2f(1, 1); glVertex3f(  0.5f,  0.5f, -0.5f );
        glEnd();
     
        // Render the bottom quad
        glBindTexture(GL_TEXTURE_2D, skybox_dn);
        glBegin(GL_QUADS);
            glTexCoord2f(0, 0); glVertex3f( -0.5f, -0.5f, -0.5f );
            glTexCoord2f(0, 1); glVertex3f( -0.5f, -0.5f,  0.5f );
            glTexCoord2f(1, 1); glVertex3f(  0.5f, -0.5f,  0.5f );
            glTexCoord2f(1, 0); glVertex3f(  0.5f, -0.5f, -0.5f );
        glEnd();
     
        //// Restore enable bits and matrix
        glPopAttrib();
        glPopMatrix();
}

void DrawScene() 
{	

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);// Clear The Screen And The Depth Buffer
	glLoadIdentity();// load Identity Matrix
	 Skybox(); 
	
	//set camera looking down the -z axis,  6 units away from the center
	gluLookAt(30, 20, -10,     0, 0, 0,     0, 1, 0); //Where we are, What we look at, and which way is up


	glLightfv(GL_LIGHT1, GL_AMBIENT,  Light_Ambient);
	glLightfv(GL_LIGHT1, GL_DIFFUSE,  Light_Diffuse);
	glLightfv(GL_LIGHT1, GL_POSITION, Light_Position);
	glEnable(GL_LIGHT1);
	


	//glRotatef(rot, 1,1,0);
	

	pModel->draw();

	//glDisable(GL_LIGHTING);

	
	rot+=0.01;
	SwapBuffers(ghdc);// Swap the frame buffers.

}
 
You've done that an... interesting way. Why you doing glLookAt in the Skybox function? You only really need to do that once in the DrawScene. If that is you trying to move the Skybox with the camera, the best way to do that is to just translate it to the player's position every frame.

There is also a good chance that because you have no lighting it is just not visible due to being pitched black (though I'm assuming that's why you decided to colour it white incase?)

If you want I can show you the code for the part where I rendered my skybox?
 
I'd be interested to see how you do it, I'm still interested in finding out why my one isn't working when it really *should*, at least as far as I can tell - "interesting way" or not. :razz:

The glLookAt should (in theory), at least when I'm not using fixed test values, render the skybox in a way as it rotates with the camera. At least as far as my logic follow it. :lol:
 
Hmmm. You shouldn't need to rotate the skybox though. I don't think...

Anyway, lets see where my code is...

Code:
void DrawScene() 
{	
	int i=0;

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);// Clear The Screen And The Depth Buffer
	glLoadIdentity();// load Identity Matrix

	//glLookAt is done in here
	main_cam.UpdateCamera();
	
	//Lights
	glLightfv(GL_LIGHT1, GL_AMBIENT,  Sky_Ambient);
	glLightfv(GL_LIGHT1, GL_DIFFUSE,  Sky_Diffuse);
	glLightfv(GL_LIGHT1, GL_POSITION, Sky_Position);	
	
	glLightfv(GL_LIGHT2, GL_DIFFUSE,  Light_Diffuse);
	glLightfv(GL_LIGHT2, GL_POSITION, Light_Position);
	glLightfv(GL_LIGHT2, GL_SPOT_DIRECTION, Light_Position);
	////////////////////////////////////////////////////////
	
	//Enable Ambient but not Diffuse light for skybox. Light 1 is the ambient, Light 2 is the diffuse
	glEnable(GL_LIGHT1);
	glDisable(GL_LIGHT2);
	///////////////////////////////////////////////////
	
	//Draw Skybox
	glPushMatrix();		
		
		glDisable(GL_DEPTH_TEST);
		glEnable(GL_TEXTURE_2D);
		
		glTranslatef(main_cam.GetX(), main_cam.GetY(), main_cam.GetZ());
		glScalef(5,5,5);
		pSkyBox->draw();
		glEnable(GL_DEPTH_TEST);

	glPopMatrix();
	/////////////////////////////////////////////////////////////////////////
	
	//enable other light to light up other objects
	glEnable(GL_LIGHT2);
	
	glPushMatrix();
		
		//make crate in hut
		glBindTexture(GL_TEXTURE_2D, CrateTexture);
				
		glScalef(2,2,2);
		glTranslatef(0, 2, 0);
		DrawCube(1,1,1);	//use OpenGL primitives

		glDisable(GL_TEXTURE_2D);

	glPopMatrix();

	glPushMatrix();
		
		//make foundation for hut
		glBindTexture(GL_TEXTURE_2D, StoneTexture);
				
		glScalef(25,1,25);
		glTranslatef(0, 1, 0);
		Draw_CUBE();	//use vertex arrays

		glDisable(GL_TEXTURE_2D);

	glPopMatrix();
	
	//call display lists
	glCallList(grass);
	glCallList(Fort);

	SwapBuffers(ghdc);// Swap the frame buffers.

}

That's the whole draw scene function. There are a couple of little mistakes that I just noticed, mainly that I have declared an 'i' for no reason and also enabled texturing after the first matrix push, but meh. It worked, so it's mainly just semantics.  :lol:

Notice I just drew the skybox by using a loaded model, but that was mainly so I could get a perfect UV map. It failed, but still. It shouldn't be hard to convert from that to using the OpenGL primitives.

I only use the glLookAt once, and that is in the update camera function. If you don't have yourself a camera yet, then just swap the update camera function for glLookAt.  :smile:

If you want help with understanding any of it, just let me know.  :smile:

PS I didn't really need to use push and pop so often, but just wanted to show I could use hierarchical modelling and all that jazz.  :lol:
 
Hmm, odd one that. All I had to change in the end was adding the glScalef function. Then suddenly it worked.

Code:
gluLookAt(0,0,0,   cxang,cyang,czang,   0,1,0); //Where we are, What we look at, and which way is up
glScalef(3,3,3);

Q2syg.jpg

 
Kronic said:
Hmm, odd one that. All I had to change in the end was adding the glScalef function. Then suddenly it worked.

Code:
gluLookAt(0,0,0,   cxang,cyang,czang,   0,1,0); //Where we are, What we look at, and which way is up
glScalef(3,3,3);

Q2syg.jpg

Ah. If the box wasn't big enough to cover the entire screen it wouldn't work. I had problems at the start too. I guess I should have mentioned.  :lol:
 
Ended up bailin, conquered mauretania and went on happy crusades all over heretic Croatia.

But spain got sucked into HRE and I am wedged on both sides by a power hungry Emperor who is now allied to Byzantine emperor. I guess I may have to expand in africa more, maybe move into Ireland next.
 
Hey guys, me with my pascal again. I'm writing a kind of more advanced program. Thar is the code, spoiler'd for your pleasure.
Code:
program dalyba;
var x, y, a, b, c, d, e, f, dalmuo, sandauga, suma, skirtumas : real;
pr : integer;
gl : char;
begin
  repeat
  WriteLn('[1] Dalyba');
  WriteLn('[2] Daugyba');
  WriteLn('[1] Sudėtis');
  WriteLn('[4] Atimtis');
  ReadLn(pr);
  if pr =1 then
   begin
  WriteLn(' ');
  WriteLn('Dalyba');
  WriteLn('Įveskite pirmąjį skaičių'); ReadLn(x);
  WriteLn('Įveskite antrajį skaičių'); ReadLn(y);
  dalmuo := x / y;
  WriteLn('Šių skaičių dalmuo yra ' , dalmuo:5:2);
  end;
 if pr =2 then
  begin
  WriteLn(' ');
  WriteLn('Daugyba');
  WriteLn('Įveskite pirmąjį skaičių'); ReadLn(a);
  WriteLn('Įveskite antrajį skaičių'); ReadLn(b);
  sandauga := a * b;
  WriteLn('Šių skaičių sandauga yra ' , sandauga:5:2);
  end;
  if pr =3 then
  begin
  WriteLn(' ');
  WriteLn('Suma');
  WriteLn('Įveskite pirmąjį skaičių'); ReadLn(c);
  WriteLn('Įveskite antrajį skaičių'); ReadLn(d);
  suma := c + d;
  WriteLn('Šių skaičių suma yra ' , suma:5:2);
  end;
  if pr =4 then
  begin
  WriteLn(' ');
  WriteLn('Atimtis');
  WriteLn('Įveskite pirmąjį skaičių'); ReadLn(e);
  WriteLn('Įveskite antrajį skaičių'); ReadLn(f);
  skirtumas := e - f;
  WriteLn('Šių skaičių skirtumas yra ' , skirtumas:5:2);
  end;
  if pr <> 1 or 2 or 3 or 4 then
  begin
  WriteLn('Neteisingas atsakymas.');
  end;
  WriteLn('Ar norite grįžtį į meniu?(t/n)');
  ReadLn(gl);
  until gl =('n');
  end.
Just ignore the fact that the text is Lithuanian.
Now, what my problem is:
As you can see there, at the menu, the user is supposed to select a number from 1 to 4. If anything else if entered, there's a error message and a question that basically says 'Do you want to rerun the code?'.  This part works fine; for example, if I enter 5, all works fine: error message, question. The problem occurs when a correct number is entered: the main code there runs fine, and at the should be only the prompt to go back to the menu, and the error message pops up too. It shouldn't.
It feels like I'm missing something really simple here.
 
Dunno about pascal syntax but that looks fishy:
if pr <> 1 or 2 or 3 or 4 then

maybe try

if (pr <> 1) AND (pr <> 2) AND (pr <> 3) AND (pr <> 4) then

or something like that.

In your code when you enter a 1, then it checks it,
pr <> 1, WRONG
goes to the next condition(because of OR)
pr <> 2, CORRECT
and goes into the menu error part.
So the OR is wrong there. Has to be an AND.
 
Back
Top Bottom