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


C++ Classify函数代码示例

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


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

示例1: CalcRectVolume

RTREE_TEMPLATE
void RTREE_QUAL::PickSeeds(PartitionVars* a_parVars) {
    int seed0, seed1;
    ELEMTYPEREAL worst, waste;
    ELEMTYPEREAL area[MAXNODES + 1];

    for (int index = 0; index < a_parVars->m_total; ++index) {
        area[index] = CalcRectVolume(&a_parVars->m_branchBuf[index].m_rect);
    }

    worst = -a_parVars->m_coverSplitArea - 1;
    for (int indexA = 0; indexA < a_parVars->m_total - 1; ++indexA) {
        for (int indexB = indexA + 1; indexB < a_parVars->m_total; ++indexB) {
            Rect oneRect = CombineRect(&a_parVars->m_branchBuf[indexA].m_rect, &a_parVars->m_branchBuf[indexB].m_rect);
            waste = CalcRectVolume(&oneRect) - area[indexA] - area[indexB];
            if (waste > worst) {
                worst = waste;
                seed0 = indexA;
                seed1 = indexB;
            }
        }
    }

    Classify(seed0, 0, a_parVars);
    Classify(seed1, 1, a_parVars);
}
开发者ID:msupernaw,项目名称:FisheriesModelingFramework,代码行数:26,代码来源:RTree.hpp

示例2: ASSERT

RTREE_TEMPLATE
void RTREE_QUAL::ChoosePartition(PartitionVars* a_parVars, int a_minFill) {
    ASSERT(a_parVars);

    ELEMTYPEREAL biggestDiff;
    int group, chosen, betterGroup;

    InitParVars(a_parVars, a_parVars->m_branchCount, a_minFill);
    PickSeeds(a_parVars);

    while (((a_parVars->m_count[0] + a_parVars->m_count[1]) < a_parVars->m_total)
            && (a_parVars->m_count[0] < (a_parVars->m_total - a_parVars->m_minFill))
            && (a_parVars->m_count[1] < (a_parVars->m_total - a_parVars->m_minFill))) {
        biggestDiff = (ELEMTYPEREAL) - 1;
        for (int index = 0; index < a_parVars->m_total; ++index) {
            if (PartitionVars::NOT_TAKEN == a_parVars->m_partition[index]) {
                Rect* curRect = &a_parVars->m_branchBuf[index].m_rect;
                Rect rect0 = CombineRect(curRect, &a_parVars->m_cover[0]);
                Rect rect1 = CombineRect(curRect, &a_parVars->m_cover[1]);
                ELEMTYPEREAL growth0 = CalcRectVolume(&rect0) - a_parVars->m_area[0];
                ELEMTYPEREAL growth1 = CalcRectVolume(&rect1) - a_parVars->m_area[1];
                ELEMTYPEREAL diff = growth1 - growth0;
                if (diff >= 0) {
                    group = 0;
                } else {
                    group = 1;
                    diff = -diff;
                }

                if (diff > biggestDiff) {
                    biggestDiff = diff;
                    chosen = index;
                    betterGroup = group;
                } else if ((diff == biggestDiff) && (a_parVars->m_count[group] < a_parVars->m_count[betterGroup])) {
                    chosen = index;
                    betterGroup = group;
                }
            }
        }
        Classify(chosen, betterGroup, a_parVars);
    }

    // If one group too full, put remaining rects in the other
    if ((a_parVars->m_count[0] + a_parVars->m_count[1]) < a_parVars->m_total) {
        if (a_parVars->m_count[0] >= a_parVars->m_total - a_parVars->m_minFill) {
            group = 1;
        } else {
            group = 0;
        }
        for (int index = 0; index < a_parVars->m_total; ++index) {
            if (PartitionVars::NOT_TAKEN == a_parVars->m_partition[index]) {
                Classify(index, group, a_parVars);
            }
        }
    }

    ASSERT((a_parVars->m_count[0] + a_parVars->m_count[1]) == a_parVars->m_total);
    ASSERT((a_parVars->m_count[0] >= a_parVars->m_minFill) &&
            (a_parVars->m_count[1] >= a_parVars->m_minFill));
}
开发者ID:msupernaw,项目名称:FisheriesModelingFramework,代码行数:60,代码来源:RTree.hpp

