当前位置: 首页>>代码示例>>C++>>正文


C++ Cube类代码示例

本文整理汇总了C++中Cube的典型用法代码示例。如果您正苦于以下问题:C++ Cube类的具体用法?C++ Cube怎么用?C++ Cube使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Cube类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

void Player::update(sf::Time frametime, Input input) {
  //First update velocity x
  
  _acc += frametime;
  while(_acc >= sf::milliseconds(GameConstant::SIMULATION_TIME_PER_UPDATE)) {
    _acc -= sf::milliseconds(GameConstant::SIMULATION_TIME_PER_UPDATE);
    float seconds = GameConstant::SIMULATION_TIME_PER_UPDATE / 1000.0;
    //Update velocity X
    if (input.Left) 
      _velocity.x = std::max(_velocity.x - 2 * _acceleration.x * seconds, -_max_walk_speed);
    else if(input.Right) {
      _velocity.x =  std::min(_velocity.x + 2* _acceleration.x * seconds, _max_walk_speed);
    }
  
    //Update velocity Y
    if(_noclip && input.Up)
      _velocity.y = std::max(_velocity.y - 2 * _acceleration.y * seconds, -_max_fall_speed);
    else if(_noclip && input.Down) 
      _velocity.y = std::min(_velocity.y + 2 * _acceleration.y * seconds, _max_fall_speed);
    else if(input.Up && !_is_flying) 
      _velocity.y -= _jump_force;
  
    //Now we can update position

    //First apply some friction
    if(_velocity.x > 0) 
      _velocity.x = std::max(0.F, _velocity.x - (_acceleration.x) * seconds);
    else if(_velocity.x < 0)
      _velocity.x = std::min(0.F, _velocity.x + (_acceleration.x) * seconds);
  
    if(_noclip && _velocity.y > 0) 
      _velocity.y = std::max(0.F, _velocity.y - (_acceleration.y) * seconds);
    else if(_noclip && _velocity.y < 0)
      _velocity.y = std::min(0.F, _velocity.y + (_acceleration.y) * seconds);
    else
      _velocity.y = std::min(_velocity.y + (_acceleration.y) * seconds, _max_fall_speed);
    
    //Update position and check for collision
    if(_velocity.x != 0){
      _position.x += _velocity.x * seconds;
    
      Cube *c = _world->getCollidingCube(getBbox());
      if( c != NULL){
	if(_velocity.x < 0)
	  _position.x = c->getBbox().left + c->getBbox().width;
	else
	  _position.x = c->getBbox().left - getBbox().width;
	_velocity.x = 0;
      }
    }
  
    if(_velocity.y != 0){
      _position.y += _velocity.y * seconds;
      _is_flying = true;
      Cube *c = _world->getCollidingCube(getBbox());
      if( c != NULL){
	if(_velocity.y < 0)
	  _position.y = c->getBbox().top + c->getBbox().height;
	else{
	  _position.y = c->getBbox().top - getBbox().height;
	  _is_flying = false;
	}
	_velocity.y = 0;
      }
    }
  }

}
开发者ID:CyrilPaulus,项目名称:cppThing,代码行数:68,代码来源:player.cpp

示例2: Init

 /**
  * Constructs a UniversalGroundMap object from a cube
  * 
  * @param cube The Cube to create the UniversalGroundMap from
  */
 UniversalGroundMap::UniversalGroundMap(Cube &cube) {
   Init(*cube.Label());
 }
开发者ID:assutech,项目名称:isis3,代码行数:8,代码来源:UniversalGroundMap.cpp

示例3: arma_extra_debug_sigprint

