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

C++ AddPoint函数代码示例

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

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



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

示例1: AddPoint

void FTContour::evaluateCubicCurve(FTPoint A, FTPoint B, FTPoint C, FTPoint D)
{
    for(unsigned int i = 0; i < BEZIER_STEPS; i++)
    {
        float t = static_cast<float>(i) / BEZIER_STEPS;

        FTPoint U = (1.0f - t) * A + t * B;
        FTPoint V = (1.0f - t) * B + t * C;
        FTPoint W = (1.0f - t) * C + t * D;

        FTPoint M = (1.0f - t) * U + t * V;
        FTPoint N = (1.0f - t) * V + t * W;

        AddPoint((1.0f - t) * M + t * N);
    }
}
开发者ID:xahgo,项目名称:tama,代码行数:16,代码来源:FTContour.cpp


示例2: ClearPoints

int DBrush::BuildPoints()
{
    ClearPoints();

    if(faceList.size() <= 3)	// if less than 3 faces, there can be no points
        return 0;					// with only 3 faces u can't have a bounded soild

    for(list<DPlane *>::const_iterator p1=faceList.begin(); p1!=faceList.end(); p1++)
    {
        list<DPlane *>::const_iterator p2=p1;
        for(p2++; p2!=faceList.end(); p2++)
        {
            list<DPlane *>::const_iterator p3=p2;
            for(p3++; p3!=faceList.end(); p3++)
            {
                vec3_t pnt;
                if((*p1)->PlaneIntersection(*p2, *p3, pnt))
                {
                    int pos = PointPosition(pnt);

                    if(pos == POINT_IN_BRUSH)
                    {   // ???? shouldn't happen here
                        Sys_Printf("ERROR:: Build Brush Points: Point IN brush!!!\n");
                    }
                    else if(pos == POINT_ON_BRUSH)
                    {   // normal point
                        if(!HasPoint(pnt))
                            AddPoint(pnt);
                        /*						else
                        							Sys_Printf("Duplicate Point Found, pyramids ahoy!!!!!\n");*/
                        // point lies on more that 3 planes
                    }

                    // otherwise point is removed due to another plane..

                    // Sys_Printf("(%f, %f, %f)\n", pnt[0], pnt[1], pnt[2]);
                }
            }
        }
    }

#ifdef _DEBUG
//	Sys_Printf("%i points on brush\n", pointList.size());
#endif

    return pointList.size();
}
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:47,代码来源:DBrush.cpp


示例3: GetnPoints

void Route::CloneTrack( Route *psourceroute, int start_nPoint, int end_nPoint, const wxString & suffix)
{
    if( psourceroute->m_bIsInLayer ) return;

    m_bIsTrack = psourceroute->m_bIsTrack;

    m_RouteNameString = psourceroute->m_RouteNameString + suffix;
    m_RouteStartString = psourceroute->m_RouteStartString;
    m_RouteEndString = psourceroute->m_RouteEndString;

    bool b_splitting = GetnPoints() == 0;

    int startTrkSegNo;
    if( b_splitting ) startTrkSegNo = psourceroute->GetPoint( start_nPoint )->m_GPXTrkSegNo;
    else
        startTrkSegNo = this->GetLastPoint()->m_GPXTrkSegNo;

    int i;
    for( i = start_nPoint; i <= end_nPoint; i++ ) {

        RoutePoint *psourcepoint = psourceroute->GetPoint( i );
        RoutePoint *ptargetpoint = new RoutePoint( psourcepoint->m_lat, psourcepoint->m_lon,
                psourcepoint->GetIconName(), psourcepoint->GetName(), GPX_EMPTY_STRING, false );

        AddPoint( ptargetpoint, false );
        
        //    This is a hack, need to undo the action of Route::AddPoint
        ptargetpoint->m_bIsInRoute = false;
        ptargetpoint->m_bIsInTrack = true;
        
        CloneAddedTrackPoint( m_pLastAddedPoint, psourcepoint );

        int segment_shift = psourcepoint->m_GPXTrkSegNo;

        if(  start_nPoint == 2 ) 
            segment_shift = psourcepoint->m_GPXTrkSegNo - 1; // continue first segment if tracks share the first point

        if( b_splitting )
            m_pLastAddedPoint->m_GPXTrkSegNo = ( psourcepoint->m_GPXTrkSegNo - startTrkSegNo ) + 1;
        else
            m_pLastAddedPoint->m_GPXTrkSegNo = startTrkSegNo + segment_shift;
    }

    FinalizeForRendering();

}
开发者ID:buya07,项目名称:KomodoExercise,代码行数:46,代码来源:Route.cpp