示例3: switch

//----------------------------------------------------------------------------
void BspTree2::GetPartition (const BspPolygon2& polygon, const Vector2d& v0,
    const Vector2d& v1, BspPolygon2& pos, BspPolygon2& neg,
    BspPolygon2& coSame, BspPolygon2& coDiff) const
{
    // Construct splitting line from first coincident edge.
    Vector2d end0 = polygon.mVArray[mCoincident[0].I0];
    Vector2d end1 = polygon.mVArray[mCoincident[0].I1];

    Vector2d intr;

    switch (Classify(end0, end1, v0, v1, intr))
    {
    case TRANSVERSE_POSITIVE:
        GetPosPartition(polygon, intr, v1, pos, neg, coSame, coDiff);
        GetNegPartition(polygon, v0, intr, pos, neg, coSame, coDiff);
        break;
    case TRANSVERSE_NEGATIVE:
        GetPosPartition(polygon, v0, intr, pos, neg, coSame, coDiff);
        GetNegPartition(polygon, intr, v1, pos, neg, coSame, coDiff);
        break;
    case ALL_POSITIVE:
        GetPosPartition(polygon, v0, v1, pos, neg, coSame, coDiff);
        break;
    case ALL_NEGATIVE:
        GetNegPartition(polygon, v0, v1, pos, neg, coSame, coDiff);
        break;
    default:  // COINCIDENT
        GetCoPartition(polygon, v0, v1, pos, neg, coSame, coDiff);
        break;
    }
}
开发者ID:rasslingcats,项目名称:calico,代码行数:32,代码来源:BspTree2.cpp

示例4: character

Permonkey::Permonkey(float x, float y, Point lTile, TileMap tileMap, unordered_map<string, vector<string>> objList) : character("img/permacaco_anim_ss.png", 4, -1, 4), tileMap(tileMap),
step("music/passo_et_verde.wav") {
    box = Rect(x-character.GetWidth()/2,y-character.GetHeight(), character.GetWidth(), character.GetHeight());
	rotation = 0;
	roomID = 0;
	crt = 0;
	objective.x = 994;
	objective.y = 470;
	tile = lTile;
	actionCharacter = RESTING;
	choice = NO_CHOICE;
	timer.Restart();
	rest.Restart();

	hunger = rand()%21;
	money = rand()%900+101;
	found = true;
	satisfaction = 50;

	preference = "Pirate";
	roomChoice = "";
	actualGoal = 0;

	Classify(objList);

	gone = false;
	

	objectSelect = -1;
	
	
}
开发者ID:guilhermeanselmo2,项目名称:Universales,代码行数:32,代码来源:Permonkey.cpp

示例5: Classify

bool IntrLine2Segment2<Real>::Find ()
{
    Vector2<Real> kDiff;
    Real afParameter[2];
    m_iIntersectionType = Classify(afParameter,&kDiff,0);

    if (m_iIntersectionType == IT_POINT)
    {
        // Test whether the line-line intersection is on the segment.
        if (Math<Real>::FAbs(afParameter[1]) <= m_pkSegment->Extent)
        {
            m_iQuantity = 1;
            m_kPoint = m_pkLine->Origin + afParameter[0]*m_pkLine->Direction;
        }
        else
        {
            m_iQuantity = 0;
            m_iIntersectionType = IT_EMPTY;
        }
    }
    else if (m_iIntersectionType == IT_SEGMENT)
    {
        m_iQuantity = INT_MAX;
    }
    else
    {
        m_iQuantity = 0;
    }

    return m_iIntersectionType != IT_EMPTY;
}
开发者ID:rms80,项目名称:libgeometry,代码行数:31,代码来源:Wm4IntrLine2Segment2.cpp

