• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ pos1函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: checkLabel

Local void checkLabel(Char *w)
{
  voice_index j, FORLIM;
  Char STR1[256], STR2[256];

  FORLIM = nvoices;
  for (j = 0; j <= FORLIM - 1; j++) {
    if (!strcmp(w, voice_label[j])) {
      sprintf(STR2, "Voice label %s not unique", w);
      warning(STR2, print);
      return;
    }
  }
  if (strlen(w) > 2)
    return;
  if (pos1(w[0], "CLU") > 0) {
    if (strlen(w) > 1) {
      if (pos1(w[1], "123456789") == 0)
	return;
    }
  } else if (pos1(w[0], "123456789") == 0)
    return;
  sprintf(STR1, "Voice label %s conflicts with reserved label", w);
  error(STR1, print);
}
开发者ID:texlive,项目名称:texlive-source,代码行数:25,代码来源:preamble.c


示例2: textTranslate

Static void textTranslate(Char *uptext, Char *font)
{
  short k;
  Char STR1[256], STR2[256], STR3[256], STR4[256];
  short FORLIM;

  if (*uptext == '\0')
    return;
  do {
    k = pos1('%', uptext);
    if (k > 0) {
      sprintf(STR4, "%s{\\mtxFlat}%s",
	      substr_(STR1, uptext, 1, k - 1),
	      substr_(STR3, uptext, k + 1, strlen(uptext) - k));
      strcpy(uptext, STR4);
    }
  } while (k != 0);
  do {
    k = pos1('#', uptext);
    if (k > 0) {
      sprintf(STR2, "%s{\\mtxSharp}%s",
	      substr_(STR1, uptext, 1, k - 1),
	      substr_(STR4, uptext, k + 1, strlen(uptext) - k));
      strcpy(uptext, STR2);
    }
  } while (k != 0);
  switch (uptext[0]) {

  case '<':
    if (!strcmp(uptext, "<"))
      strcpy(uptext, "\\mtxIcresc");
    else if (!strcmp(uptext, "<."))
      strcpy(uptext, "\\mtxTcresc");
    else {
      predelete(uptext, 1);
      sprintf(uptext, "\\mtxCresc{%s}", strcpy(STR4, uptext));
    }
    break;

  case '>':
    if (!strcmp(uptext, ">"))
      strcpy(uptext, "\\mtxIdecresc");
    else if (!strcmp(uptext, ">."))
      strcpy(uptext, "\\mtxTdecresc");
    else {
      predelete(uptext, 1);
      sprintf(uptext, "\\mtxDecresc{%s}", strcpy(STR1, uptext));
    }
    break;

  default:
    FORLIM = strlen(uptext);
    for (k = 0; k <= FORLIM - 1; k++) {
      if (pos1(uptext[k], "mpfzrs~") == 0)
	return;
    }
    break;
  }
  strcpy(font, "\\mtxPF");
}
开发者ID:texlive,项目名称:texlive-source,代码行数:60,代码来源:uptext.c


示例3: getKeyframePositionAndRotation

bool DemoKeeper::demoLoop( const Ogre::FrameEvent& evt )
{
	mWorld->markForWrite();

	//
	//running demo loop accordingly
	//
	
	if (Keyframe_demoRunning)
	{
		hkVector4 pos;
		hkQuaternion rot;
		getKeyframePositionAndRotation(m_time + evt.timeSinceLastFrame, pos, rot);

		hkpKeyFrameUtility::applyHardKeyFrame(pos, rot, 1.0f /evt.timeSinceLastFrame, m_keyframedBody);
		m_time += evt.timeSinceLastFrame;
	}
	else if (binaryaction_demoRunning)
	{
		hkVector4 pos1 = m_boxRigidBody1->getPosition();
		hkVector4 pos2 = m_boxRigidBody2->getPosition();
		hkVector4 lenVec;
		lenVec.setSub4(pos1, pos2);

		manual_spring = mSceneMgr->createManualObject();
		manual_spring->setQueryFlags(0);
		manual_spring->begin( "BaseWhiteNoLighting",   Ogre::RenderOperation::OT_LINE_LIST);
		manual_spring->position(pos1(0),pos1(1),pos1(2));
		if (lenVec.length3() > m_springAction->getRestLength())
		{
			// Line is red if the spring is stretched.
			manual_spring->colour(1,0,0); 
		}
		else
		{
			// Line is blue is spring is at rest or compressed.
			manual_spring->colour(0,0,1); 
	
		}
		manual_spring->position(pos2(0),pos2(1),pos2(2));
		manual_spring->end();
		
		springNode->detachAllObjects();
		springNode->attachObject(manual_spring);
	}
		
	mWorld->unmarkForWrite();
	return true;
}
开发者ID:kevinmore,项目名称:MyPhysicsLab,代码行数:49,代码来源:DemoKeeper.cpp