inline
void
op_reshape::apply(Cube<typename T1::elem_type>& out, const OpCube<T1,op_reshape>& in)
{
    arma_extra_debug_sigprint();

    typedef typename T1::elem_type eT;

    const unwrap_cube<T1> A_tmp(in.m);
    const Cube<eT>& A   = A_tmp.M;

    const uword in_n_rows   = in.aux_uword_a;
    const uword in_n_cols   = in.aux_uword_b;
    const uword in_n_slices = in.aux_uword_c;
    const uword in_dim      = in.aux_uword_d;

    const uword in_n_elem = in_n_rows * in_n_cols * in_n_slices;

    if(A.n_elem == in_n_elem)
    {
        if(in_dim == 0)
        {
            if(&out != &A)
            {
                out.set_size(in_n_rows, in_n_cols, in_n_slices);
                arrayops::copy( out.memptr(), A.memptr(), out.n_elem );
            }
            else  // &out == &A, i.e. inplace resize
            {
                const bool same_size = ( (out.n_rows == in_n_rows) && (out.n_cols == in_n_cols) && (out.n_slices == in_n_slices) );

                if(same_size == false)
                {
                    arma_debug_check
                    (
                        (out.mem_state == 3),
                        "reshape(): size can't be changed as template based size specification is in use"
                    );

                    out.delete_mat();

                    access::rw(out.n_rows)       = in_n_rows;
                    access::rw(out.n_cols)       = in_n_cols;
                    access::rw(out.n_elem_slice) = in_n_rows * in_n_cols;
                    access::rw(out.n_slices)     = in_n_slices;

                    out.create_mat();
                }
            }
        }
        else
        {
            unwrap_cube_check< Cube<eT> > B_tmp(A, out);
            const Cube<eT>& B           = B_tmp.M;

            out.set_size(in_n_rows, in_n_cols, in_n_slices);

            eT* out_mem = out.memptr();
            uword i = 0;

            const uword B_n_rows   = B.n_rows;
            const uword B_n_cols   = B.n_cols;
            const uword B_n_slices = B.n_slices;

            for(uword slice=0; slice<B_n_slices; ++slice)
                for(uword row=0; row<B_n_rows; ++row)
                    for(uword col=0; col<B_n_cols; ++col)
                    {
                        out_mem[i] = B.at(row,col,slice);
                        ++i;
                    }
        }
    }
    else
    {
        const unwrap_cube_check< Cube<eT> > B_tmp(A, out);
        const Cube<eT>& B                 = B_tmp.M;

        const uword n_elem_to_copy = (std::min)(B.n_elem, in_n_elem);

        out.set_size(in_n_rows, in_n_cols, in_n_slices);

        eT* out_mem = out.memptr();

        if(in_dim == 0)
        {
            arrayops::copy( out_mem, B.memptr(), n_elem_to_copy );
        }
        else
        {
            uword row   = 0;
            uword col   = 0;
            uword slice = 0;

            const uword B_n_rows = B.n_rows;
            const uword B_n_cols = B.n_cols;

            for(uword i=0; i<n_elem_to_copy; ++i)
            {
                out_mem[i] = B.at(row,col,slice);
//.........这里部分代码省略.........
开发者ID:kallaspriit,项目名称:Soccerbot,代码行数:101,代码来源:op_reshape_meat.hpp

示例4: IsisMain

void IsisMain ()
{
    stretch.ClearPairs();

    for (int i=0; i<6; i++) {
        gapCount[i] = 0;
        suspectGapCount[i] = 0;
        invalidCount[i] = 0;
        lisCount[i] = 0;
        hisCount[i] = 0;
        validCount[i] = 0;
    }

    void TranslateHiriseEdrLabels (Filename &labelFile, Cube *);
    void SaveHiriseCalibrationData (ProcessImportPds &process, Cube *,
                                    Pvl &pdsLabel);
    void SaveHiriseAncillaryData (ProcessImportPds &process, Cube *);
    void FixDns8 (Buffer &buf);
    void FixDns16 (Buffer &buf);

    ProcessImportPds p;
    Pvl pdsLabel;
    UserInterface &ui = Application::GetUserInterface();

    // Get the input filename and make sure it is a HiRISE EDR
    Filename inFile = ui.GetFilename("FROM");
    iString id;
    bool projected;
    try {
        Pvl lab(inFile.Expanded());
        id = (string) lab.FindKeyword ("DATA_SET_ID");
        projected = lab.HasObject("IMAGE_MAP_PROJECTION");
    }
    catch (iException &e) {
        string msg = "Unable to read [DATA_SET_ID] from input file [" +
                     inFile.Expanded() + "]";
        throw iException::Message(iException::Io,msg, _FILEINFO_);
    }

    //Checks if in file is rdr
    if( projected ) {
        string msg = "[" + inFile.Name() + "] appears to be an rdr file.";
        msg += " Use pds2isis.";
        throw iException::Message(iException::User,msg, _FILEINFO_);
    }

    id.ConvertWhiteSpace();
    id.Compress();
    id.Trim(" ");
    if (id != "MRO-M-HIRISE-2-EDR-V1.0") {
        string msg = "Input file [" + inFile.Expanded() + "] does not appear to be " +
                     "in HiRISE EDR format. DATA_SET_ID is [" + id + "]";
        throw iException::Message(iException::Io,msg, _FILEINFO_);
    }

    p.SetPdsFile (inFile.Expanded(), "", pdsLabel);

    // Make sure the data we need for the BLOBs is saved by the Process
    p.SaveFileHeader();
    p.SaveDataPrefix();
    p.SaveDataSuffix();

    // Let the Process create the output file but override any commandline
    // output bit type and min/max. It has to be 16bit for the rest of hi2isis
    // to run.
    // Setting the min/max to the 16 bit min/max keeps all the dns (including
    // the 8 bit special pixels from changing their value when they are mapped
    // to the 16 bit output.
    CubeAttributeOutput &outAtt = ui.GetOutputAttribute("TO");
    outAtt.PixelType (Isis::SignedWord);
    outAtt.Minimum((double)VALID_MIN2);
    outAtt.Maximum((double)VALID_MAX2);
    Cube *ocube = p.SetOutputCube(ui.GetFilename("TO"), outAtt);
    p.StartProcess ();
    TranslateHiriseEdrLabels (inFile, ocube);

    // Pull out the lookup table so we can apply it in the second pass
    // and remove it from the labels.
    // Add the UNLUTTED keyword to the instrument group so we know
    // if the lut has been used to convert back to 14 bit data
    PvlGroup &instgrp = ocube->GetGroup("Instrument");
    PvlKeyword lutKey = instgrp["LookupTable"];
    PvlSequence lutSeq;
    lutSeq = lutKey;

    // Set up the Stretch object with the info from the lookup table
    // If the first entry is (0,0) then no lut was applied.
    if ((lutKey.IsNull()) ||
            (lutSeq.Size()==1 && lutSeq[0][0]=="0" && lutSeq[0][1]=="0")) {
        stretch.AddPair(0.0, 0.0);
        stretch.AddPair(65536.0, 65536.0);
        instgrp.AddKeyword(PvlKeyword("Unlutted","TRUE"));
        instgrp.DeleteKeyword ("LookupTable");
    }
    // The user wants it unlutted
    else if (ui.GetBoolean("UNLUT")) {
        for (int i=0; i<lutSeq.Size(); i++) {
            stretch.AddPair(i, (((double)lutSeq[i][0] + (double)lutSeq[i][1]) / 2.0));
        }
        instgrp.AddKeyword(PvlKeyword("Unlutted","TRUE"));
//.........这里部分代码省略.........
开发者ID:novas0x2a,项目名称:isis3,代码行数:101,代码来源:hi2isis.cpp

示例5: IsisMain

void IsisMain() {

  //get the number of samples to skip from the left and right ends
  // of the prefix and suffix data
  UserInterface &ui = Application::GetUserInterface();

  int imageLeft      = 0;
  int imageRight     = 0;
  int rampLeft       = 0;
  int rampRight      = 0;
  int calLeftBuffer  = 0;
  int calRightBuffer = 0;
  int calLeftDark    = 0;
  int calRightDark   = 0;
  int leftBuffer     = 0;
  int rightBuffer    = 0;
  int leftDark       = 0;
  int rightDark      = 0;

  if(ui.GetBoolean("USEOFFSETS")) {
    imageLeft      = ui.GetInteger("LEFTIMAGE");
    imageRight     = ui.GetInteger("RIGHTIMAGE");
    rampLeft       = ui.GetInteger("LEFTIMAGE");
    rampRight      = ui.GetInteger("RIGHTIMAGE");
    calLeftBuffer  = ui.GetInteger("LEFTCALBUFFER");
    calRightBuffer = ui.GetInteger("LEFTCALBUFFER");
    calLeftDark    = ui.GetInteger("LEFTCALDARK");
    calRightDark   = ui.GetInteger("RIGHTCALDARK");
    leftBuffer     = ui.GetInteger("LEFTBUFFER");
    rightBuffer    = ui.GetInteger("RIGHTBUFFER");
    leftDark       = ui.GetInteger("LEFTDARK");
    rightDark      = ui.GetInteger("RIGHTDARK");
  }


  Isis::FileName fromFile = ui.GetFileName("FROM");
  Isis::Cube inputCube;
  inputCube.open(fromFile.expanded());

  //Check to make sure we got the cube properly
  if(!inputCube.isOpen()) {
    QString msg = "Could not open FROM cube " + fromFile.expanded();
    throw IException(IException::User, msg, _FILEINFO_);
  }

  Process p;
  Cube *icube = p.SetInputCube("FROM");

  // Get statistics from the cube prefix and suffix data
  Table hifix("HiRISE Ancillary");
  icube->read(hifix);
  Statistics darkStats, bufStats, rampDarkStats;
  int tdi = icube->group("Instrument")["Tdi"];
  int binning_mode = icube->group("Instrument")["Summing"];

  //This gets us the statistics for the dark and buffer pixels
  // alongside of the image itself
  for(int rec = 2; rec < hifix.Records(); rec++) {
    vector<int> dark = hifix[rec]["DarkPixels"];
    vector<int> buf = hifix[rec]["BufferPixels"];
    if(buf.size() <= (unsigned int)(leftBuffer + rightBuffer)) {
      ThrowException(buf.size(), leftBuffer, rightBuffer, "image buffer");
    }
    if(dark.size() <= (unsigned int)(leftDark + rightDark)) {
      ThrowException(dark.size(), leftDark, rightDark, "image dark reference");
    }

    for(int i = leftDark; i < (int)dark.size() - rightDark; i++) {
      double d;
      if(dark[i] == NULL2) d = NULL8;
      else if(dark[i] == LOW_REPR_SAT2) d = LOW_REPR_SAT8;
      else if(dark[i] == LOW_INSTR_SAT2) d = LOW_INSTR_SAT8;
      else if(dark[i] == HIGH_INSTR_SAT2) d = HIGH_INSTR_SAT8;
      else if(dark[i] == HIGH_REPR_SAT2) d = HIGH_REPR_SAT8;
      else d = dark[i];
      darkStats.AddData(&d, 1);
    }


    for(int i = leftBuffer; i < (int)buf.size() - rightBuffer; i++) {
      double d;
      if(buf[i] == NULL2) d = NULL8;
      else if(buf[i] == LOW_REPR_SAT2) d = LOW_REPR_SAT8;
      else if(buf[i] == LOW_INSTR_SAT2) d = LOW_INSTR_SAT8;
      else if(buf[i] == HIGH_INSTR_SAT2) d = HIGH_INSTR_SAT8;
      else if(buf[i] == HIGH_REPR_SAT2) d = HIGH_REPR_SAT8;
      else d = buf[i];
      bufStats.AddData(&d, 1);
    }
  }

  // Get statistics from the calibration image

  //Calculate boundaries of the reverse readout lines,
  // Masked lines, and ramp lines.

  //There are always 20 reverse readout lines
  int reverseReadoutLines = 20;

  //Number of mask pixels depends on Binning mode
//.........这里部分代码省略.........
开发者ID:corburn,项目名称:ISIS,代码行数:101,代码来源:histat.cpp

示例6: IsisMain

// Main moccal routine
void IsisMain() {
  // We will be processing by line
  ProcessByLine p;

  // Setup the input and make sure it is a ctx file
  UserInterface &ui = Application::GetUserInterface();

  Isis::Pvl lab(ui.GetFileName("FROM"));
  Isis::PvlGroup &inst =
    lab.findGroup("Instrument", Pvl::Traverse);

  QString instId = inst["InstrumentId"];
  if(instId != "CTX") {
    QString msg = "This is not a CTX image.  Ctxcal requires a CTX image.";
    throw IException(IException::User, msg, _FILEINFO_);
  }

  Cube *icube = p.SetInputCube("FROM", OneBand);

  Cube flatFile;
  if(ui.WasEntered("FLATFILE")) {
    flatFile.open(ui.GetFileName("FLATFILE"));
  }
  else {
    FileName flat = FileName("$mro/calibration/ctxFlat_????.cub").highestVersion();
    flatFile.open(flat.expanded());
  }
  flat = new Brick(5000, 1, 1, flatFile.pixelType());
  flat->SetBasePosition(1, 1, 1);
  flatFile.read(*flat);

  // If it is already calibrated then complain
  if(icube->hasGroup("Radiometry")) {
    QString msg = "The CTX image [" + icube->fileName() + "] has already "
                 "been radiometrically calibrated";
    throw IException(IException::User, msg, _FILEINFO_);
  }

  // Get label parameters we will need for calibration equation
  iTime startTime((QString) inst["StartTime"]);
  double etStart = startTime.Et();

  //  Read exposure and convert to milliseconds
  exposure = inst["LineExposureDuration"];
  //exposure *= 1000.;

  sum = inst["SpatialSumming"];
  //  If firstSamp > 0, adjust by 38 to account for prefix pixels.
  firstSamp = inst["SampleFirstPixel"];
  if(firstSamp > 0) firstSamp -= 38;

  //  Read dark current info, if no dc exit?
  Table dcTable("Ctx Prefix Dark Pixels");
  icube->read(dcTable);
  //  TODO::  make sure dc records match cube nlines.

  //  If summing mode = 1 , average odd & even dc pixels separately for
  //  a & b channels.
  //  If summing mode != 1, average all dc pixels and use for both


  for(int rec = 0; rec < dcTable.Records(); rec++) {
    vector<int> darks = dcTable[rec]["DarkPixels"];

    bool aChannel = true;
    double dcASum = 0.;
    double dcBSum = 0.;
    int dcACount = 0;
    int dcBCount = 0;

    double dcSum = 0;
    int dcCount = 0;

    for(int i = 0; i < (int)darks.size(); i++) {

      if(sum == 1) {
        if(aChannel == true) {
          dcASum += (double)darks.at(i);
          dcACount++;
        }
        else {
          dcBSum += (double)darks.at(i);
          dcBCount++;
        }
        aChannel = !aChannel;
      }
      else if(sum > 1) {
        dcSum += (double)darks.at(i);
        dcCount ++;
      }
    }
    if(sum == 1) {
      dcA.push_back(dcASum / (double)dcACount);
      dcB.push_back(dcBSum / (double)dcBCount);
    }
    else {
      dc.push_back(dcSum / (double)dcCount);
    }
  }
//.........这里部分代码省略.........
开发者ID:corburn,项目名称:ISIS,代码行数:101,代码来源:ctxcal.cpp

示例7: IsisMain

void IsisMain() {
  // We will be processing by line
  ProcessByTile p;
  p.SetTileSize(128, 128);

  // Setup the input and output cubes
  Cube* info = p.SetInputCube("FROM");
  PvlKeyword &status = info ->group("RESEAUS")["STATUS"];
  UserInterface &ui = Application::GetUserInterface();
  QString in = ui.GetFileName("FROM");

  QString spacecraft = (info->group("Instrument")["SpacecraftName"]);
  QString instrument = (info->group("Instrument")["InstrumentId"]);
  Apollo apollo(spacecraft, instrument);
  if (spacecraft.mid(0,6) != "APOLLO") {
    QString msg = "This application is for use with Apollo spacecrafts only. ";
    throw IException(IException::Unknown, msg, _FILEINFO_);
  }

  // Check reseau status and make sure it is not nominal or removed
  if ((QString)status == "Nominal") {
    QString msg = "Input file [" + in +
          "] appears to have nominal reseau status. You must run findrx first.";
    throw IException(IException::User,msg, _FILEINFO_);
  }
  if ((QString)status == "Removed") {
    QString msg = "Input file [" + in +
          "] appears to already have reseaus removed.";
    throw IException(IException::User,msg, _FILEINFO_);
  }

  status = "Removed";

  p.SetOutputCube ("TO");

  // Start the processing
  p.StartProcess(cpy);
  p.EndProcess();

  dim = apollo.ReseauDimension();

  // Get other user entered options
  QString out= ui.GetFileName("TO");
  resvalid = ui.GetBoolean("RESVALID");
  action = ui.GetString("ACTION");

  // Open the output cube
  Cube cube;
  cube.open(out, "rw");

  PvlGroup &res = cube.label()->findGroup("RESEAUS",Pvl::Traverse);

  // Get reseau line, sample, type, and valid Keywords
  PvlKeyword lines = res.findKeyword("LINE");
  PvlKeyword samps = res.findKeyword("SAMPLE");
  PvlKeyword type = res.findKeyword("TYPE");
  PvlKeyword valid = res.findKeyword("VALID");
  int numres = lines.size();

  Brick brick(dim,dim,1,cube.pixelType());
  int width = ui.GetInteger("WIDTH");
  for (int res=0; res<numres; res++) {
    if ((resvalid == 0 || toInt(valid[res]) == 1)) {
      int baseSamp = (int)(toDouble(samps[res])+0.5) - (dim/2);
      int baseLine = (int)(toDouble(lines[res])+0.5) - (dim/2);
      brick.SetBasePosition(baseSamp,baseLine,1);
      cube.read(brick);
      if (action == "NULL") {
        // set the three pixels surrounding the reseau to null
        for (int i=0; i<dim; i++) {
          for (int j=(width-1)/-2; j<=width/2; j++) {
            // vertical lines
            brick[dim*i+dim/2+j] = Isis::Null;
            // horizontal lines
            brick[dim*(dim/2+j)+i] = Isis::Null;
          }
        }
      }
      else if (action == "PATCH") {
        for (int i = 0; i < dim; i++) {
          for (int j=(width-1)/-2; j<=width/2; j++) {
            // vertical lines
            brick[dim*i+dim/2+j] = (brick[dim*i+dim/2-width+j] + brick[dim*i+dim/2+width+j])/2.0;
            // horizontal lines
            brick[dim*(dim/2+j)+i] = (brick[dim*(dim/2-width+j)+i]+brick[dim*(dim/2+width+j)+i])/2.0;
          }
        }
      }
    }
    cube.write(brick);
  }
  cube.close();
}
开发者ID:corburn,项目名称:ISIS,代码行数:93,代码来源:apolloremrx.cpp

示例8: updateHaptics


//.........这里部分代码省略.........

        // Update logic
        if (!calibrationFinished) {
            label->m_string = "Calibrating, please move the haptic devices around in order to determine their limitations in movement.";
            label2->m_string = "Press 'c' to finish calibration.";

            if (sun->getPos().x < min.x)
                min.x = sun->getPos().x;
            if (sun->getPos().y < min.y)
                min.y = sun->getPos().y;
            if (sun->getPos().z < min.z)
                min.z = sun->getPos().z;

            if (sun->getPos().x > max.x)
                max.x = sun->getPos().x;
            if (sun->getPos().y > max.y)
                max.y = sun->getPos().y;
            if (sun->getPos().z > max.z)
                max.z = sun->getPos().z;
        } else if (logic->isReady()) {
            if (logic->gameIsOver() && !scoreDisplayed) {
                std::stringstream strs;
                strs << logic->playTime();
                std::string playString = strs.str();

                // define its position, color and string message
                label->m_string = "Congratulation! Your Time: " + playString;
                label2->m_string = "Press 'r' to restart!";

                for (i = 0; i < numHapticDevices; i++) {
                    cVector3d zero(0.0, 0.0, 0.0);
                    hapticDevices[i]->setForce(zero);
                }

                scoreDisplayed = true;
            } else if (!scoreDisplayed) {
                label->m_string = "";
                label2->m_string = "";

                logic->update(deltaTime);

            }

            for (i = 0; i < numHapticDevices; i++) {
                // compute a reaction force
                cVector3d newForce (0,0,0);

                cVector3d devicePosition;
                hapticDevices[i]->getPosition(devicePosition);
                devicePosition = deviceToWorld(devicePosition, i);

                double k = 0.4;
                if (test == 1) k = 0.3;
                double dist = (devicePosition - sun->getPos()).length();
                //dist=dist-0.1;

                newForce = k*(devicePosition - sun->getPos())/(dist*dist*dist);
                //double intensity = (newForce.length())*1.0;
                //newForce.normalize();
                //newForce *= intensity;

    //            newForce = k*(devicePosition - sun->getPos())/(dist*dist*dist);

                if (i == 0) {  // Device on positive X (RIGHT)
                    newForce.x *= -1.0;
                    newForce.y *= -1.0;
                }

                // send computed force to haptic device
    //            bool status = true;
    //            if (hapticDevices[i]->getUserSwitch(0))
    //                printf("button pressed\n");

                // Check if the sphere is in the target area. If so, vibrate
                cVector3d vibrationForce(0.0, 0.0, 0.0);
                if (logic->sphereInTarget() && !logic->gameIsOver()) {
                    Cube* target = logic->getTarget();
                    double dist = target->getPos().distance(sun->getPos());
                    double factor = 1.0 - dist/(target->size/2.0);
                    timeV += deltaTime * (0.5 + factor/2.0);

                    double f = 2*cSinRad(40*timeV);
                    vibrationForce = cVector3d(f, f, f);
                }

                newForce += vibrationForce;
                if (test <= 2 || i == 0)
                    hapticDevices[i]->setForce(newForce);
                else {
                    cVector3d zero;
                    zero.zero();
                    hapticDevices[i]->setForce(zero);
                }
          }
        }
    }
    
    // exit haptics thread
    simulationFinished = true;
}
开发者ID:Fonserbc,项目名称:haptics-bg,代码行数:101,代码来源:bg.cpp

示例9: IsisMain

void IsisMain(){

  UserInterface &ui = Application::GetUserInterface();

  ProcessByLine proc;
  Cube *cube = proc.SetInputCube("FROM");
  BigInt npixels(cube->Lines() * cube->Samples());
  
//  Initialize the cleaner routine
  try {
    delete iclean;
    iclean = new HiImageClean(*cube);
  } 
  catch (iException &ie) {
    std::string message = "Error attempting to initialize HiRISE cleaner object";
    throw (iException::Message(iException::Programmer,message,_FILEINFO_));
  }
  catch (...) {
    std::string message = "Unknown error occured attempting to initialize "
                          "HiRISE cleaner object";
    throw (iException::Message(iException::Programmer,message,_FILEINFO_));
  }

//  For IR10, channel 1 lets restrict the last 3100 lines of dark current
  PvlGroup &instrument = cube->GetGroup("Instrument");
  std::string ccd = (std::string) instrument["CcdId"];
  int channel = instrument["ChannelNumber"];
  if ((ccd == "IR10") && (channel  == 1)) {
    int bin = instrument["Summing"];
    int lastLine = cube->Lines() - ((3100/bin) + iclean->getFilterWidth()/2);
    if (lastLine > 1) { iclean->setLastGoodLine(lastLine); }
  }

#if defined(DEBUG)
  std::cout << "Lines: " << cube->Lines() << "   GoodLines: " 
            << iclean->getLastGoodLine() << std::endl;    
#endif

//  Get the output file reference for label update
  Cube *ocube = proc.SetOutputCube("TO");
  proc.StartProcess(cleanImage);
  iclean->propagateBlobs(ocube);
  proc.EndProcess();

//  Write statistics to file if requested
  if (ui.WasEntered("CLEANSTATS")) {
    std::string darkfile = ui.GetFilename("CLEANSTATS");
    std::ofstream dfile;
    dfile.open(darkfile.c_str(), std::ios::out | std::ios::trunc);
    dfile << *iclean;
    dfile.close();
  }

//  Dump stats to standard out
  Pvl p;
  PvlGroup grp;
  iclean->PvlImageStats(grp);
  p.AddGroup(grp);
  Application::Log(grp);
  BigInt nNulled = iclean->TotalNulled();

  delete iclean;
  iclean = 0;

// Check for calibration problems
  if (nNulled != 0) {
    double tpixels((double) nNulled / (double) npixels);
    std::ostringstream mess;
    mess << "There were " << nNulled << " of " << npixels << " ("
         << std::setw(6) << std::setprecision(2) << (tpixels * 100.0)
         << "%) due to insufficient calibration data (LUTTED or Gaps)" 
         << std::ends;
    throw (iException::Message(iException::Math,mess.str(),_FILEINFO_));
  }
}
开发者ID:assutech,项目名称:isis3,代码行数:75,代码来源:hiclean.cpp

示例10: IsisMain

void IsisMain() {

    // Use a regular Process
    Process p;

    // Get user parameters and error check
    UserInterface &ui = Application::GetUserInterface();
    QString from = ui.GetFileName("FROM");
    QString to = FileName(ui.GetFileName("TO")).expanded();
//TO DO: UNCOMMENT THIS LINE ONCE HRSC IS WORKING IN SS
//  double HRSCNadirCenterTime = ui.GetDouble("HRSC_NADIRCENTERTIME");

    // Open input cube and Make sure this is a lev1 image (ie, not map projected)
    Cube cube;
    cube.open(from);

    if (cube.isProjected()) {
        QString msg = "Input images is a map projected cube ... not a level 1 image";
        throw IException(IException::User, msg, _FILEINFO_);
    }

    // Initialize the camera
    Cube *input = p.SetInputCube("FROM");
    Pvl *cubeHeader = input->label();
    Camera *cam = input->camera();
    CameraDetectorMap *detectorMap = cam->DetectorMap();
    CameraFocalPlaneMap *focalMap = cam->FocalPlaneMap();
    CameraDistortionMap *distortionMap = cam->DistortionMap();
    CameraGroundMap *groundMap = cam->GroundMap();

    // Make sure the image contains the InstrumentPointing (aka CK) blob/table
    PvlGroup test = cube.label()->findGroup("Kernels", Pvl::Traverse);
    QString InstrumentPointing = (QString) test["InstrumentPointing"];
    if (InstrumentPointing != "Table") {
        QString msg = "Input image does not contain needed SPICE blobs...run spiceinit with attach=yes.";
        throw IException(IException::User, msg, _FILEINFO_);
    }

    // Open output line scanner keyword file
    ofstream toStrm;
    toStrm.open(to.toAscii().data(), ios::trunc);
    if (toStrm.bad()) {
        QString msg = "Unable to open output TO file";
        throw IException(IException::User, msg, _FILEINFO_);
    }

    // Get required keywords from instrument and band groups
    PvlGroup inst = cube.label()->findGroup("Instrument", Pvl::Traverse);
    QString instrumentId = (QString) inst["InstrumentId"];

    bool     isMocNA = false;
//TO DO: UNCOMMENT THIS LINES ONCE MOC IS WORKING IN SS
//  bool     isMocWARed = false;
    bool     isHiRise = false;
    bool     isCTX = false;
    bool     isLroNACL = false;
    bool     isLroNACR = false;
    bool     isHRSC = false;
//TO DO: UNCOMMENT THESE LINE ONCE MOC IS WORKING IN SS
//  if (instrumentId == "MOC") {
//    PvlGroup band = cube.label()->findGroup("BandBin", Pvl::Traverse);
//    QString filter = (QString) band["FilterName"];
//
//    if (strcmp(filter.toAscii().data(), "BROAD_BAND") == 0)
//      isMocNA = true;
//    else if (strcmp(filter.toAscii().data(), "RED") == 0)
//      isMocWARed = true;
//    else if (strcmp(filter.toAscii().data(), "BLUE") == 0) {
//      QString msg = "MOC WA Blue filter images not supported for Socet Set mapping";
//      throw IException(IException::User, msg, _FILEINFO_);
//    }
//  }
//  else if (instrumentId == "IdealCamera") {
//TO DO: DELETE THIS LINE ONCE MOC IS WORKING IN SS
    if (instrumentId == "IdealCamera") {
        PvlGroup orig = cube.label()->findGroup("OriginalInstrument",  Pvl::Traverse);
        QString origInstrumentId = (QString) orig["InstrumentId"];
        if (origInstrumentId == "HIRISE") {
            isHiRise = true;
        }
        else {
            QString msg = "Unsupported instrument: " + origInstrumentId;
            throw IException(IException::User, msg, _FILEINFO_);
        }
    }
    else if (instrumentId == "HIRISE") {
        isHiRise = true;
    }
    else if (instrumentId == "CTX") {
        isCTX = true;
    }
    else if (instrumentId == "NACL") {
        isLroNACL = true;
    }
    else if (instrumentId == "NACR") {
        isLroNACR = true;
    }
//TO DO: UNCOMMENT THIS LINE ONCE HRSC IS WORKING IN SS
//  else if (instrumentId == "HRSC") isHRSC = true;
    else {
//.........这里部分代码省略.........
开发者ID:jlaura,项目名称:isis3,代码行数:101,代码来源:socetlinescankeywords.cpp

示例11: IsisMain

void IsisMain() {
  Process p;
  Cube *icube = p.SetInputCube("FROM");

  // Setup the histogram
  UserInterface &ui = Application::GetUserInterface();
  Histogram hist(*icube,1,p.Progress());
  if (ui.WasEntered("MINIMUM")) {
    hist.SetValidRange(ui.GetDouble("MINIMUM"),ui.GetDouble("MAXIMUM"));
  }
  if (ui.WasEntered("NBINS")) {
    hist.SetBins(ui.GetInteger("NBINS"));
  }

  // Loop and accumulate histogram
  p.Progress()->SetText("Gathering Histogram");
  p.Progress()->SetMaximumSteps(icube->Lines());
  p.Progress()->CheckStatus();
  LineManager line(*icube);
  for (int i=1; i<=icube->Lines(); i++) {
    line.SetLine(i);
    icube->Read(line);
    hist.AddData(line.DoubleBuffer(),line.size());
    p.Progress()->CheckStatus();
  }

  if(!ui.IsInteractive() || ui.WasEntered("TO")) {
    // Write the results

    if (!ui.WasEntered("TO")) {
      string msg = "The [TO] parameter must be entered";
      throw iException::Message(iException::User,msg,_FILEINFO_);
    }
    string outfile = ui.GetFilename("TO");
    ofstream fout;
    fout.open (outfile.c_str());
   
    fout << "Cube:           " << ui.GetFilename("FROM") << endl;
    fout << "Band:           " << icube->Bands() << endl;
    fout << "Average:        " << hist.Average() << endl;
    fout << "Std Deviation:  " << hist.StandardDeviation() << endl;
    fout << "Variance:       " << hist.Variance() << endl;
    fout << "Median:         " << hist.Median() << endl;
    fout << "Mode:           " << hist.Mode() << endl;
    fout << "Skew:           " << hist.Skew() << endl;
    fout << "Minimum:        " << hist.Minimum() << endl;
    fout << "Maximum:        " << hist.Maximum() << endl;
    fout << endl;
    fout << "Total Pixels:    " << hist.TotalPixels() << endl;
    fout << "Valid Pixels:    " << hist.ValidPixels() << endl;
    fout << "Null Pixels:     " << hist.NullPixels() << endl;
    fout << "Lis Pixels:      " << hist.LisPixels() << endl;
    fout << "Lrs Pixels:      " << hist.LrsPixels() << endl;
    fout << "His Pixels:      " << hist.HisPixels() << endl;
    fout << "Hrs Pixels:      " << hist.HrsPixels() << endl;
   
    //  Write histogram in tabular format
    fout << endl;
    fout << endl;
    fout << "DN,Pixels,CumulativePixels,Percent,CumulativePercent" << endl;
   
    Isis::BigInt total = 0;
    double cumpct = 0.0;
   
    for (int i=0; i<hist.Bins(); i++) {
      if (hist.BinCount(i) > 0) {
        total += hist.BinCount(i);
        double pct = (double)hist.BinCount(i) / hist.ValidPixels() * 100.;
        cumpct += pct;
   
        fout << hist.BinMiddle(i) << ",";
        fout << hist.BinCount(i) << ",";
        fout << total << ",";
        fout << pct << ",";
        fout << cumpct << endl;
      }
    }
    fout.close();
  }
  // If we are in gui mode, create a histogram plot
  if (ui.IsInteractive()) {
    // Set the title for the dialog
    string title;
    if (ui.WasEntered("TITLE")) {
      title = ui.GetString("TITLE");
    }
    else {
      title = "Histogram Plot for " + Filename(ui.GetAsString("FROM")).Name();
    }

    // Create the QHistogram, set the title & load the Isis::Histogram into it

    Qisis::HistogramToolWindow *plot = new Qisis::HistogramToolWindow(title.c_str(), ui.TheGui());

    // Set the xaxis title if they entered one
    if (ui.WasEntered("XAXIS")) {
      string xaxis(ui.GetString("XAXIS"));
      plot->setAxisLabel(QwtPlot::xBottom,xaxis.c_str());
    }

//.........这里部分代码省略.........
开发者ID:assutech,项目名称:isis3,代码行数:101,代码来源:hist.cpp

示例12: main

int main()
{
	Cube myCube;
	Face myFace1;
	Face myFace2;
	Face  myFace3;
	Face myFace4;
	Face  myFace5;
	Face  myFace6;
	Tile  r0c0;
	Tile r0c1;
	Tile r0c2;
	Tile r1c0;
	Tile r1c1;
	Tile r1c2;
	Tile r2c0;
	Tile r2c1;
	Tile r2c2;

	for(int i = 0; i < 6; i ++){
			/*string activeIndex = to_string(i);
			r0c0 = Tile(activeIndex);
			r0c1 =  Tile(activeIndex);
			r0c2 = Tile(activeIndex);
			r1c0 =  Tile(activeIndex);
			r1c1 = Tile(activeIndex);
			r1c2 =  Tile(activeIndex);
			r2c0 =  Tile(activeIndex);
			r2c1 =  Tile(activeIndex);
			r2c2 = Tile(activeIndex);*/

			if (i==0){
			r0c0 = Tile("G");
			r0c1 = Tile("G");
			r0c2 = Tile("G");
			r1c0 = Tile("G");
			r1c1 = Tile("G");
			r1c2 = Tile("G");
			r2c0 = Tile("G");
			r2c1 = Tile("G");
			r2c2 = Tile("G");
			}

			
			if (i==1){
			r0c0 = Tile("O");
			r0c1 = Tile("O");
			r0c2 = Tile("O");
			r1c0 = Tile("O");
			r1c1 = Tile("O");
			r1c2 = Tile("O");
			r2c0 = Tile("O");
			r2c1 = Tile("O");
			r2c2 = Tile("O");
			}

			
			if (i==2){
			r0c0 = Tile("Y");
			r0c1 = Tile("Y");
			r0c2 = Tile("Y");
			r1c0 = Tile("Y");
			r1c1 = Tile("Y");
			r1c2 = Tile("Y");
			r2c0 = Tile("Y");
			r2c1 = Tile("Y");
			r2c2 = Tile("Y");
			}

			
			if (i==3){
			r0c0 = Tile("R");
			r0c1 = Tile("R");
			r0c2 = Tile("R");
			r1c0 = Tile("R");
			r1c1 = Tile("R");
			r1c2 = Tile("R");
			r2c0 = Tile("R");
			r2c1 = Tile("R");
			r2c2 = Tile("R");
			}

			
			if (i==4){
			r0c0 = Tile("W");
			r0c1 = Tile("W");
			r0c2 = Tile("W");
			r1c0 = Tile("W");
			r1c1 = Tile("W");
			r1c2 = Tile("W");
			r2c0 = Tile("W");
			r2c1 = Tile("W");
			r2c2 = Tile("W");
			}

			
			if (i==5){
			r0c0 = Tile("B");
			r0c1 = Tile("B");
			r0c2 = Tile("B");
//.........这里部分代码省略.........
开发者ID:rperrow,项目名称:Cop3503,代码行数:101,代码来源:Main.cpp

示例13: WinMain

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
				   LPSTR, int )
{
	HANDLE ghInstance;
	WNDCLASS wcex;
	HWND hwnd;
	TCHAR WindowTitle[] = _T("Cube");
    TCHAR WindowClassName[] = _T("AppClass");
	if (!hPrevInstance)
	{
		wcex.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.lpszClassName = WindowClassName;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
		wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
		wcex.lpszMenuName = 0;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;

		if (!RegisterClass(&wcex))
			return 0;
	}

	ghInstance = hInstance;

	if (NULL==(hwnd = CreateWindow(WindowClassName, WindowTitle, 
		WS_CAPTION | WS_SYSMENU,			
		CW_USEDEFAULT, 0, WIDTH, HEIGHT, 
		NULL, NULL, hInstance, NULL)))
	{
		return 0;
	}
	if (SUCCEEDED(cube.device.InitialDirect3D(hwnd)))
	{
		if (SUCCEEDED(cube.InitialObject()))
		{
			if (SUCCEEDED(cube.device.shader.InitialShader()))
			 {	   
				ShowWindow(hwnd, SW_SHOWDEFAULT);
				UpdateWindow(hwnd);
				MSG msg;
				ZeroMemory(&msg, sizeof(msg));
				while (WM_QUIT!=msg.message)
				{
					if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
					{
						TranslateMessage(&msg);
						DispatchMessage(&msg);
					}
					 else
					{
						cube.Draw();
					}
				}
			}
		}
	}
	return 0;
}
开发者ID:Sn0wd0ll,项目名称:Cube,代码行数:61,代码来源:main.cpp

示例14: init

void init()
{

	glClearColor(1.0,1.0,1.0,0.0);						//sets the clear colour to yellow
					//glClear(GL_COLOR_BUFFER_BIT) in the display function//will clear the buffer to this colour.

	// Shaders
	if(!myShader.load("BasicView", "glslfiles/basicTransformations.vert", "glslfiles/basicTransformations.frag"))
	{
		cout << "failed to load shader" << endl;
	}							
	if (!cubeShader.load("BasicView", "glslfiles/cubeShader.vert", "glslfiles/cubeShader.frag"))
	{
		cout << "failed to load shader" << endl;
	}
	cubeOne.setDim(15);
	cubeOne.constructGeometry(&cubeShader);
	worldCube.setDim(1000);
	worldCube.constructGeometry(&cubeShader);

	glEnable(GL_TEXTURE_2D);

	
	copter.loadModel(myShader);
	prop.loadModel(myShader);
	world.loadModel(myShader);
	ground.loadModel(myShader);
	houseOne.loadModel(myShader, "TestModels/dododododhouse2.obj", glm::vec3(50, 44, 50), 
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 0);
	houseTwo.loadModel(myShader, "TestModels/pyramidhouse2.obj", glm::vec3(-1250, 44, 1000),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 0);
	houseThree.loadModel(myShader, "TestModels/pyramidhouse2.obj", glm::vec3(-500, 44, -500),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 0);
	houseFour.loadModel(myShader, "TestModels/pyramidhouse2.obj", glm::vec3(1200, 44, 1200),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 0);
	houseFive.loadModel(myShader, "TestModels/dododododhouse2.obj", glm::vec3(50, 44, -1150),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 0);
	houseSix.loadModel(myShader, "TestModels/dododododhouse2.obj", glm::vec3(-900, 44, -500),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 0);
	treeOne.loadModel(myShader, "TestModels/tree.obj", glm::vec3(250, 20, 250),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	treeTwo.loadModel(myShader, "TestModels/tree.obj", glm::vec3(350, 20, 250),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	treeThree.loadModel(myShader, "TestModels/tree.obj", glm::vec3(300, 20, 250),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	treeFour.loadModel(myShader, "TestModels/tree.obj", glm::vec3(0, 20, 750),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	treeFive.loadModel(myShader, "TestModels/tree.obj", glm::vec3(200, 20, 180),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	treeOne.loadModel(myShader, "TestModels/tree.obj", glm::vec3(-900, 20, 580),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	treeTwo.loadModel(myShader, "TestModels/tree.obj", glm::vec3(1040, 20, 1050),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	treeThree.loadModel(myShader, "TestModels/tree.obj", glm::vec3(-1260, 20, -250),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	treeFour.loadModel(myShader, "TestModels/tree.obj", glm::vec3(1270, 20, 250),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	treeFive.loadModel(myShader, "TestModels/tree.obj", glm::vec3(-230, 20, 250),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	leafOne.loadModel(myShader, "TestModels/leaf.obj", glm::vec3(150, -10, 580),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	leafTwo.loadModel(myShader, "TestModels/leaf.obj", glm::vec3(170, -10, 530),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	leafThree.loadModel(myShader, "TestModels/leaf.obj", glm::vec3(150, -10, 550),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	leafFour.loadModel(myShader, "TestModels/leaf.obj", glm::vec3(150, -10, 510),
		glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, glm::vec4{ 0.8, 0.8, 0.8, 1.0 }, 50);
	
	houses.push_back(houseOne);
	houses.push_back(houseTwo);
	houses.push_back(houseThree);
	houses.push_back(houseFour);
	houses.push_back(houseFive);
	houses.push_back(houseSix);
	trees.push_back(treeOne);
	trees.push_back(treeTwo);
	trees.push_back(treeThree);
	trees.push_back(treeFour);
	trees.push_back(treeFive);
	trees.push_back(treeSix);
	trees.push_back(treeSeven);
	trees.push_back(treeEight);
	trees.push_back(treeNine);
	trees.push_back(treeTen);
	leafs.push_back(leafOne);
	leafs.push_back(leafTwo);
	leafs.push_back(leafThree);
	leafs.push_back(leafFour);
	glEnable(GL_DEPTH_TEST);

	
}
开发者ID:ashm01,项目名称:3DHelicopter,代码行数:92,代码来源:opengl3template.cpp

示例15: IsisMain

void IsisMain() {
  Process p;
  Cube *icube = p.SetInputCube("FROM");
  Camera *cam = icube->camera();

  UserInterface &ui = Application::GetUserInterface();

  QString from = ui.GetFileName("FROM");
  int sinc = ui.GetInteger("SINC");
  int linc = ui.GetInteger("LINC");
  CameraStatistics camStats(cam, sinc, linc, from);

  // Send the Output to the log area
  Pvl statsPvl = camStats.toPvl();
  for (int i = 0; i < statsPvl.groups(); i++) {
    Application::Log(statsPvl.group(i));
  }

  if(ui.WasEntered("TO")) {
    QString outfile = FileName(ui.GetFileName("TO")).expanded();
    bool exists = FileName(outfile).fileExists();
    bool append = ui.GetBoolean("APPEND");

    // If the user chose a format of PVL, then write to the output file ("TO")
    if(ui.GetString("FORMAT") == "PVL") {
      (append) ? statsPvl.append(outfile) : statsPvl.write(outfile);
    }
    else {
      // Create a flatfile of the data with columhn headings the flatfile is
      // comma-delimited and can be imported in to spreadsheets
      ofstream os;
      bool writeHeader = true;
      if(append) {
        os.open(outfile.toAscii().data(), ios::app);
        if(exists) {
          writeHeader = false;
        }
      }
      else {
        os.open(outfile.toAscii().data(), ios::out);
      }

      // if new file or append and no file exists then write header
      if(writeHeader) {
        os << "Filename," <<
           "LatitudeMinimum," <<
           "LatitudeMaximum," <<
           "LatitudeAverage," <<
           "LatitudeStandardDeviation," <<
           "LongitudeMinimum," <<
           "LongitudeMaximum," <<
           "LongitudeAverage," <<
           "LongitudeStandardDeviation," <<
           "SampleResolutionMinimum," <<
           "SampleResolutionMaximum," <<
           "SampleResolutionAverage," <<
           "SampleResolutionStandardDeviation," <<
           "LineResolutionMinimum," <<
           "LineResolutionMaximum," <<
           "LineResolutionAverage," <<
           "LineResolutionStandardDeviation," <<
           "ResolutionMinimum," <<
           "ResolutionMaximum," <<
           "ResolutionAverage," <<
           "ResolutionStandardDeviation," <<
           "AspectRatioMinimum," <<
           "AspectRatioMaximum," <<
           "AspectRatioAverage," <<
           "AspectRatioStandardDeviation," <<
           "PhaseMinimum," <<
           "PhaseMaximum," <<
           "PhaseAverage," <<
           "PhaseStandardDeviation," <<
           "EmissionMinimum," <<
           "EmissionMaximum," <<
           "EmissionAverage," <<
           "EmissionStandardDeviation," <<
           "IncidenceMinimum," <<
           "IncidenceMaximum," <<
           "IncidenceAverage," <<
           "IncidenceStandardDeviation," <<
           "LocalSolarTimeMinimum," <<
           "LocalSolarTimeMaximum," <<
           "LocalSolarTimeAverage," <<
           "LocalSolarTimeStandardDeviation," <<
           "LocalRadiusMaximum," <<
           "LocalRadiusMaximum," <<
           "LocalRadiusAverage," <<
           "LocalRadiusStandardDeviation," <<
           "NorthAzimuthMinimum," <<
           "NorthAzimuthMaximum," <<
           "NorthAzimuthAverage," <<
           "NorthAzimuthStandardDeviation," << endl;
      }
      os << FileName(from).expanded() << ",";
      //call the function to write out the values for each group
      writeFlat(os, camStats.getLatStat());
      writeFlat(os, camStats.getLonStat());
      writeFlat(os, camStats.getSampleResStat());
      writeFlat(os, camStats.getLineResStat());
//.........这里部分代码省略.........
开发者ID:corburn,项目名称:ISIS,代码行数:101,代码来源:camstats.cpp


注:本文中的Cube类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。