示例6: Classify

bool IntrLine2Ray2<Real>::Find ()
{
    Vector2<Real> diff;
    Real parameter[2];
    mIntersectionType = Classify(parameter, &diff, 0);

    if (mIntersectionType == IT_POINT)
    {
        // Test whether the line-line intersection is on the ray.
        if (parameter[1] >= (Real)0)
        {
            mQuantity = 1;
            mPoint = mLine->Origin + parameter[0]*mLine->Direction;
        }
        else
        {
            mQuantity = 0;
            mIntersectionType = IT_EMPTY;
        }
    }
    else if (mIntersectionType == IT_RAY)
    {
        mQuantity = INT_MAX;
    }
    else
    {
        mQuantity = 0;
    }

    return mIntersectionType != IT_EMPTY;
}
开发者ID:fishxz,项目名称:omni-bot,代码行数:31,代码来源:Wm5IntrLine2Ray2.cpp

示例7: Classify

// Classify polygon with respect to this plane
int RebPlane::Classify(const RebPolygon &Poly) {
   int NumFront=0, NumBack=0, NumPlanar=0;
   int nClass;

   // cast away const
   RebPolygon *pPoly = ((RebPolygon*)&Poly);

   int NumPoints = pPoly->GetNumPoints();

   // loop through all points
   for (int i=0; i < NumPoints; i++) {
      nClass = Classify( pPoly->m_pPoints[i] );
      
      if (nClass == RebFRONT)     NumFront++;
      else if (nClass == RebBACK) NumBack++;
      else {
         NumFront++;
         NumBack++;
         NumPlanar++;
         }
      } // for
   
   // all points are planar
   if (NumPlanar == NumPoints)
      return RebPLANAR;
   // all points are in front of plane
   else if (NumFront == NumPoints)
      return RebFRONT;
   // all points are on backside of plane
   else if (NumBack == NumPoints)
      return RebBACK;
   // poly is intersecting the plane
   else
      return RebCLIPPED;
   } // Classify
开发者ID:felrugo,项目名称:Rebeka-LTE,代码行数:36,代码来源:Rebplane.cpp

示例8: Classify

bool IntrSegment2Segment2<Real>::Find ()
{
    Vector2<Real> diff;
    Real parameter[2];
    mIntersectionType = Classify(parameter, &diff, 0);

    if (mIntersectionType == IT_POINT)
    {
        // Test whether the line-line intersection is on the segments.
        if (Math<Real>::FAbs(parameter[0]) <= mSegment0->Extent
        &&  Math<Real>::FAbs(parameter[1]) <= mSegment1->Extent)
        {
            mQuantity = 1;
            mPoint = mSegment0->Center + parameter[0]*mSegment0->Direction;
        }
        else
        {
            mQuantity = 0;
            mIntersectionType = IT_EMPTY;
        }
    }
    else if (mIntersectionType == IT_SEGMENT)
    {
        mQuantity = INT_MAX;
    }
    else
    {
        mQuantity = 0;
    }

    return mIntersectionType != IT_EMPTY;
}
开发者ID:fishxz,项目名称:omni-bot,代码行数:32,代码来源:Wm5IntrSegment2Segment2.cpp

示例9: QuickClassification

ICopyFilterOption::EResult
CRemovePathsBySubString::ShallRemove (const CFullGraphNode* node) const
{
    // short-cut

    if (filterPaths.empty())
        return ICopyFilterOption::KEEP_NODE;

    // path to classify

    const CDictionaryBasedTempPath& path = node->GetPath();

    // most paths can be filtered quickly using the classification cache

    PathClassification classification = QuickClassification (path.GetBasePath());

    // take a closer look if necessary

    if ((classification != REMOVE) && !path.IsFullyCachedPath())
        classification = Classify (path.GetPath());

    // return the result

    return classification == REMOVE
        ? removeSubTrees ? ICopyFilterOption::REMOVE_SUBTREE
                         : ICopyFilterOption::REMOVE_NODE
        : ICopyFilterOption::KEEP_NODE;
}
开发者ID:TortoiseGit,项目名称:tortoisesvn,代码行数:28,代码来源:RemovePathsBySubString.cpp