示例4: AddPoint

void TerrainFunction::ModifyVertex(const vec2& world_flat_pos, vec3& vertex) const {
	const float distance = world_flat_pos.GetDistance(position_);
	if (distance < outer_radius_) {
		// We made it!
		float _scale;
		if (distance <= inner_radius_) {
			// This point is inside, or on, the inner radius.
			_scale = 1;
		} else {
			// We linearly down-scale our method parameter. This does not necessarily mean
			// that the parameter is used in a linear fasion.
			_scale = 1-(distance-inner_radius_)/(outer_radius_-inner_radius_);
		}
		const vec2 relative_normalized_pos = (world_flat_pos - position_) / outer_radius_;
		AddPoint(relative_normalized_pos.x, relative_normalized_pos.y, _scale, distance, vertex);
	}
}
开发者ID:highfestiva,项目名称:life,代码行数:17,代码来源:terrainfunction.cpp


示例5: ssp

int CPointsCollection::EditPoint(int index, double x, double y, BOOL bRescan)
{
	if (index<0 || index>=GetSize()) return -1;
	int ret;
	SSinglePoint ssp(x, y);
	//if bSortX not specified - just replace given point
	RemovePoint(index, FALSE);
	if (!bSortX)
	{
		InsertPoint(index, ssp.x, ssp.y, bRescan);
		ret = index;
	} else
	{
		int res;
		ret = AddPoint(&ssp, bRescan, &res);
	};
	return ret;
}
开发者ID:Spritutu,项目名称:AiPI-1,代码行数:18,代码来源:points.cpp


示例6: RotateBlade4Covise

int RotateBlade4Covise(struct covise_info *ci, int nob)
{
	int i, j, ipol, ivx;
	int np, npol, nvx;
	int nstart, nend;
	float rot, roma[2][2];
	float x, y, z;

	np		   = ci->p->nump;
	npol	   = ci->pol->num;
	nvx		   = ci->vx->num;
	rot		   = 2 * M_PI / nob;
	roma[0][0] =  cos(rot);
	roma[0][1] = -sin(rot);
	roma[1][0] =  sin(rot);
	roma[1][1] =  cos(rot);

	for (i = 0; i < nob-1; i++) {
		nstart = i * np;
		nend   = nstart + np;
		// calculate rotated blade point coordinates
		for (j = nstart; j < nend; j++)
		{
			x = ci->p->x[j] * roma[0][0] + ci->p->y[j] * roma[0][1];
			y = ci->p->x[j] * roma[1][0] + ci->p->y[j] * roma[1][1];
			z = ci->p->z[j];
			AddPoint(ci->p, x, y, z);
		}
		// assign rotated polygon vertices
		for (j = i*nvx; j < (i+1)*nvx; j++)
		{
			ivx = ci->vx->list[j] + np;
			Add2Ilist(ci->vx, ivx);
		}
		// assign rotated polygon start vertices
		ipol = ci->pol->list[ci->pol->num-1];
		for (j = 0; j < npol; j++)
		{
			ipol  += 3;
			Add2Ilist(ci->pol, ipol);
		}
	}
	return(ci->p->nump);
}
开发者ID:dwickeroth,项目名称:covise,代码行数:44,代码来源:rr2cov.cpp


示例7: while