示例4: setOnly

void setOnly(Char *line_)
{
  Char line[256];
  short num, num1, num2, l;
  Char s[256];
  Char STR1[256];

  strcpy(line, line_);
  if (*line == '\0')
    return;
  if (startsWithIgnoreCase(line, "only"))
    GetNextWord(STR1, line, colon_, dummy);
  for (l = 0; l <= lines_in_paragraph - 1; l++)
    omit_line[l] = true;
  do {
    GetNextWord(s, line, blank_, comma_);
    if (*s == '\0')
      return;
    curtail(s, comma_);
    if (pos1('-', s) == 0) {
      getNum(s, &num);
      if (num > 0 && num <= lines_in_paragraph)
	omit_line[num-1] = false;
      else
	warning("Invalid line number in Only: is skipped", print);
    } else {
      getTwoNums(s, &num1, &num2);
      if (num1 > 0 && num2 <= lines_in_paragraph) {
	for (num = num1 - 1; num <= num2 - 1; num++)
	  omit_line[num] = false;
      } else
	warning("Invalid line range in Only: is skipped", print);
    }
  } while (true);
}
开发者ID:texlive,项目名称:texlive-source,代码行数:35,代码来源:preamble.c


示例5: pos0

void
AirController::doWork()
{
			std::list<Flight*> flights = Airport::getInstance()->getFlights();
			std::list<Flight*>::iterator it;

			Position pos0(3500.0, 0.0, 100.0);
			Position pos1(1500.0, 0.0, 50.0);
			Position pos2(200.0, 0.0, 25.0);
			Position pos3(-750.0, 0.0, 25.0);

			Route r0, r1, r2, r3;

			r0.pos = pos0;
			r0.speed = 500.0;
			r1.pos = pos1;
			r1.speed = 100.0;
			r2.pos = pos2;
			r2.speed = 19.0;
			r3.pos = pos3;
			r3.speed = 15.0;

			for(it = flights.begin(); it!=flights.end(); ++it)
			{
				if((*it)->getRoute()->empty())
				{
					(*it)->getRoute()->push_back(r3);
					(*it)->getRoute()->push_front(r2);
					(*it)->getRoute()->push_front(r1);
					(*it)->getRoute()->push_front(r0);
				}
			}

}
开发者ID:lorenzodbl,项目名称:ATCSim,代码行数:34,代码来源:AirController.cpp


示例6: Position

/**
 * Whether going from one tile to another blocks movement.
 * @param startTile
 * @param endTile
 * @param direction
 * @return true/false
 */
