本文整理汇总了C++中SegmentList::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ SegmentList::Add方法的具体用法?C++ SegmentList::Add怎么用?C++ SegmentList::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SegmentList
的用法示例。
在下文中一共展示了SegmentList::Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FacetToSegmentsGorizon
void Convex::FacetToSegmentsGorizon(FacetList *FL, SegmentList *SL)
{
Facet *pF;
Segment S;
SegmentList SN;
if ( FL->GetFirst(&pF) )
{
// з кожної грані створюємо три ребра
do {
S.Init(pF->A, pF->B);
SN.Add(S);
S.Init(pF->A, pF->C);
SN.Add(S);
S.Init(pF->C, pF->B);
SN.Add(S);
} while (FL->GetNext(&pF));
// В список ребер горизонту включаємо лише зовнішні ребра видимої області
while(!SN.IsEmpty())
{
SN.Remove(&S);
if (SN.FindAndRemoveAll(S)==0)
{
SL->Add(S);
#ifdef CONVEX_DEBUG
printf( "Add to horizon : ");
S.PrintPoints();
#endif
};
};
};
}
示例2: AddCurve
/// arc in radians
void TrackData::AddCurve (SegmentList& segments, float arc, float radius, float end_width_l, float end_width_r)
{
arc = arc * PI/180.0f;
float length = fabs(arc) * radius;
int N = 1 + (int) floor(length/step);
float s = length / (float) N;
float d_width_l = (end_width_l - width_l) / (float) N;
float d_width_r = (end_width_r - width_r) / (float) N;
float d_angle = arc / (float) N;
float start_angle = angle;
float hpi = (float) (PI/2.0);
for (int i=0; i<N; ++i) {
mid.x += s*sin(angle);
mid.y += s*cos(angle);
Point left(mid.x + width_l*sin(angle - hpi),
mid.y + width_l*cos(angle - hpi),
mid.z);
Point right(mid.x + width_r*sin(angle + hpi),
mid.y + width_r*cos(angle + hpi),
mid.z);
segments.Add (Segment (left, right));
angle += d_angle;
width_l += d_width_l;
width_r += d_width_r;
}
width_l = end_width_l;
width_r = end_width_r;
angle = start_angle + arc;
}
示例3: DelVertexDoubles
void Convex::DelVertexDoubles(PointList *PL)
{
PointList PP;
Point P, L;
Segment S;
SegmentList SN;
if ( PL->GetFirst(&P) )
{
do {
PP.Add(P);
} while (PL->GetNext(&P));
};
if ( PL->GetFirst(&L) )
{
do {
if ( PP.GetFirst(&P) )
{
do {
S.Init(P, L);
SN.Add(S);
} while (PP.GetNext(&P));
};
} while (PL->GetNext(&L));
};
if ( PL->GetFirst(&P) )
{
do {
if ( SN.GetFirst(&S) )
{
do {
if (S.Into(P))
PL->FindAndRemoveAll(P);
} while (SN.GetNext(&S));
};
} while (PL->GetNext(&P));
};
}
示例4: AddStraight
void TrackData::AddStraight (SegmentList& segments, float length, float end_width_l, float end_width_r)
{
int N = 1 + (int) floor(length/step);
float s = length / (float) N;
float d_width_l = (end_width_l - width_l) / (float) N;
float d_width_r = (end_width_r - width_r) / (float) N;
float hpi = PI/2.0f;
for (int i=0; i<N; ++i) {
mid.x += s*sin(angle);
mid.y += s*cos(angle);
Point left(mid.x + width_l*sin(angle - hpi),
mid.y + width_l*cos(angle - hpi),
mid.z);
Point right(mid.x + width_r*sin(angle + hpi),
mid.y + width_r*cos(angle + hpi),
mid.z);
segments.Add (Segment (left, right));
width_l+=d_width_l;
width_r+=d_width_r;
}
width_l = end_width_l;
width_r = end_width_r;
}