这篇教程C++ AddPoint函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AddPoint函数的典型用法代码示例。如果您正苦于以下问题:C++ AddPoint函数的具体用法?C++ AddPoint怎么用?C++ AddPoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AddPoint函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: AddPointvoid 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,
示例2: ClearPointsint 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,
示例3: GetnPointsvoid 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,
示例4: AddPointvoid 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,
示例5: sspint 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,
示例6: RotateBlade4Coviseint 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,
示例7: whilevoid 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,
示例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,
示例9: AddPoint// Add a new point to the class from an 3d-array. Works only if mCopyPtsCoords is set to trueint 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,
示例10: AddPointvoid 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,
示例11: AddPointvoid 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,
示例12: BuildDelaunayTriangulationvoid 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,
示例13: ReadSetstatic 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,
示例14: AddRectvoid 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,
示例15: wfopenvoid 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,
示例16: ReadPointStructint 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,
示例17: switchint 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,
示例18: mainint 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,
示例19: whilevoid 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,
示例20: SetHordeFlagPickervoid 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,
示例21: SetHordeFlagPickervoid BattlegroundTP::EventPlayerCapturedFlag(Player *Source){ if (GetStatus() != STATUS_IN_PROGRESS) return; uint32 winner = 0; Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if (Source->GetTeam() == ALLIANCE) { if (!this->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_TP_FLAG_STATE_WAIT_RESPAWN; // Drop Horde Flag from Player Source->RemoveAurasDueToSpell(BG_TP_SPELL_HORDE_FLAG); if (m_FlagDebuffState == 1) Source->RemoveAurasDueToSpell(TP_SPELL_FOCUSED_ASSAULT); if (m_FlagDebuffState == 2) Source->RemoveAurasDueToSpell(TP_SPELL_BRUTAL_ASSAULT); if (GetTeamScore(ALLIANCE) < BG_TP_MAX_TEAM_SCORE) AddPoint(ALLIANCE, 1); PlaySoundToAll(BG_TP_SOUND_FLAG_CAPTURED_ALLIANCE); RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE); } else { if (!this->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_TP_FLAG_STATE_WAIT_RESPAWN; // Drop Alliance Flag from Player Source->RemoveAurasDueToSpell(BG_TP_SPELL_ALLIANCE_FLAG); if (m_FlagDebuffState == 1) Source->RemoveAurasDueToSpell(TP_SPELL_FOCUSED_ASSAULT); if (m_FlagDebuffState == 2) Source->RemoveAurasDueToSpell(TP_SPELL_BRUTAL_ASSAULT); if (GetTeamScore(HORDE) < BG_TP_MAX_TEAM_SCORE) AddPoint(HORDE, 1); PlaySoundToAll(BG_TP_SOUND_FLAG_CAPTURED_HORDE); RewardReputationToTeam(889, m_ReputationCapture, HORDE); } //for flag capture is reward 2 honorable kills RewardHonorToTeam(GetBonusHonorFromKill(2), Source->GetTeam()); SpawnBGObject(BG_TP_OBJECT_H_FLAG, BG_TP_FLAG_RESPAWN_TIME); SpawnBGObject(BG_TP_OBJECT_A_FLAG, BG_TP_FLAG_RESPAWN_TIME); if (Source->GetTeam() == ALLIANCE) SendMessageToAll(LANG_BG_TP_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source); else SendMessageToAll(LANG_BG_TP_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 // update last flag capture to be used if teamscore is equal SetLastFlagCapture(Source->GetTeam()); if (GetTeamScore(ALLIANCE) == BG_TP_MAX_TEAM_SCORE) winner = ALLIANCE; if (GetTeamScore(HORDE) == BG_TP_MAX_TEAM_SCORE) winner = HORDE; if (winner) { UpdateWorldState(BG_TP_FLAG_UNK_ALLIANCE, 0); UpdateWorldState(BG_TP_FLAG_UNK_HORDE, 0); UpdateWorldState(BG_TP_FLAG_STATE_ALLIANCE, 1); UpdateWorldState(BG_TP_FLAG_STATE_HORDE, 1); UpdateWorldState(BG_TP_STATE_TIMER_ACTIVE, 0); RewardHonorToTeam(BG_TP_Honor[m_HonorMode][BG_TP_WIN], winner); EndBattleground(winner); } else { m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_TP_FLAG_RESPAWN_TIME; }}
开发者ID:Ekmek,项目名称:Antiker,代码行数:85,
示例22: BufferAppendLRESULT CIMoteTerminal::OnReceiveSerialData(WPARAM wParam, LPARAM lParam){ //following couple of lines allow us to debug a raw datastream char *rxstring = (char *)lParam; DWORD numBytesReceived = (DWORD) wParam; BufferAppend(rxstring, numBytesReceived); delete []rxstring; return TRUE;#if 0 DWORD i,offset; //TRACE("Rx...Buffer = %#X/tNumBytesReceived = %d/n",rxstring,numBytesReceived); /***** data format for the accelerometer data looks something like: 0{2 bit addr}{5 data bits} {1}{7 data bits} ******/ for(offset=0; offset<numBytesReceived; offset++) { //find the correct first bytes if((rxstring[offset] & 0xE0) == 0) { break; } } //offset current points to the correct first element for us to look at //start reconstructing the 16 bit numbers and doing the divide for(i=offset;(i+6)<numBytesReceived; i+=6) { static bool init = false; POINT point; DWORD B,C,D,Tx, Ty,T; int Rx, Ry; B = ((rxstring[i] & 0x1F)<<7) | (rxstring[i+1] & 0x7F); C = ((rxstring[i+2] & 0x1F)<<7) | (rxstring[i+3] & 0x7F); D = ((rxstring[i+4] & 0x1F)<<7) | (rxstring[i+5] & 0x7F); Tx = B; Ty = D-C; T = C/2 + D/2 - B/2; Rx = ((Tx << 16) / T) - (65536/2); Ry = ((Ty << 16) / T) - (65536/2); //point.x =(LONG)( (rxstring[byte_index]<<8) + rxstring[byte_index+1]) -(65536/2); //point.x = (LONG)( (rxstring[byte_index]<<8) + rxstring[byte_index+1]); //TRACE("%d %d = %d/n",rxstring[i], rxstring[i+1], point.x); //TRACE("Found T, index %d /n", byte_index); //TRACE("Tx = %d, Ty = %d, T = %d, Rx = %d, Ry = %d/n",Tx, Ty, T, Rx, Ry); point.x = (LONG) Rx; point.y = (LONG) Ry; if(!init) { CIMoteCartesianPlot *pFrame=CreateNewView(0,0xDEADBEEF,0); pFrame->SetMappingFunction(-2,2); init = true; } AddPoint(point, 0); } delete rxstring; return TRUE;//#endif; POINT point; static bool bGotBeef = 0; static bool bFirstTime = true; static unsigned short NumDataBytes; static unsigned short NumBytesProcessed; //static int MoteIDs[NUMCHANNELS]; static unsigned short SensorID; static unsigned int MoteID; static unsigned int SensorType; static unsigned int ExtraInfo; static unsigned int TimeID; static unsigned int ChannelID; static unsigned char HeaderIndex; static unsigned char Header[16]; unsigned short *short_ptr; unsigned int *int_ptr; DWORD byte_index; static unsigned char LastByte = 0;// unsigned int ProblemIndex; unsigned int EmptyChannel; static unsigned int NumProblems = 0; CString logentry; static bool bPrintheader=true; CTime time; static int Tx, Ty, T, Rx, Ry, Tb, Tc, Td, b0, b1; static int CurrentCounter, CurrentByte; // Hack, for now statically allocate static unsigned char *CameraBuffer; static unsigned int CurrentCameraID; static unsigned int CameraBufferIndex; static unsigned int SegmentIndex; static bool PictureInProgress; static unsigned int LastPicID;#define MAX_PIC_SIZE 80000#define INVALID_SENSOR 0//.........这里部分代码省略.........
开发者ID:saurabhd14,项目名称:tinyos-1.x,代码行数:101,
示例23: GenerateTerrain/* * GenerateTerrain * * Create random mountain peaks that are used to generate the * background terrain. */void GenerateTerrain (){ int peakx; int peaky; GList *mountainList = NULL; GList *node; typMountain *prevMountain; typMountain *mtn; int i; /* --- Compute the peaks --- */ for (i = 0; i < NUM_PEAKS; i++) { peakx = rand () % X_RANGE; peaky = rand () % MAX_PEAK; mountainList = AddMountain (mountainList, peakx, peaky); } prevMountain = NULL; terrainList = AddPoint (terrainList, 0, 0); /* --- Compute the lines based on the peaks --- */ for (node = mountainList; node; node = node->next) { mtn = (typMountain *) node->data; /* --- First mountain --- */ if (prevMountain == NULL) { terrainList = AddPoint (terrainList, mtn->start.x, mtn->start.y); terrainList = AddPoint (terrainList, mtn->peak.x, mtn->peak.y); prevMountain = mtn; /* --- Don't cross paths --- */ } else if (prevMountain->end.x < mtn->start.x) { terrainList = AddPoint (terrainList, prevMountain->end.x, prevMountain->end.y); terrainList = AddPoint (terrainList, mtn->start.x, mtn->start.y); terrainList = AddPoint (terrainList, mtn->peak.x, mtn->peak.y); prevMountain = mtn; /* --- previous mountain eats this one --- */ } else if (prevMountain->end.x > mtn->end.x) { /* --- Do nothing yet --- */ } else { /* --- Mountains intersect --- */ terrainList = AddPoint (terrainList, (prevMountain->end.x + mtn->start.x) / 2, (prevMountain->end.x - mtn->start.x) / 2); terrainList = AddPoint (terrainList, mtn->peak.x, mtn->peak.y); prevMountain = mtn; } } terrainList = AddPoint (terrainList, prevMountain->end.x, prevMountain->end.y); terrainList = AddPoint (terrainList, X_RANGE, 0);}
开发者ID:EVODelavega,项目名称:gtk-examples,代码行数:68,
示例24: AddPointvoid box2::FromPoints(vec2 *points, int numpoints){ for (int i = 0; i < numpoints; i++) AddPoint(points[i]);}
开发者ID:brycekelleher,项目名称:doombsp,代码行数:5,
示例25: ClearHordeFlagCarriervoid BattleGroundWS::EventPlayerCapturedFlag(Player* source){ if (GetStatus() != STATUS_IN_PROGRESS) return; Team winner = TEAM_NONE; source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if (source->GetTeam() == ALLIANCE) { if (!IsHordeFlagPickedUp()) return; ClearHordeFlagCarrier(); // 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[TEAM_INDEX_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(890, m_ReputationCapture, ALLIANCE); } else { if (!IsAllianceFlagPickedUp()) return; ClearAllianceFlagCarrier(); // 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[TEAM_INDEX_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(889, m_ReputationCapture, HORDE); } // for flag capture is reward distributed according level range RewardHonorToTeam(BG_WSG_FlagCapturedHonor[GetBracketId()], source->GetTeam()); // 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 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[GetOtherTeamIndex(GetTeamIndex(source->GetTeam()))] = BG_WS_FLAG_RESPAWN_TIME; }}
开发者ID:zeroR2,项目名称:mangos,代码行数:74,
注:本文中的AddPoint函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AddPointToBounds函数代码示例 C++ AddPendingEvent函数代码示例 |