本文整理汇总了C++中AddPoint函数的典型用法代码示例。如果您正苦于以下问题:C++ AddPoint函数的具体用法?C++ AddPoint怎么用?C++ AddPoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AddPoint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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();
}
示例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();
}
示例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);
}
}
示例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;
}
示例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);
}
示例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
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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]);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}