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


C++ GetVector函数代码示例

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


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

示例1: Error

int CInterpreter::GetMove( void )
{
	CBlock	block;

	block.Create( ID_MOVE );

	if (!Match( TK_OPEN_PARENTHESIS ))
		return Error("syntax error : '(' not found");

	if ( GetVector( &block ) == false )
		return false;

	//Angles are optional
	if ( LookAhead( TK_VECTOR_START ) || LookAhead( TK_IDENTIFIER ) )
	{
		if ( GetVector( &block ) == false )
			return false;
	}

	if ( GetFloat( &block ) == false )
		return false;

	if (!Match( TK_CLOSED_PARENTHESIS ))
		return Error("move : too many parameters");

	m_blockStream->WriteBlock( &block );

	return true;
}
开发者ID:Aura15,项目名称:OpenJK,代码行数:29,代码来源:Interpreter.cpp

示例2: Apply

    TRef<IObject> Apply(ObjectStack& stack)
    {
        TRef<FrameDataListValue> plistValue = new FrameDataListValue();

        TRef<IObjectList> plist;
        CastTo(plist, (IObject*)stack.Pop());

        while (plist->GetCurrent()) {
            IObjectPair* ppair;
            CastTo(ppair, plist->GetCurrent());

            ZString strName     = GetString(ppair->GetNth(0));
            Vector  vecPosition = GetVector(ppair->GetNth(1));
            Vector  vecForward  = GetVector(ppair->GetNth(2));
            Vector  vecUp       = GetVector(ppair->GetLastNth(3));

            plistValue->GetList().PushEnd(
                FrameData(
                    strName,
                    vecPosition,
                    vecForward,
                    vecUp
                )
            );

            plist->GetNext();
        }

        return plistValue;
    }
开发者ID:FreeAllegiance,项目名称:Allegiance-R7-With-R4-Engine,代码行数:30,代码来源:efapp.cpp

示例3: main

int main () {
    
    while (true) {
        CellT * list1 = NULL;
        CellT * list2 = NULL;
        
        Vector<int> vector1 = GetVector("Give me a 1st list of numbers (-1 to quit)");
        list1 = ConvertToListR(vector1);
        PrintLinkedList(list1);
        cout << SumList(list1) << endl;
        
        Vector<int> vector2 = GetVector("Give me a 2nd list of numbers (-1 to quit)");
        list2 = ConvertToListR(vector2);
        PrintLinkedList(list2);
        cout << SumList(list2) << endl;
        
        cout << "Appending the list now..." << endl;
        //AppendList(list1, list2);
        Append(list1, list2);
        PrintLinkedList(list1);
        cout << SumList(list1) << endl;
        
        vector1.clear();
        vector2.clear();
        Deallocate(list1);
        //Deallocate(list2);
        
        cout << "******************** OK WE ARE DONE **********************" << endl;
    }
    
    return 0;
}
开发者ID:vincemansel,项目名称:Cpp_Daily_Code,代码行数:32,代码来源:linkedList-b-4-4.cpp

示例4: GetFCylinder

static errcode GetFCylinder(FILE * dfile) {
  apiflt rad;
  vector ctr, axis;
  vector pnt1, pnt2;
  void * tex;
  float a;
  errcode rc;

  rc = GetString(dfile, "BASE");
  rc |= GetVector(dfile, &pnt1);
  rc |= GetString(dfile, "APEX");
  rc |= GetVector(dfile, &pnt2);

  ctr=pnt1;
  axis.x=pnt2.x - pnt1.x; 
  axis.y=pnt2.y - pnt1.y;
  axis.z=pnt2.z - pnt1.z;

  rc |= GetString(dfile, "RAD");
  fscanf(dfile, "%f", &a);
  rad=a;

  rc |= GetTexture(dfile, &tex);
  rt_fcylinder(tex, ctr, axis, rad); 

  return rc;
}
开发者ID:annulen,项目名称:tbb-examples-premake,代码行数:27,代码来源:parse.cpp

示例5: GetFCylinder