bool Pathfinding::isBlocked(Tile *startTile, Tile *endTile, const int direction)
{

	// check if the difference in height between start and destination is not too high
	// so we can not jump to the highest part of the stairs from the floor
	// stairs terrainlevel goes typically -8 -16 (2 steps) or -4 -12 -20 (3 steps)
	// this "maximum jump height" is therefore set to 8

	static const Position oneTileNorth = Position(0, -1, 0);
	static const Position oneTileEast = Position(1, 0, 0);
	static const Position oneTileSouth = Position(0, 1, 0);
	static const Position oneTileWest = Position(-1, 0, 0);
	Position pos1 (startTile->getPosition());

	switch(direction)
	{
	case 0:	// north
		if (isBlocked(startTile, MapData::O_NORTHWALL)) return true;
		break;
	case 1: // north east
		if (isBlocked(startTile,MapData::O_NORTHWALL)) return true;
		if (isBlocked(endTile,MapData::O_WESTWALL)) return true;
		if (isBlocked(_save->getTile(pos1 + oneTileEast),MapData::O_WESTWALL)) return true;
		if (isBlocked(_save->getTile(pos1 + oneTileEast),MapData::O_NORTHWALL)) return true;
		if (isBlocked(_save->getTile(pos1 + oneTileNorth),O_BIGWALL) && isBlocked(_save->getTile(pos1 + oneTileNorth),O_BIGWALL)) return true;
		break;
	case 2: // east
		if (isBlocked(endTile,MapData::O_WESTWALL)) return true;
		break;
	case 3: // south east
		if (isBlocked(endTile,MapData::O_WESTWALL)) return true;
		if (isBlocked(endTile,MapData::O_NORTHWALL)) return true;
		if (isBlocked(_save->getTile(pos1 + oneTileEast),MapData::O_WESTWALL)) return true;
		if (isBlocked(_save->getTile(pos1 + oneTileSouth),MapData::O_NORTHWALL)) return true;
		if (isBlocked(_save->getTile(pos1 + oneTileSouth),O_BIGWALL) && isBlocked(_save->getTile(pos1 + oneTileEast),O_BIGWALL)) return true;
		break;
	case 4: // south
		if (isBlocked(endTile,MapData::O_NORTHWALL)) return true;
		break;
	case 5: // south west
		if (isBlocked(endTile,MapData::O_NORTHWALL)) return true;
		if (isBlocked(startTile,MapData::O_WESTWALL)) return true;
		if (isBlocked(_save->getTile(pos1 + oneTileSouth),MapData::O_WESTWALL)) return true;
		if (isBlocked(_save->getTile(pos1 + oneTileSouth),MapData::O_NORTHWALL)) return true;
		if (isBlocked(_save->getTile(pos1 + oneTileSouth),O_BIGWALL) && isBlocked(_save->getTile(pos1 + oneTileWest),O_BIGWALL)) return true;
		break;
	case 6: // west
		if (isBlocked(startTile,MapData::O_WESTWALL)) return true;
		break;
	case 7: // north west
		if (isBlocked(startTile,MapData::O_WESTWALL)) return true;
		if (isBlocked(startTile,MapData::O_NORTHWALL)) return true;
		if (isBlocked(_save->getTile(pos1 + oneTileNorth),MapData::O_WESTWALL)) return true;
		if (isBlocked(_save->getTile(pos1 + oneTileWest),MapData::O_NORTHWALL)) return true;
		if (isBlocked(_save->getTile(pos1 + oneTileNorth),O_BIGWALL) && isBlocked(_save->getTile(pos1 + oneTileWest),O_BIGWALL)) return true;
		break;
	}

	return false;
}
开发者ID:Munkeylord,项目名称:OpenXcom,代码行数:67,代码来源:Pathfinding.cpp


示例7: faceName

    bool WindowsManager::addSquareFace (const char* faceNameCorba,
            const value_type* posCorba1,
            const value_type* posCorba2,
            const value_type* posCorba3,
            const value_type* posCorba4,
            const value_type* colorCorba)
    {
        std::string faceName (faceNameCorba);
        if (nodes_.find (faceName) != nodes_.end ()) {
            std::cout << "You need to chose an other name, \"" << faceName
                << "\" already exist." << std::endl;
            return false;
        }
        else {
            mtx_.lock();
            osgVector3 pos1 (posCorba1[0], posCorba1[1], posCorba1[2]);
            osgVector3 pos2 (posCorba2[0], posCorba2[1], posCorba2[2]);
            osgVector3 pos3 (posCorba3[0], posCorba3[1], posCorba3[2]);
            osgVector3 pos4 (posCorba4[0], posCorba4[1], posCorba4[2]);
            LeafNodeFacePtr_t face = LeafNodeFace::create
                (faceName, pos1, pos2, pos3, pos3, getColor (colorCorba));
            WindowsManager::initParent (faceName, face);
            addNode (faceName, face);
	    mtx_.unlock();
            return true;
        }
    }
开发者ID:stonneau,项目名称:gepetto-viewer-corba,代码行数:27,代码来源:windows-manager.cpp


示例8: getPositionInGrid