void Route::AssembleRoute( void )
{
    //    iterate over the RoutePointGUIDs
    for( unsigned int ip = 0; ip < RoutePointGUIDList.GetCount(); ip++ ) {
        wxString GUID = RoutePointGUIDList[ip];

        //    And on the RoutePoints themselves
        wxRoutePointListNode *prpnode = pWayPointMan->m_pWayPointList->GetFirst();
        while( prpnode ) {
            RoutePoint *prp = prpnode->GetData();

            if( prp->m_GUID == GUID ) {
                AddPoint( prp );
                break;
            }
            prpnode = prpnode->GetNext(); //RoutePoint
        }
    }
}
开发者ID:kheyse,项目名称:OpenCPN,代码行数:19,代码来源:Route.cpp


示例8: Mutate

    bool Mutate() {
        bool dirty = false;

        if (DoMutate(AddPointMutation))
            dirty |= AddPoint();
        if (DoMutate(DelPointMutation))
            dirty |= DelPoint();
        if (DoMutate(AlphaMutation))
            dirty |= Alpha(IntervalRand(Settings::AlphaMin, Settings::AlphaMax));

        if (DoMutate(ComponentMutation)) dirty |= RandomRed();
        if (DoMutate(ComponentMutation)) dirty |= RandomGreen();            
        if (DoMutate(ComponentMutation)) dirty |= RandomBlue();

        for (PointIt it = vertex_.begin(); it != vertex_.end(); ++it)
            dirty |= it->Mutate();

        return dirty;
    }
开发者ID:isadorasophia,项目名称:genetic_cu,代码行数:19,代码来源:genetic.cpp


示例9: AddPoint

// Add a new point to the class from an 3d-array. Works only if mCopyPtsCoords is set to true
int RandomSampler::AddPoint3d(double nCoordinate[]){

	if(!mCopyPtsCoords)
		return NULL;
	
	std::vector<float> *nCoordinatesVec = new std::vector<float>(3);
	(*nCoordinatesVec)[0] = (float) nCoordinate[0];
	(*nCoordinatesVec)[1] = (float) nCoordinate[1];
	(*nCoordinatesVec)[2] = (float) nCoordinate[2];
	mCopyPtsCoords = false;
	unsigned int toReturn = AddPoint(nCoordinatesVec);

	// No free space available
	if(toReturn == -1)
		delete nCoordinatesVec;

	mCopyPtsCoords = true;
	return toReturn;
}
开发者ID:OpenVehicleVision,项目名称:vpdetection,代码行数:20,代码来源:RandomSampler.cpp


示例10: AddPoint

void BattleGroundAB::Update(time_t diff)
{
    BattleGround::Update(diff);
    //If BG-Status = WAIT_JOIN, we must start BG
    if(GetStatus() == STATUS_WAIT_JOIN)
    {

    }
    if(GetStatus() == STATUS_IN_PROGRESS)
    {
        for(int i = 0;i < 5; i++)
            if(m_Points[i])                                 //If point is controled
                AddPoint(m_Points[i], diff);
        if(GetTeamScore(ALLIANCE) >= (2000*1000))           //1 score/per second
            EndBattleGround(ALLIANCE);
        if(GetTeamScore(HORDE) >= (2000*1000))              //1 score/per second
            EndBattleGround(HORDE);
    }
}
开发者ID:Artea,项目名称:mangos-svn,代码行数:19,代码来源:BattleGroundAB.cpp


示例11: AddPoint