static errcode GetFCylinder(parsehandle * ph, SceneHandle scene) {
  apiflt rad;
  apivector ctr, axis;
  apivector pnt1, pnt2;
  void * tex;
  float a;
  errcode rc;

  rc = GetString(ph, "BASE");
  rc |= GetVector(ph, &pnt1);
  rc |= GetString(ph, "APEX");
  rc |= GetVector(ph, &pnt2);

  ctr=pnt1;
  axis.x=pnt2.x - pnt1.x; 
  axis.y=pnt2.y - pnt1.y;
  axis.z=pnt2.z - pnt1.z;

  rc |= GetString(ph, "RAD");
  fscanf(ph->ifp, "%f", &a);
  rad=a;

  rc |= GetTexture(ph, scene, &tex);
  rt_fcylinder(scene, tex, ctr, axis, rad); 

  return rc;
}
开发者ID:phillipstanleymarbell,项目名称:sunflower-simulator,代码行数:27,代码来源:parse.c

示例6: return

float CTrack::GetVector(unsigned char sel, unsigned n) {

  KEY   kn_1, kn, kn1;
  float pn_1, pn, pn1;

  kn = keys[n];
  pn = kn.data;

  if (sel == 2) return pn;

  if (n == 0) {
    //first key
    kn1 = keys[1];
    pn1 = kn1.data;

    if (numkey == 2) {
      //2 keys
      return (pn1 - pn)*(1.0 - TENS);
    };
    if (!LOOP) {
      //first key, no loop
      return ((pn1 - pn)*1.5 - GetVector(0,1)*0.5)*(1.0 - TENS);
    } else {
      //first key, loop
      kn_1 = keys[numkey-2];
    };
  } else if (n == numkey-1) {
    //last key
    kn_1 = keys[n-1];
    pn_1 = kn_1.data;

    if (numkey == 2) {
      //2 keys
      return (pn - pn_1)*(1.0 - TENS);
    };
    if (!LOOP) {
      //last key, no loop
      return ((pn - pn_1)*1.5 - GetVector(1,n-1)*0.5)*(1.0 - TENS);
    } else {
      //last key, loop
      kn1 = keys[1];
    };
  } else {
    //middle keys
    kn_1= keys[n-1];
    kn1 = keys[n+1];
  };
  pn_1= kn_1.data;
  pn1 = kn1 .data;

  float f = (sel == 0) ? 0.5 : -0.5;

  float g1 = (pn  - pn_1)*(1.0 + BIAS);
  float g2 = (pn1 - pn  )*(1.0 - BIAS);

  return (g1 + (g2-g1)*(0.5 + f*CONT))*(1.0 - TENS);

}
开发者ID:lynxluna,项目名称:conspiracy,代码行数:58,代码来源:Track.cpp

示例7: GetSpotLight

static errcode GetSpotLight(parsehandle * ph, SceneHandle scene) {
  char tmp[255];
  apiflt rad, Kc, Kl, Kq;
  apivector ctr;
  apitexture tex;
  apivector direction;
  apiflt start, end;
  float r, g, b, a;
  errcode rc;
  void * li;

  memset(&tex, 0, sizeof(apitexture)); 

  rc = GetString(ph, "CENTER"); 
  rc |= GetVector(ph, &ctr); 
  rc |= GetString(ph,"RAD");
  fscanf(ph->ifp, "%f", &a);  /* read in radius */ 
  rad=a;
 
  rc |= GetString(ph, "DIRECTION"); 
  rc |= GetVector(ph, &direction); 
  rc |= GetString(ph, "FALLOFF_START");
  fscanf(ph->ifp, "%f",&a);
  start=a;
  rc |= GetString(ph, "FALLOFF_END");
  fscanf(ph->ifp, "%f", &a);
  end=a;
   
  fscanf(ph->ifp, "%s", tmp);
  if (!stringcmp(tmp, "COLOR")) {
    fscanf(ph->ifp, "%f %f %f", &r, &g, &b);
    tex.col.r=r;
    tex.col.g=g;
    tex.col.b=b;

    li = rt_spotlight(scene, rt_texture(scene, &tex), ctr, rad, direction, start, end);
  } 
  else {
    if (stringcmp(tmp, "ATTENUATION"))
      return -1;
    rc |= GetString(ph, "CONSTANT");
    fscanf(ph->ifp, "%f", &a);
    Kc=a;
    rc |= GetString(ph, "LINEAR");
    fscanf(ph->ifp, "%f", &a);
    Kl=a;
    rc |= GetString(ph, "QUADRATIC");
    fscanf(ph->ifp, "%f", &a);
    Kq=a;
    rc |= GetColor(ph, &tex.col);

    li = rt_spotlight(scene, rt_texture(scene, &tex), ctr, rad, direction, start, end);
    rt_light_attenuation(li, Kc, Kl, Kq);
  }

  return rc;
}
开发者ID:phillipstanleymarbell,项目名称:sunflower-simulator,代码行数:57,代码来源:parse.c