float CRole::getDistanceSqInGrid(IGridRole* role)
{
    Point p1 = getPositionInGrid();
    Point p2 = role->getPositionInGrid();
    
    int i,j,m,n;
    float smallest = FLT_MAX;
    
    for (i = 0; i < getGridWidth(); ++i)
    {
        for (j = 0; j < getGridHeight(); ++j)
        {
            Point pos1(p1.x + i, p1.y + j);
            for (m = 0; m < role->getGridWidth(); ++m)
            {
                for (n = 0; n < role->getGridHeight(); ++n)
                {
                    Point pos2(p2.x + m, p2.y + n);
                    float dist = pos1.getDistanceSq(pos2);
                    if (dist < smallest)
                    {
//                        CCLOG("(%f,%f --> %f, %f) %f", pos1.x, pos1.y, pos2.x, pos2.y, dist);
                        smallest = dist;
                    }
                }
            }
        }
    }
    
	return smallest;
}
开发者ID:Gamex,项目名称:GameX,代码行数:31,代码来源:CRole.cpp


示例9: pos1

	void CollisionSystem::ResolveCollision(Actor* actor1, Actor* actor2)
	{
		const float PUSH_AMOUNT = 0.65f;

		float radius1 = actor1->GetRadius();
		float radius2 = actor2->GetRadius();

		Vector2Df pos1(actor1->Get2DPos());
		Vector2Df pos2(actor2->Get2DPos());

		Vector2Df dir(pos1 - pos2);

		float sqrdDist = dir.SquaredLength();
		float radiusSqrd = radius1 + radius2;
		radiusSqrd *= radiusSqrd;

		if(sqrdDist < radiusSqrd)
		{
			float length = dir.Length();
			float mult = abs(1.0f - length / (radius1 + radius2));

			pos1 += dir * PUSH_AMOUNT * mult;
			if(actor1->CanBeMoved())
				actor1->SetPosition(Vector3Df(pos1.x_, 0.0f, pos1.y_));

			pos2 += dir * -PUSH_AMOUNT * mult;
			if(actor2->CanBeMoved())
				actor2->SetPosition(Vector3Df(pos2.x_, 0.0f, pos2.y_));

			actor1->Collided(actor2);
			actor2->Collided(actor1);
		}
	}
开发者ID:TrevinLiberty,项目名称:CaptainLucha,代码行数:33,代码来源:CollisionSystem.cpp


示例10: drawRectangle

// ---
void Entity_4::drawOn (QGAMES::Screen* s, const QGAMES::Position& p)
{
	QGAMES::ArtistInATiledMap::drawOn (s, p);

	#ifndef NDEBUG
	s -> drawRectangle (collisionZone (), QGAMES::Color (120,120,120,255));

	int ePosX, ePosY, ntW, ntH;
	QGAMES::bdata m = (QGAMES::bdata) 0.0;
	QGAMES::Vector pv (__BD 0, __BD 0, __BD 0);
	adjustRelevants (m, pv);
	tilesOcuppied (ePosX, ePosY, ntW, ntH, m, pv);

	int tWidth = (__TM map ()) -> tileWidth ();
	int tHeight = (__TM map ()) -> tileHeight ();
	int mWidth = map () -> width () / tWidth;
	int mHeight = map () -> height () / tHeight; 
	int nE = ePosY * mWidth + ePosX;
	for (int i = 0; i < ntH; i++)
	{
		for (int j = 0; j < ntW; j++)
		{
			int iPos = nE + (i * mWidth + j);
			QGAMES::Position pos1 (__BD ((iPos % mWidth) * tWidth), __BD ((iPos / mWidth) * tHeight), __BD 0);
			QGAMES::Position pos2 = pos1 + QGAMES::Vector (__BD tWidth, __BD tHeight, __BD 0);
			s -> drawRectangle (QGAMES::Rectangle (pos1, pos2), QGAMES::Color (255,255,0,255));
		}
	}
	#endif
}
开发者ID:Commnets,项目名称:QGAMES,代码行数:31,代码来源:Entities.cpp


示例11: processUsual

Local void processUsual(struct LOC_processLine *LINK)
{
  if (hasVerseNumber(LINK->voice))
    strcat(LINK->pretex, "\\mtxVerse");
  LINK->l = pos1(multi_group, LINK->note);
  if (LINK->l > 0)
    scan1(LINK->note, LINK->l + 1, &LINK->nmulti);
  activateBeamsAndSlurs(LINK->voice);
  LINK->in_group = false;
  if (LINK->ngrace > 0) {
    LINK->in_group = true;
    LINK->ngrace--;
  } else {
    if (LINK->nmulti > 0) {
      LINK->in_group = true;
      LINK->nmulti--;
    }
  }
  checkOctave(LINK->voice, LINK->note);
  renewPitch(LINK->voice, LINK->note);
  if (!LINK->in_group) {
    resetDuration(LINK->voice, durationCode(LINK->note));
    markDebeamed(LINK->voice, LINK->note);
  }
  lookahead(LINK);
  getSyllable(LINK->voice, LINK->pretex);
  addUptext(LINK->voice, &LINK->no_uptext, LINK->pretex);
  addChords(LINK);
}
开发者ID:MiKTeX,项目名称:miktex,代码行数:29,代码来源:prepmx.c