void FTContour::evaluateQuadraticCurve()
{
    for( unsigned int i = 0; i <= ( 1.0f / BEZIER_STEP_SIZE); i++)
    {
        float bezierValues[2][2];

        float t = static_cast<float>(i) * BEZIER_STEP_SIZE;

        bezierValues[0][0] = (1.0f - t) * controlPoints[0][0] + t * controlPoints[1][0];
        bezierValues[0][1] = (1.0f - t) * controlPoints[0][1] + t * controlPoints[1][1];
    
        bezierValues[1][0] = (1.0f - t) * controlPoints[1][0] + t * controlPoints[2][0];
        bezierValues[1][1] = (1.0f - t) * controlPoints[1][1] + t * controlPoints[2][1];
        
        bezierValues[0][0] = (1.0f - t) * bezierValues[0][0] + t * bezierValues[1][0];
        bezierValues[0][1] = (1.0f - t) * bezierValues[0][1] + t * bezierValues[1][1];
    
        AddPoint( bezierValues[0][0], bezierValues[0][1]);
    }
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:20,代码来源:FTContour.cpp


示例12: BuildDelaunayTriangulation

void BuildDelaunayTriangulation(Vertex* pointSet, int numPoints, DelaunayTriangulation* dt)
{
  srand ( time(nullptr) );

  InitSuperSimplex(pointSet, numPoints, dt);
  AddSimplexToDelaunayTriangulation(dt, dt->m_AlphaSimplex);
  
  for (int i = 0; i < numPoints; i++)
  {
    AddPoint(&pointSet[i], dt);
    
    for (int j = 0; j < ArrayListSize(dt->m_Conflicts); j++)
      Push(dt->m_RemovedSimplices, GetFromArrayList(dt->m_Conflicts, j));    
    
    EmptyArrayList(dt->m_Conflicts);
    EmptyArrayList(dt->m_Updates);
    
    ResetNeighbourUpdates(dt->m_NeighbourUpdates);
  }
}
开发者ID:Globerus,项目名称:MagneticFieldVisualization,代码行数:20,代码来源:delaunayTriangulation.cpp


示例13: ReadSet

static struct dataset *
ReadSet(FILE *f, const char *n, int column, const char *delim)
{
	char buf[BUFSIZ], *p, *t;
	struct dataset *s;
	double d;
	int line;
	int i;

	s = NewSet();
	s->name = strdup(n);
	line = 0;
	while (fgets(buf, sizeof buf, f) != NULL) {
		line++;

		i = strlen(buf);
		while (i > 0 && isspace(buf[i - 1]))
			buf[--i] = '\0';
		for (i = 1, t = strtok(buf, delim);
		     t != NULL && *t != '#';
		     i++, t = strtok(NULL, delim)) {
			if (i == column)
				break;
		}
		if (t == NULL || *t == '#')
			continue;

		d = strtod(t, &p);
		if (p != NULL && *p != '\0')
			errx(2, "Invalid data on line %d in %s", line, n);
		if (*buf != '\0')
			AddPoint(s, d);
	}
	if (s->n < 3) {
		fprintf(stderr,
		    "Dataset %s must contain at least 3 data points\n", n);
		exit (2);
	}
	qsort(s->points, s->n, sizeof *s->points, dbl_cmp);
	return (s);
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:41,代码来源:ministat.c


示例14: AddRect

void UIView::ConvertStaticMappings(NIBWriter *writer, XIBObject *obj)
{
    if ( !_ignoreUIObject ) writer->_allUIObjects->AddMember(NULL, this);

    if ( _subviews->count() > 0 ) {
        int count = _subviews->count();
        for ( int i = 0; i < count; i ++ ) {
            XIBObject *curObj = _subviews->objectAtIndex(i);
            if ( !curObj->_ignoreUIObject ) writer->_allUIObjects->AddMember(NULL, curObj);
        }
    }

    AddRect(writer, "UIBounds", _bounds);
    AddPoint(writer, "UICenter", _center);
    if ( _contentStretch.x != 0.0f || _contentStretch.y != 0.0f || _contentStretch.width != 0.0f || _contentStretch.height != 0.0f ) {
        AddRect(writer, "UIContentStretch", _contentStretch);
    }

    Map(writer, obj, propertyMappings, numPropertyMappings);
    if ( _subviews->count() > 0 ) AddOutputMember(writer, "UISubviews", _subviews);
    if ( _constraints->count() > 0) AddOutputMember(writer, "UIViewAutolayoutConstraints", _constraints);

    if ( _autoresizeSubviews ) AddBool(writer, "UIAutoresizeSubviews", _autoresizeSubviews);
    if ( _autoresizingMask ) AddInt(writer, "UIAutoresizingMask", _autoresizingMask);
    if ( _clipsToBounds ) AddBool(writer, "UIClipsToBounds", _clipsToBounds);
    if ( _backgroundColor ) AddOutputMember(writer, "UIBackgroundColor", _backgroundColor);
    if ( _contentMode ) AddInt(writer, "UIContentMode", _contentMode);
    if ( _userInteractionDisabled ) AddBool(writer, "UIUserInteractionDisabled", _userInteractionDisabled);
    if ( _hidden ) AddBool(writer, "UIHidden", _hidden);
    if ( !_enabled ) AddBool(writer, "UIDisabled", true);
    if ( _multipleTouchEnabled ) AddBool(writer, "UIMultipleTouchEnabled", _multipleTouchEnabled);
    if ( !_clearsContextBeforeDrawing ) AddBool(writer, "UIClearsContextBeforeDrawing", _clearsContextBeforeDrawing);

    // Metadata
    if ( !_translatesAutoresizeToConstraints || !obj->GetBool("IBViewMetadataTranslatesAutoresizingMaskIntoConstraints", true) ) AddBool(writer, "UIViewDoesNotTranslateAutoresizingMaskIntoConstraints", true);

    if ( _opaque ) obj->AddBool(writer, "UIOpaque", _opaque);

    ObjectConverterSwapper::ConvertStaticMappings(writer, obj);
}
开发者ID:richardhxy,项目名称:WinObjC,代码行数:40,代码来源:UIView.cpp


示例15: wfopen

void CWaypoints::ReadWPT(const wchar_t * wcFilename)
{
	char buff[1000];
	FILE * pFile = wfopen(wcFilename, L"rt");
	if (pFile)
	{
		std::vector<long> vRecord;
		for (int i = 0; i < 4; ++i)
		{
			if (!fgets(buff, sizeof(buff), pFile))
				break;
		}
		std::vector<std::string> listParts;
		while(fgets(buff, sizeof(buff), pFile))
		{
			std::string strCommand = buff;
			listParts.resize(0);
			std::string::size_type pos = 0;
			std::string::size_type nextpos = 0;
			while ((nextpos = strCommand.find(',', pos)) != std::string::npos)
			{
				listParts.push_back(strCommand.substr(pos, nextpos - pos));
				pos = nextpos + 1;
			}
			listParts.push_back(strCommand.substr(pos));
			if (listParts.size() >= 15)
			{
				double dLatitude = myatof(listParts[2].c_str());
				double dLongitude = myatof(listParts[3].c_str());
				wchar_t buff[1000] = {0};
				MultiByteToWideChar(CP_ACP, 0, listParts[1].c_str(), -1, buff, 1000);
				int iRadius = atoi(listParts[13].c_str());
				int iAltitude = atoi(listParts[14].c_str());
				AddPoint(CPoint(dLongitude, dLatitude, iAltitude, buff), iRadius);
			}
		}
	}
	m_bCanWrite = true;
}
开发者ID:botanegg,项目名称:gpsvp,代码行数:39,代码来源:WayPoints.cpp


示例16: ReadPointStruct

int ReadPointStruct(struct Point *p, const char *sec, const char *fn)
{
    int i, num;
    float x, y, z;
    char *tmp;
    char key[127];

    num = 0;
    for (i = 0; ; i++)
    {
        sprintf(key, POINT, i);
        if ((tmp = IHS_GetCFGValue(fn, sec, key)) != NULL)
        {
            sscanf(tmp, "%f, %f, %f", &x, &y, &z);
            free(tmp);
            num = AddPoint(p, x, y, z);
        }
        else
            break;
    }
    return(num);
}
开发者ID:dwickeroth,项目名称:covise,代码行数:22,代码来源:points.cpp


示例17: switch

int CEveluation::GetRelatePiece(BYTE position[10][9], int j, int i)
{
	nPosCount = 0;
	BYTE nChessID;
	BYTE flag;
	int x,y;
	
	nChessID = position[i][j];
	switch(nChessID)
	{
	case R_KING:
	case B_KING:
		
		for (y = 0; y < 3; y++)
			for (x = 3; x < 6; x++)
				if (CanTouch(position, j, i, x, y))
					AddPoint(x, y);
		for (y = 7; y < 10; y++)
			for (x = 3; x < 6; x++)
				if (CanTouch(position, j, i, x, y))
					AddPoint(x, y);
		break;
						
	case R_BISHOP:
		
		for (y = 7; y < 10; y++)
			for (x = 3; x < 6; x++)
				if (CanTouch(position, j, i, x, y))
					AddPoint(x, y);
		break;
				
	case B_BISHOP:
		
		for (y = 0; y < 3; y++)
			for (x = 3; x < 6; x++)
				if (CanTouch(position, j, i, x, y))
					AddPoint(x, y);
		break;
				
	case R_ELEPHANT:
	case B_ELEPHANT:
		
		x=j+2;
		y=i+2;
		if(x < 9 && y < 10  && CanTouch(position, j, i, x, y))
			AddPoint(x, y);
		
		x=j+2;
		y=i-2;
		if(x < 9 && y>=0  &&  CanTouch(position, j, i, x, y))
			AddPoint(x, y);
		
		x=j-2;
		y=i+2;
		if(x>=0 && y < 10  && CanTouch(position, j, i, x, y))
			AddPoint(x, y);
		
		x=j-2;
		y=i-2;
		if(x>=0 && y>=0  && CanTouch(position, j, i, x, y))
			AddPoint(x, y);
		break;
		
		case R_HORSE:		
		case B_HORSE:		
			x=j+2;
			y=i+1;
			if((x < 9 && y < 10) &&CanTouch(position, j, i, x, y))
				AddPoint(x, y);
					
					x=j+2;
					y=i-1;
					if((x < 9 && y >= 0) &&CanTouch(position, j, i, x, y))
						AddPoint(x, y);
					
					x=j-2;
					y=i+1;
					if((x >= 0 && y < 10) &&CanTouch(position, j, i, x, y))
						AddPoint(x, y);
					
					x=j-2;
					y=i-1;
					if((x >= 0 && y >= 0) &&CanTouch(position, j, i, x, y))
						AddPoint(x, y);
					
					x=j+1;
					y=i+2;
					if((x < 9 && y < 10) &&CanTouch(position, j, i, x, y))
						AddPoint(x, y);
					x=j-1;
					y=i+2;
					if((x >= 0 && y < 10) &&CanTouch(position, j, i, x, y))
						AddPoint(x, y);
					x=j+1;
					y=i-2;
					if((x < 9 && y >= 0) &&CanTouch(position, j, i, x, y))
						AddPoint(x, y);
					x=j-1;
					y=i-2;
					if((x >= 0 && y >= 0) &&CanTouch(position, j, i, x, y))
//.........这里部分代码省略.........
开发者ID:yangxuanxc,项目名称:AIHomework,代码行数:101,代码来源:Eveluation.cpp


示例18: main

int main(void)
{
	Display *d;
	Window w;
	XEvent e;
	XWindowAttributes attr;

	int s;


	float x_max, y_max;

	int w_, h_,  delt;

	int i;
	int id1, id2, id3;
//	float kx, ky, kx_0, ky_0, kxa, kya, x, y;
	float kx, ky, kxa, kya, x, y;
	int fl =0;
	int fl1=0;
	int fl2=0;

	int flagg=0;
	FILE *file;
    file=fopen("data.txt","r");


	srand(time(NULL));

	

	if(flagg==1)
	{


	}

	if ( (file=fopen("data.txt", "r")) == NULL)
	{

		return -1;
	}

	/*N=0;
	while (fscanf(file, "%d %d", &i, &j) == 2)
		N++;
	fseek(file, 0L, SEEK_SET);
	* */

	 printf("[PIXEL DATA]\n");
	 /*
	point=(Point*)malloc(N*sizeof(Point));
	for (i=0; i<N; i++)
	{
		fscanf(file, "%f %f", &point[i].x, &point[i].y);
		printf("x, y = %f %f\n", point[i].x, point[i].y);
	}*/
	
	while (fscanf(file, "%f %f", &x, &y) ==2)
		AddPoint(x, y);
	
	printf("N=%d\n", N);
	if (N==0)
	{
		printf("N=0\n");
		exit(0);
	}	
	


	fclose(file);
	
	
/*
	x_min=point[0].x;
	y_min=point[0].y;

	x_max=point[0].x;
	y_max=point[0].y;

	for (i=0; i<N; i++)
	{
		if (point[i].x - x_min < eps)
			x_min=point[i].x;

		if (point[i].y - y_min < eps)
			y_min=point[i].y;

		if (point[i].x - x_max > eps)
			x_max=point[i].x;

		if (point[i].y - y_max > eps)
			y_max=point[i].y;
	}


	printf("\nxmin, ymin = %f %f\n", x_min, y_min);
	printf("xmax, ymax = %f %f\n", x_max, y_max);

	kx_0=float(x_max/x_min);
//.........这里部分代码省略.........
开发者ID:FruitClover,项目名称:Staroverov,代码行数:101,代码来源:XLib.cpp


示例19: while

void CXMLParser::TraverseGetInformation(TiXmlElement* root)
{
	TiXmlElement *childroot=root->FirstChildElement();
	while(childroot!=NULL)
	{
		if(strcmp(childroot->Value(),"VertexBuffer")==0)
		{
			char *pointStr=(char *)childroot->FirstChildElement()->GetText();
			AddPoint(pointStr);
			char *normalStr=(char *)childroot->FirstChildElement()->NextSiblingElement()->GetText();
			AddNormals(normalStr);
		}
		else if(strcmp(childroot->Value(),"Faces")==0)
		{
			TiXmlElement *triangleElem=childroot->FirstChildElement();
			while (triangleElem!=NULL)
			{
				if(strcmp(triangleElem->Value(),"Face")==0)
				{
					TiXmlAttribute *triangleAttribute=triangleElem->FirstAttribute();
					while(triangleAttribute!=NULL)
					{
						if(strcmp(triangleAttribute->Name(),"triangles")==0)
						{
							char *triangleStr=(char *)triangleAttribute->Value();
							if(IsTriangleStrWithSplit(triangleStr)==true)
							{
								AddTriangle(triangleStr);
							}
							else
							{
								AddIdTriangle(triangleStr);
							}
						}
						if(strcmp(triangleAttribute->Name(),"strips")==0)
						{
							char *stripStr=(char *)triangleAttribute->Value();
							AddStrips(stripStr);
						}
						if(strcmp(triangleAttribute->Name(),"fans")==0)
						{
							char *fanStr=(char *)triangleAttribute->Value();
							AddFans(fanStr);
						}
						triangleAttribute=triangleAttribute->Next();
					}
				}
				triangleElem=triangleElem->NextSiblingElement();
			}
		}
		else if(strcmp(childroot->Value(),"Edges")==0)
		{
			TiXmlElement *polyElem=childroot->FirstChildElement();
			while(polyElem!=NULL)
			{
				if(strcmp(polyElem->Value(),"Polyline")==0)
				{
					char *polyStr=(char *)polyElem->FirstAttribute()->Value();
					AddPoly(polyStr);
				}
				polyElem=polyElem->NextSiblingElement();
			}
		}
		/*else if (strcmp(childroot->Value(),"PolygonalLOD")==0)
		{
			TiXmlElement *triangleElem=childroot->FirstChildElement()->FirstChildElement();
			while (triangleElem!=NULL)
			{
				if(strcmp(triangleElem->Value(),"Face")==0)
				{
					TiXmlAttribute *triangleAttribute=triangleElem->FirstAttribute();
					while(triangleAttribute!=NULL)
					{
						if(strcmp(triangleAttribute->Name(),"triangles")==0)
						{
							char *triangleStr=(char *)triangleAttribute->Value();
							if(IsTriangleStrWithSplit(triangleStr)==true)
							{
								AddTriangle(triangleStr);
							}
							else
							{
								AddIdTriangle(triangleStr);
							}
						}
						if(strcmp(triangleAttribute->Name(),"strips")==0)
						{
							char *stripStr=(char *)triangleAttribute->Value();
							AddStrips(stripStr);
						}
						if(strcmp(triangleAttribute->Name(),"fans")==0)
						{
							char *fanStr=(char *)triangleAttribute->Value();
							AddFans(fanStr);
						}
						triangleAttribute=triangleAttribute->Next();
					}
				}
				triangleElem=triangleElem->NextSiblingElement();
			}
//.........这里部分代码省略.........
开发者ID:binhpt,项目名称:vltest,代码行数:101,代码来源:XMLParser.cpp


示例20: SetHordeFlagPicker

void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
{
    if (GetStatus() != STATUS_IN_PROGRESS)
        return;

    m_LastCapturedFlagTeam = Source->GetTeam();

    uint32 winner = 0;

    Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
    if (Source->HasAura(BG_WS_SPELL_FOCUSED_ASSAULT))
        Source->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
    if (Source->HasAura(BG_WS_SPELL_BRUTAL_ASSAULT))
        Source->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT);
    if (Source->GetTeam() == ALLIANCE)
    {
        if (!IsHordeFlagPickedup())
            return;
        SetHordeFlagPicker(0);                              // must be before aura remove to prevent 2 events (drop+capture) at the same time
                                                            // horde flag in base (but not respawned yet)
        m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
                                                            // Drop Horde Flag from Player
        Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
        if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
            AddPoint(ALLIANCE, 1);
        PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
        RewardReputationToTeam(BATTLEGROUND_WS, m_ReputationCapture, ALLIANCE);
    }
    else
    {
        if (!IsAllianceFlagPickedup())
            return;
        SetAllianceFlagPicker(0);                           // must be before aura remove to prevent 2 events (drop+capture) at the same time
                                                            // alliance flag in base (but not respawned yet)
        m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
                                                            // Drop Alliance Flag from Player
        Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
        if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
            AddPoint(HORDE, 1);
        PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
        RewardReputationToTeam(BATTLEGROUND_WS, m_ReputationCapture, HORDE);
    }
    //for flag capture is reward 2 honorable kills
    RewardHonorToTeam(GetBonusHonorFromKill(sWorld.getConfig(CONFIG_UINT32_BONUS_HONOR_FLAG_WSG)), Source->GetTeam());
    RewardXpToTeam(0, 0.6f, Source->GetTeam());

    //flag carrier gets another 2 honorable kills
    Source->RewardHonor(NULL, 0, GetBonusHonorFromKill(sWorld.getConfig(CONFIG_UINT32_BONUS_HONOR_FLAG_WSG)));

    // despawn flags
    SpawnEvent(WS_EVENT_FLAG_A, 0, false);
    SpawnEvent(WS_EVENT_FLAG_H, 0, false);

    if (Source->GetTeam() == ALLIANCE)
        SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
    else
        SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);

    UpdateFlagState(Source->GetTeam(), 1);                  // flag state none
    UpdateTeamScore(Source->GetTeam());
    // only flag capture should be updated
    UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1);      // +1 flag captures
    Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE,1);

    if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
        winner = ALLIANCE;

    if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
        winner = HORDE;

    if (winner)
    {
        UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
        UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
        UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1);
        UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1);

        EndBattleGround(winner);
    }
    else
    {
        m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
    }
}
开发者ID:Archives,项目名称:try,代码行数:84,代码来源:BattleGroundWS.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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