示例10: Classify

bool IntrRay2Segment2<Real>::Find ()
{
    Vector2<Real> diff;
    Real parameter[2];
    mIntersectionType = Classify(parameter, &diff, 0);

    if (mIntersectionType == IT_POINT)
    {
        // Test whether the line-line intersection is on the ray and on the
        // segment.
        if (parameter[0] >= (Real)0
        &&  Math<Real>::FAbs(parameter[1]) <= mSegment->Extent)
        {
            mQuantity = 1;
            mPoint = mRay->Origin + parameter[0]*mRay->Direction;
        }
        else
        {
            mQuantity = 0;
            mIntersectionType = IT_EMPTY;
        }
    }
    else if (mIntersectionType == IT_SEGMENT)
    {
        mQuantity = INT_MAX;
    }
    else
    {
        mQuantity = 0;
    }

    return mIntersectionType != IT_EMPTY;
}
开发者ID:JackTing,项目名称:SkpColl,代码行数:33,代码来源:Wm5IntrRay2Segment2.cpp

示例11: Classify

bool IntrLine2Segment2<Real>::Test ()
{
    Vector2<Real> diff;
    Real parameter[2];
    mIntersectionType = Classify(parameter, &diff, 0);

    if (mIntersectionType == IT_POINT)
    {
        // Test whether the line-line intersection is on the segment.
        if (Math<Real>::FAbs(parameter[1]) <= mSegment->Extent)
        {
            mQuantity = 1;
        }
        else
        {
            mQuantity = 0;
            mIntersectionType = IT_EMPTY;
        }
    }
    else if (mIntersectionType == IT_SEGMENT)
    {
        mQuantity = INT_MAX;
    }
    else
    {
        mQuantity = 0;
    }

    return mIntersectionType != IT_EMPTY;
}
开发者ID:fishxz,项目名称:omni-bot,代码行数:30,代码来源:Wm5IntrLine2Segment2.cpp

示例12: Classify

int Classify(Image* img) {
	int sum = 0;
	for (int i = 0 ; i < featureSize ; i++) {
		sum += Classify(img, i);
	}
	return sum >= 0 ? 1 : -1;
}
开发者ID:lyx-x,项目名称:MPIBoostingDetection,代码行数:7,代码来源:Classifier.cpp

示例13: HasAlienGibs

//LRC - work out gibs from blood colour, instead.
BOOL CBaseMonster :: HasAlienGibs( void )
{
	int myClass = Classify();

	// these types of monster don't use gibs
	if ( myClass == CLASS_NONE || myClass == CLASS_MACHINE ||
		 myClass == CLASS_PLAYER_BIOWEAPON && myClass == CLASS_ALIEN_BIOWEAPON)
	{
		return FALSE;
	}
	else
	{
		return (this->m_bloodColor == BLOOD_COLOR_GREEN);
	}

//	int myClass = Classify();
//
//	if ( myClass == CLASS_ALIEN_MILITARY ||
//		 myClass == CLASS_ALIEN_MONSTER	||
//		 myClass == CLASS_ALIEN_PASSIVE  ||
//		 myClass == CLASS_INSECT  ||
//		 myClass == CLASS_ALIEN_PREDATOR  ||
//		 myClass == CLASS_ALIEN_PREY )
//
//		 return TRUE;
//
//	return FALSE;
}
开发者ID:RichardRohac,项目名称:hl-amnesia-src,代码行数:29,代码来源:combat.cpp

示例14: Train

void Train(perceptron_t *p, int *inputs, int classification)
{
	int error = classification - Classify(p, inputs);
	for (int i = 0; i < 2; i++)
	{
		p->weights[i] += p->learningRate * (float) error * *(inputs + i);
	}
}
开发者ID:vexcode-2015,项目名称:Team-2442A,代码行数:8,代码来源:perceptron.c