示例12: torque1

dReal ServoMotor::getTorque() {
	// code from Jeff Shim

	osg::Vec3 torque1(fback_.t1[0], fback_.t1[1], fback_.t1[2] );
	osg::Vec3 torque2(fback_.t2[0], fback_.t2[1], fback_.t2[2] );
	osg::Vec3 force1(fback_.f1[0], fback_.f1[1], fback_.f1[2] );
	osg::Vec3 force2(fback_.f2[0], fback_.f2[1], fback_.f2[2] );

	const double* p1 = dBodyGetPosition( dJointGetBody(joint_->getJoint(),0) );
	const double* p2 = dBodyGetPosition( dJointGetBody(joint_->getJoint(),1) );

	osg::Vec3 pos1(p1[0], p1[1], p1[2]);
	osg::Vec3 pos2(p2[0], p2[1], p2[2]);


	dVector3 odeAnchor;
	dJointGetHingeAnchor ( joint_->getJoint(), odeAnchor );
	osg::Vec3 anchor(odeAnchor[0], odeAnchor[1], odeAnchor[2]);


	osg::Vec3 ftorque1 = torque1 - (force1^(pos1-anchor));// torq by motor = total torq - constraint torq
	osg::Vec3 ftorque2 = torque2 - (force2^(pos2-anchor));// opposite direction - use if this is necessary

	dVector3 odeAxis;
	dJointGetHingeAxis ( joint_->getJoint(), odeAxis);
	osg::Vec3 axis(odeAxis[0], odeAxis[1], odeAxis[2] );
	axis.normalize();

	double torque =  ftorque1 * axis;

	//printf ("torque: % 1.10f\n", torque);
	return torque;
}
开发者ID:swadhin-,项目名称:robogen,代码行数:33,代码来源:ServoMotor.cpp


示例13: countIt

Local void countIt(struct LOC_scanMusic *LINK)
{
  struct LOC_countIt V;

  V.LINK = LINK;
  if (LINK->ngrace > 0) {
    LINK->ngrace--;
    return;
  }
  if (LINK->nmulti > 0) {
    decmulti(LINK);
    return;
  }
  if (LINK->count % 3 != 0 &&
      (LINK->note[0] != rest && note_attrib[LINK->voice-1]['d' - 'a'] ||
       LINK->note[0] == rest && rest_attrib[LINK->voice-1]['d' - 'a']))
    LINK->count += LINK->count / 2;
/* p2c: mtx.pas, line 150:
 * Note: Using % for possibly-negative arguments [317] */
  incbar(LINK->count, &V);
  LINK->l = pos1(multi_group, LINK->note);
  if (LINK->l <= 0)
    return;
  predelete(LINK->note, LINK->l);
  getNum(LINK->note, &LINK->nmulti);
  decmulti(LINK);
}
开发者ID:clerkma,项目名称:texlive-mobile,代码行数:27,代码来源:mtx.c


示例14: checkSticky

Static void checkSticky(Char *note, boolean *attrib)
{
  short i = 2;
  short l;
  Char c;
  Char a[256];

  if (*note == '\0')
    return;
  l = strlen(note);
  while (i <= l) {
    c = note[i-1];
    if (islower(c)) {
      if (i < l && note[i] == ':') {
	delete1(note, i + 1);
	l--;
	attrib[c - 'a'] = !attrib[c - 'a'];
      } else
	attrib[c - 'a'] = false;
    }
    i++;
  }
  attribs(a, note);
  for (c = 'z'; c >= 'a'; c--) {
    if (attrib[c - 'a'] && pos1(c, a) == 0)
      insertChar(c, note, 3);
  }
}
开发者ID:clerkma,项目名称:texlive-mobile,代码行数:28,代码来源:mtx.c


