Example #1
0
void MarkerStructureGLObject::AddBar( int marker1, int marker2 ) {

	Slab *slab;
	Vector3 center, delta;

	AddVectors( center, modelMarker[marker1].position, modelMarker[marker2].position );
	ScaleVector( center, center, 0.5 );
	SubtractVectors( delta, modelMarker[marker1].position, modelMarker[marker2].position );
	slab = new Slab( STRUCTURE_BAR_RADIUS, VectorNorm( delta ) * 1.1, STRUCTURE_BAR_RADIUS );
	slab->SetPosition( center[X], center[Y], center[Z] + STRUCTURE_BAR_RADIUS );
	slab->SetOrientation( ToDegrees( atan2( delta[X], delta[Y] ) ), 0.0, 0.0 );
	slab->SetColor( 1.0, 1.0, 0.0, 0.35 );
	AddComponent( slab );
}
Example #2
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;

}