示例15: LearnCV

int LearnCV(TMatrix input,  TVariables output, unsigned int minFeatures, unsigned int upToPower, unsigned int folds, TPoint *ray, unsigned int *power){
	bool oldOUT_ALPHA = OUT_ALPHA;
	OUT_ALPHA = false;
	unsigned int optDegree = 0;
	unsigned int optError = INT_MAX;
	unsigned int shortFolds = folds - 1;

	/* Get the optimal degree (outer cross-validation loop) */
	vector<TMatrix> spaceExtensions(upToPower);
	for (unsigned int i = 0; i < upToPower; i++){
		ExtendWithProducts(input, i + 1, &spaceExtensions[i]); // get the (i + 1)-th space extention
		Initialization(spaceExtensions[i], output, minFeatures); // initialize
		/* Prepare slider and start to cut data */
		unsigned sliderSize = (unsigned)ceil((double)n / folds); unsigned chSizeVal = n%folds - 1;
		TMatrix xSlider(sliderSize); TVariables ySlider(sliderSize);
		for (unsigned int j = 0; j < sliderSize; j++){
			xSlider[j] = TPoint(d);
			for (unsigned int k = 0; k < d; k++){xSlider[j][k] = x[k][j*shortFolds]; x[k].erase(x[k].begin() + j*shortFolds);}
			ySlider[j] = y[j*shortFolds]; y.erase(y.begin() + j*shortFolds);
			difference -= ySlider[j]; if (ySlider[j] > 0){numMore--;}else{numLess--;}			
		}
		n -= sliderSize;
		/* Cross-validation for the (i + 1)-th space extension (inner cross-validation loop) */
		unsigned int error = 0; TPoint p(0);
		double tmpXSliderVal; int tmpYSliderVal;
		for (unsigned int j = 0; j < folds; j++){
			/* Estimate the current cut */			
			Alpha(&p);
			TVariables res(0);
			Classify(xSlider, p, &res);
			for (unsigned int k = 0; k < sliderSize; k++){error += abs(res[k] - ySlider[k])/2;}
			/* Increment the pointer */
			if (j == shortFolds){break;}
			/* Replace the slider */
			if (j == chSizeVal){
				for (unsigned int l = 0; l < d; l++){x[l].push_back(xSlider[sliderSize - 1][l]);} y.push_back(ySlider[sliderSize - 1]);
				n++; difference += ySlider[sliderSize - 1]; if (ySlider[sliderSize - 1] > 0){numMore++;}else{numLess++;}
				sliderSize--; xSlider.erase(xSlider.begin() + sliderSize); ySlider.erase(ySlider.begin() + sliderSize);
//				for (unsigned int j = 0; j < d; j++){x[j].shrink_to_fit();} y.shrink_to_fit(); - IT IS TOO DANGEROUS
			}
			for (unsigned int k = 0; k < sliderSize; k++){
				for (unsigned int l = 0; l < d; l++){tmpXSliderVal = x[l][k*shortFolds + j]; x[l][k*shortFolds + j] = xSlider[k][l]; xSlider[k][l] = tmpXSliderVal;}
				difference += ySlider[k]; if (ySlider[k] > 0){numMore++;}else{numLess++;}
				tmpYSliderVal = y[k*shortFolds + j]; y[k*shortFolds + j] = ySlider[k]; ySlider[k] = tmpYSliderVal;
				difference -= ySlider[k]; if (ySlider[k] > 0){numMore--;}else{numLess--;}
			}
		}
		/* Check if we've got a better result */ 
		if (error < optError){optError = error; optDegree = i + 1; if (optError == 0){break;}}
	}

	OUT_ALPHA = oldOUT_ALPHA;
	/* Eventually get the classification ray */
	Initialization(spaceExtensions[optDegree - 1], output, minFeatures); // initialize
	power[0] = optDegree;
	return Alpha(ray);
}
开发者ID:cran,项目名称:ddalpha,代码行数:57,代码来源:AlphaProcedure.cpp


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