示例15: DrawVertexList

	void DrawVertexList(const VertexBuffer& vertexBuffer)
	{
		std::vector<VertexList*>::const_iterator bufferIt = vertexBuffer.lists.begin();
		std::vector<VertexList*>::const_iterator bufferItEnd = vertexBuffer.lists.end();
		for(; bufferIt != bufferItEnd; bufferIt++) {
			const VertexList& vertexList = **bufferIt;

			Graphic& graphic = Graphic::Instance();
			int indexCount = (int)vertexList.indices.size();
			for(int i = 0; ((i + 1) * 3) <= indexCount; i++) {

				int idx0 = vertexList.indices[i * 3];
				int idx1 = vertexList.indices[(i * 3) + 1];
				int idx2 = vertexList.indices[(i * 3) + 2];

				Vector2 pos0(vertexList.vertices[idx0].xyz.x, vertexList.vertices[idx0].xyz.y);
				Vector2 pos1(vertexList.vertices[idx1].xyz.x, vertexList.vertices[idx1].xyz.y);
				Vector2 pos2(vertexList.vertices[idx2].xyz.x, vertexList.vertices[idx2].xyz.y);

				graphic.DrawLine(pos0, pos1, 0xFF0000FF);
				graphic.DrawLine(pos1, pos2, 0xFF0000FF);
				graphic.DrawLine(pos2, pos0, 0xFF0000FF);
			}
		}

	}
开发者ID:ffskyfan,项目名称:softbreeze,代码行数:26,代码来源:pipe_line.cpp


示例16: pos1

QRectF Dynamic::drag(EditData* ed)
      {
      QRectF f = Element::drag(ed);

      //
      // move anchor
      //
      Qt::KeyboardModifiers km = qApp->keyboardModifiers();
      if (km != (Qt::ShiftModifier | Qt::ControlModifier)) {
            int si;
            Segment* seg = 0;
            if (score()->pos2measure(ed->pos, &si, 0, &seg, 0) == nullptr)
                  return f;
            if (seg && (seg != segment() || staffIdx() != si)) {
                  QPointF pos1(canvasPos());
                  score()->undo(new ChangeParent(this, seg, si));
                  setUserOff(QPointF());
                  layout();
                  QPointF pos2(canvasPos());
                  setUserOff(pos1 - pos2);
                  ed->startMove = pos2;
                  }
            }
      return f;
      }
开发者ID:NupurMalpani,项目名称:MuseScore,代码行数:25,代码来源:dynamic.cpp


示例17: test_panning_sine_mix

void test_panning_sine_mix() {
	Sine vox1(431);				// sine osc
	Sine pos1(0.5);				// sine LFO for panner
//	Panner pan1(&vox1, -1.0, 0.1);	// scaling panner
	Panner pan1(vox1, pos1, 0.1);		// scaling panner
	Sine vox2(170);
	Sine pos2(0.3);
//	Panner pan2(&vox2, -0.3, 0.1);
	Panner pan2(vox2, pos2, 0.1);
	Sine vox3(267);
	Sine pos3(0.4);
//	Panner pan3(&vox3, 0.3, 0.1);
	Panner pan3(vox3, pos3, 0.1);
	Sine vox4(224);
	Sine pos4(0.7);
//	Panner pan4(&vox4, 1.0, 0.1);
	Panner pan4(vox4, pos4, 0.1);
	Mixer mix(2);				// create a stereo mixer
	mix.add_input(pan1);			// add the panners to the mixer
	mix.add_input(pan2);
	mix.add_input(pan3);
	mix.add_input(pan4);
	logMsg("playing panning mix of 4 sines...");
	run_test(mix, 9);
	logMsg("mix done.");
}
开发者ID:eriser,项目名称:CSL,代码行数:26,代码来源:Test_all.cpp


示例18: if

