Beispiel #1
0
void sbrFlightModel::SetYaw(sREAL yaw)
{
sAttitude attitude = att;

	attitude.yaw = yaw;
	SetAttitude(attitude);
}
Beispiel #2
0
void sbrFlightModel::SetPitch(sREAL pitch)
{
sAttitude attitude = att;

	attitude.pitch = pitch;
	SetAttitude(attitude);		
}
void OpenGLObject::SetAttitude( double angle, const Vector3 axis ) {

  Matrix3x3 m;

  SetRotationMatrix( m, ToRadians( angle ), axis );
  SetAttitude( m );

}
void Viewpoint::SetAttitude( double angle, Vector3 axis ) {

  Matrix3x3 m;

  SetRotationMatrix( m, ToRadians( angle ), axis );
  SetAttitude( m );

}
Beispiel #5
0
// Wrapper for the above function that assumes that the rotation rate is vrot.
// Calling the function directly allows more control but will probably be used less
bool SetAttitude(double TargetAttitude, double CurrentAttitude, AXIS Axis, DEADBAND DeadbandLow)
{
	VESSEL *Vessel;			// Spacecraft interface
	VESSELSTATUS Status;	// Spacecraft status

	Vessel = oapiGetFocusInterface();
	Vessel->GetStatus(Status);

	return SetAttitude(TargetAttitude, CurrentAttitude, Status.vrot.data[Axis], Axis, DeadbandLow);
}
void OpenGLObject::SetAttitude( double roll, double pitch, double yaw ) {

  double m[3][3];

  roll = ToRadians( roll );
  pitch = ToRadians( pitch );
  yaw = ToRadians( yaw );

  m[X][X] = cos(yaw) * cos(roll);
  m[Y][X] = cos(yaw) * sin(roll);
  m[Z][X] = -sin(yaw);

  m[X][Y] = sin(pitch) * sin(yaw) * cos(roll) - cos(pitch) * sin(roll);
  m[Y][Y] = sin(pitch) * sin(yaw) * sin(roll) + cos(pitch) * cos(roll);
  m[Z][Y] = cos(yaw) * sin(pitch);

  m[X][Z] = cos(pitch) * sin(yaw) * cos(roll) + sin(pitch) * sin(roll);
  m[Y][Z] = cos(pitch) * sin(yaw) * sin(roll) - sin(pitch) * cos(roll);
  m[Z][Z] = cos(yaw) * cos(pitch);

  SetAttitude( m );

}
void Viewpoint::SetAttitude( double roll, double pitch, double yaw ) {

  Matrix3x3 m;

  roll = ToRadians( roll );
  pitch = ToRadians( pitch );
  yaw = ToRadians( yaw );

  m[X][X] = cos(yaw) * cos(roll);
  m[Y][X] = cos(yaw) * sin(roll);
  m[Z][X] = -sin(yaw);

  m[X][Y] = sin(pitch) * sin(yaw) * cos(roll) - cos(pitch) * sin(roll);
  m[Y][Y] = sin(pitch) * sin(yaw) * sin(roll) + cos(pitch) * cos(roll);
  m[Z][Y] = cos(yaw) * sin(pitch);

  m[X][Z] = cos(pitch) * sin(yaw) * cos(roll) + sin(pitch) * sin(roll);
  m[Y][Z] = cos(pitch) * sin(yaw) * sin(roll) - sin(pitch) * cos(roll);
  m[Z][Z] = cos(yaw) * cos(pitch);

  SetAttitude( m );

}
Beispiel #8
0
Dial::Dial ( void ) {

  thickness = 10.0;
  radius = 100.0;
  tilt = 30.0;
  label_width = 50.0;

  Slab *slab;
  Disk *disk;
  Cylinder *cylinder;
  Patch *rectangle;
	char path[1024];

	sprintf( path, "%s%s", AfdTexturePath, "bmp\\ten.bmp" );
  ten_texture = new Texture( path, label_width / 2.0, label_width / 2.0 );
	sprintf( path, "%s%s", AfdTexturePath, "bmp\\five.bmp" );
  five_texture = new Texture( path, label_width / 2.0, label_width / 2.0 );
	sprintf( path, "%s%s", AfdTexturePath, "bmp\\zero.bmp" );
  zero_texture = new Texture( path, label_width / 2.0, label_width / 2.0 );
	sprintf( path, "%s%s", AfdTexturePath, "bmp\\meters.bmp" );
  meters_texture = new Texture( path, label_width * 2.0, label_width / 2.0 );
  
  needle = new Slab( thickness / 4.0, 0.90 * radius, thickness / 2.0 );
  needle->SetOffset( 0.0, radius / 2.0, thickness / 2.0 );
  needle->SetColor( ORANGE );
  AddComponent( needle );

  rectangle = new Patch( label_width / 2.0 , label_width / 2.0 );
  rectangle->SetPosition( radius + label_width / 2.0, 0.0, 0.0 );
  rectangle->SetTexture( ten_texture );
  AddComponent( rectangle );

  rectangle = new Patch( label_width / 2.0 , label_width / 2.0 );
  rectangle->SetPosition( 0.0, radius + label_width / 2.0, 0.0 );
  rectangle->SetTexture( five_texture );
  AddComponent( rectangle );

  rectangle = new Patch( label_width / 2.0 , label_width / 2.0 );
  rectangle->SetPosition( - ( radius + label_width / 2.0 ), 0.0, 0.0 );
  rectangle->SetTexture( zero_texture );
  AddComponent( rectangle );

  rectangle = new Patch( 2 * label_width , label_width / 2.0 );
  rectangle->SetPosition( 0.0, - radius - label_width / 2.0, 0.0 );
  rectangle->SetTexture( meters_texture );
//  AddComponent( rectangle );

  slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 );
  slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 );
  slab->SetOrientation( -18.0, k_vector );
  slab->SetColor( BLACK );
  AddComponent( slab );

  slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 );
  slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 );
  slab->SetOrientation( -36.0, k_vector );
  slab->SetColor( BLACK );
  AddComponent( slab );

  slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 );
  slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 );
  slab->SetOrientation( -54.0, k_vector );
  slab->SetColor( BLACK );
  AddComponent( slab );

  slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 );
  slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 );
  slab->SetOrientation( -72.0, k_vector );
  slab->SetColor( BLACK );
  AddComponent( slab );

  slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 );
  slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 );
  slab->SetOrientation( -90.0, k_vector );
  slab->SetColor( BLACK );
  AddComponent( slab );

  slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 );
  slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 );
  slab->SetColor( BLACK );
  AddComponent( slab );

  slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 );
  slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 );
  slab->SetOrientation( 18.0, k_vector );
  slab->SetColor( BLACK );
  AddComponent( slab );

  slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 );
  slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 );
  slab->SetOrientation( 36.0, k_vector );
  slab->SetColor( BLACK );
  AddComponent( slab );

  slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 );
  slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 );
  slab->SetOrientation( 54.0, k_vector );
  slab->SetColor( BLACK );
  AddComponent( slab );

  slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 );
  slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 );
  slab->SetOrientation( 72.0, k_vector );
  slab->SetColor( BLACK );
  AddComponent( slab );

  slab = new Slab( thickness / 6.0, radius / 5.0, thickness / 4.0 );
  slab->SetOffset( 0.0, radius / 2.0 + radius * 4.0 / 10.0, thickness / 2.0 );
  slab->SetOrientation( 90.0, k_vector );
  slab->SetColor( BLACK );
  AddComponent( slab );

  disk = new Disk( radius );
  AddComponent( disk );
  cylinder = new Cylinder( radius, radius, thickness );
  AddComponent( cylinder );
  
  SetColor( CYAN );
  SetAttitude( tilt, i_vector );

  minimum = 0.0;
  maximum = 10000;

}