示例8: InitVectors

void  CTrack::InitVectors() {
 int i;
 if (numkey==1) return;
 for (i=0; i<numkey; i++) {
  keys[i].an=GetVector(0,i);
  keys[i].bn=GetVector(1,i);
 }

}
开发者ID:lynxluna,项目名称:conspiracy,代码行数:9,代码来源:Track.cpp

示例9: DenseDenseFeatureDotProduct

float DenseDenseFeatureDotProduct(const AbstractFeature<float>& f1,
    const AbstractFeature<float>& f2) {
  CHECK_EQ(f1.GetFeatureDim(), f2.GetFeatureDim());
  auto f1_dense_ptr = static_cast<const DenseFeature<float>*>(&f1);
  auto f2_dense_ptr = static_cast<const DenseFeature<float>*>(&f2);
  const std::vector<float>& v1 = f1_dense_ptr->GetVector();
  const std::vector<float>& v2 = f2_dense_ptr->GetVector();
  Eigen::Map<const Eigen::VectorXf> e1(v1.data(), v1.size());
  Eigen::Map<const Eigen::VectorXf> e2(v2.data(), v2.size());
  return e1.dot(e2);
}
开发者ID:chagge,项目名称:poseidon,代码行数:11,代码来源:math_util.cpp

示例10: WellOrdered

static PRBool WellOrdered(const void* addr1, const void* addr2,
                          const void *callsite2, PRUint32* index2p,
                          nsNamedVector** vec1p, nsNamedVector** vec2p)
{
    PRBool rv = PR_TRUE;
    PLHashTable* table = OrderTable;
    if (!table) return rv;
    PR_Lock(OrderTableLock);

    // Check whether we've already asserted (addr1 < addr2).
    nsNamedVector* vec1 = GetVector(table, addr1);
    if (vec1) {
        PRUint32 i, n;

        for (i = 0, n = vec1->Count(); i < n; i++)
            if (vec1->ElementAt(i) == addr2)
                break;

        if (i == n) {
            // Now check for (addr2 < addr1) and return false if so.
            nsNamedVector* vec2 = GetVector(table, addr2);
            if (vec2) {
                for (i = 0, n = vec2->Count(); i < n; i++) {
                    void* addri = vec2->ElementAt(i);
                    PR_ASSERT(addri);
                    if (addri == addr1 || Reachable(table, addr1, addri)) {
                        *index2p = i;
                        *vec1p = vec1;
                        *vec2p = vec2;
                        rv = PR_FALSE;
                        break;
                    }
                }

                if (rv) {
                    // Assert (addr1 < addr2) into the order table.
                    // XXX fix plvector/nsVector to use const void*
                    vec1->AppendElement((void*) addr2);
#ifdef NS_TRACE_MALLOC_XXX
                    vec1->mInnerSites.AppendElement((void*) callsite2);
#endif
                }
            }
        }
    }

    PR_Unlock(OrderTableLock);
    return rv;
}
开发者ID:fortunto2,项目名称:celtx,代码行数:49,代码来源:nsAutoLock.cpp

示例11: GetBox

static errcode GetBox(parsehandle * ph, SceneHandle scene) {
  apivector min, max;
  void * tex;
  errcode rc;

  rc = GetString(ph, "MIN");
  rc |= GetVector(ph, &min);
  rc |= GetString(ph, "MAX");
  rc |= GetVector(ph, &max);
  rc |= GetTexture(ph, scene, &tex);

  rt_box(scene, tex, min, max);

  return rc;
}
开发者ID:phillipstanleymarbell,项目名称:sunflower-simulator,代码行数:15,代码来源:parse.c

示例12: GetBox

static errcode GetBox(FILE * dfile) {
  vector min, max;
  void * tex;
  errcode rc;

  rc = GetString(dfile, "MIN");
  rc |= GetVector(dfile, &min);
  rc |= GetString(dfile, "MAX");
  rc |= GetVector(dfile, &max);
  rc |= GetTexture(dfile, &tex);

  rt_box(tex, min, max);

  return rc;
}
开发者ID:annulen,项目名称:tbb-examples-premake,代码行数:15,代码来源:parse.cpp

示例13: GetPlane

static errcode GetPlane(FILE * dfile) {
  vector normal;
  vector ctr;
  void * tex;
  errcode rc;

  rc = GetString(dfile, "CENTER");
  rc |= GetVector(dfile, &ctr);
  rc |= GetString(dfile, "NORMAL");
  rc |= GetVector(dfile, &normal);
  rc |= GetTexture(dfile, &tex);

  rt_plane(tex, ctr, normal);

  return rc;
}
开发者ID:annulen,项目名称:tbb-examples-premake,代码行数:16,代码来源:parse.cpp

示例14: GetPolyCylinder

static errcode GetPolyCylinder(FILE * dfile) {
  apiflt rad;
  vector * temp;
  void * tex;
  float a;
  int numpts, i;
  errcode rc;

  rc = GetString(dfile, "POINTS");
  fscanf(dfile, "%d", &numpts);

  temp = (vector *) malloc(numpts * sizeof(vector));

  for (i=0; i<numpts; i++) {
    rc |= GetVector(dfile, &temp[i]);
  }         

  rc |= GetString(dfile, "RAD");
  fscanf(dfile, "%f", &a);
  rad=a;

  rc |= GetTexture(dfile, &tex);
  rt_polycylinder(tex, temp, numpts, rad); 

  free(temp);

  return rc;
}
开发者ID:annulen,项目名称:tbb-examples-premake,代码行数:28,代码来源:parse.cpp

示例15: main

int main(int argc, char *argv[])
{
  FILE *picture, *picture_ref;
  int ref_block_num, width, height, graymax;;
  byte ref_block[16][16], *picture_blocks;
  int i, read;
  char buffer[100], *token, file_type[2];

  ref_block_num = atoi(argv[1]);
  picture_ref = fopen("lenna.pgm", "r");
  picture = fopen("lenna1.pgm", "r");

  fscanf(picture_ref, "%2c%d%d%d\n", file_type, &width, &height, &graymax);  //proèitaj header 
  fseek(picture_ref, 256 * ref_block_num , SEEK_CUR);                        //pozicioniraj se na odgovarajuæi referentni blok
  //printf("%d\n", ftell(picture_ref));
  fread(ref_block, sizeof(ref_block), 1, picture_ref);                     //proèitaj referentni blok

  fscanf(picture, "%2c%d%d%d\n", file_type, &width, &height, &graymax);  //proèitaj header
  picture_blocks = (byte*) malloc(width*height);                       //rezerviraj memoriju
  //printf("%d\n", ftell(picture));
  fread(picture_blocks, width*height, 1, picture);                     //uèitaj datoteku u memoriju

  GetVector(picture_blocks, width, height, ref_block, ref_block_num);

  free(picture_blocks);
  return 0;
}
开发者ID:bebox,项目名称:mas,代码行数:27,代码来源:tomislav_medved_dz2.cpp


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