void CardContainer::fillCards(const QList<int> &card_ids, const QList<int> &disabled_ids) {
    QList<CardItem *> card_items;
    if (card_ids.isEmpty() && items.isEmpty())
        return;
    else if (card_ids.isEmpty() && !items.isEmpty()) {
        card_items = items;
        items.clear();
    } else if (!items.isEmpty()) {
        retained_stack.push(retained());
        items_stack.push(items);
        foreach (CardItem *item, items)
            item->hide();
        items.clear();
    }

    close_button->hide();
    if (card_items.isEmpty())
        card_items = _createCards(card_ids);

    int card_width = G_COMMON_LAYOUT.m_cardNormalWidth;
    QPointF pos1(30 + card_width / 2, 40 + G_COMMON_LAYOUT.m_cardNormalHeight / 2);
    QPointF pos2(30 + card_width / 2, 184 + G_COMMON_LAYOUT.m_cardNormalHeight / 2);
    int skip = 102;
    qreal whole_width = skip * 4;
    items.append(card_items);
    int n = items.length();

    for (int i = 0; i < n; i++) {
        QPointF pos;
        if (n <= 10) {
            if (i < 5) {
                pos = pos1;
                pos.setX(pos.x() + i * skip);
            } else {
                pos = pos2;
                pos.setX(pos.x() + (i - 5) * skip);
            }            
        } else {
            int half = (n + 1) / 2;
            qreal real_skip = whole_width / (half - 1);

            if (i < half) {
                pos = pos1;
                pos.setX(pos.x() + i * real_skip);
            } else {
                pos = pos2;
                pos.setX(pos.x() + (i - half) * real_skip);
            }        
        }      
        CardItem *item = items[i];
        item->setPos(pos);
        item->setHomePos(pos);
        item->setOpacity(1.0);
        item->setHomeOpacity(1.0);
        item->setFlag(QGraphicsItem::ItemIsFocusable);
        if (disabled_ids.contains(item->getCard()->getEffectiveId())) item->setEnabled(false);
        item->show();
    }    
}
开发者ID:SmartJam,项目名称:SELF_SGQ,代码行数:59,代码来源:cardcontainer.cpp


示例19: rand01

void Move::pivot(vector<vector<double>>* zn, vector<vector<double>> z) 
{
    vector<vector<double>> buff = *zn;
    double ver = 1;
    if (rand01(rng) < 0.5) ver = -1;
    double beta = rand01(rng) * PI * ver;   //max angle pi

    double teta = acos(rand01(rng)); 

    ver = 1;
    if (rand01(rng) < 0.5) ver = -1;
    double fi = rand01(rng) * PI * ver;   //max angle pi

    int nm = floor(rand01(rng) * (walkSize - 1));

    int maxI = walkSize - nm;
    vector<vector<double>> pos(walkSize, vector<double>(3, 0));
    vector<vector<double>> pos1(walkSize, vector<double>(3, 0));

    for (int i = 0; i < maxI; ++i)
        for (int j = 0; j < 3; ++j)
            pos[i][j] = z[nm + i][j] - z[nm][j];

    double rot[3][3];
    dir(cos(teta), sin(teta), cos(fi), sin(fi), cos(beta), sin(beta), rot);

    for (int i = 0; i < maxI; ++i) {
        for (int j = 0; j < 3; ++j) {
            double sum = 0;
            for (int k = 0; k < 3; ++k) {
                sum += rot[j][k] * pos[i][k];
            }
            pos1[i][j] = sum;
        }
    }

    inve(cos(teta), sin(teta), cos(fi), sin(fi), rot);

    for (int i = 0; i < maxI; ++i) {
        for (int j = 0; j < 3; ++j) {
            double sum = 0;
            for (int k = 0; k < 3; ++k) {
                sum += rot[j][k] * pos1[i][k];
            }
            pos[i][j] = sum;
        }
    }

    for (int i = 0; i < maxI; ++i)
        for (int j = 0; j < 3; ++j)
            buff[nm + i][j] = pos[i][j] + z[nm][j];

    if (nm != 0)
        for (int i = 0; i < nm; ++i)
            for (int j = 0; j < 3; ++j)
                buff[i][j] = z[i][j];
    
    *zn = buff;
}
开发者ID:claudejpschmit,项目名称:MSc-Simulation,代码行数:59,代码来源:move.cpp


示例20: pos1

void BotController::setGoal(float x, float y){
	x; y;
	if (x > 40 && x < 1000 && y>40 && y < 760){

	Vect pos1(x, y, 0, 1);
	goal = new Vect(x, y, 0, 1);
	newGoal = true;
	DebugMsg::out("setGoal :%f %f\n",x,y );
	}
}
开发者ID:geeosp,项目名称:IAProject,代码行数:10,代码来源:BotController.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pos2函数代码示例发布时间:2022-05-31
下一篇:
C++ port_to_gser函数代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap