本文整理汇总了C++中CArea::append方法的典型用法代码示例。如果您正苦于以下问题:C++ CArea::append方法的具体用法?C++ CArea::append怎么用?C++ CArea::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArea
的用法示例。
在下文中一共展示了CArea::append方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_obround
static CArea make_obround(const Point& p0, const Point& p1, double radius)
{
Point dir = p1 - p0;
double d = dir.length();
dir.normalize();
Point right(dir.y, -dir.x);
CArea obround;
CCurve c;
if(fabs(radius) < 0.0000001)radius = (radius > 0.0) ? 0.002 : (-0.002);
Point vt0 = p0 + right * radius;
Point vt1 = p1 + right * radius;
Point vt2 = p1 - right * radius;
Point vt3 = p0 - right * radius;
c.append(vt0);
c.append(vt1);
c.append(CVertex(1, vt2, p1));
c.append(vt3);
c.append(CVertex(1, vt0, p0));
obround.append(c);
return obround;
}
示例2: CurveIntersections
void CCurve::CurveIntersections(const CCurve& c, std::list<Point> &pts)const
{
CArea a;
a.append(*this);
a.CurveIntersections(c, pts);
}
示例3: Offset
bool CCurve::Offset(double leftwards_value)
{
// use the kurve code donated by Geoff Hawkesford, to offset the curve as an open curve
// returns true for success, false for failure
bool success = true;
CCurve save_curve = *this;
try
{
geoff_geometry::Kurve k = MakeKurve(*this);
geoff_geometry::Kurve kOffset;
int ret = 0;
k.OffsetMethod1(kOffset, fabs(leftwards_value), (leftwards_value > 0) ? 1:-1, 1, ret);
success = (ret == 0);
if(success)*this = MakeCCurve(kOffset);
}
catch(...)
{
success = false;
}
if(success == false)
{
if(this->IsClosed())
{
double inwards_offset = leftwards_value;
bool cw = false;
if(this->IsClockwise())
{
inwards_offset = -inwards_offset;
cw = true;
}
CArea a;
a.append(*this);
a.Offset(inwards_offset);
if(a.m_curves.size() == 1)
{
Span* start_span = NULL;
if(this->m_vertices.size() > 1)
{
std::list<CVertex>::iterator It = m_vertices.begin();
CVertex &v0 = *It;
It++;
CVertex &v1 = *It;
start_span = new Span(v0.m_p, v1, true);
}
*this = a.m_curves.front();
if(this->IsClockwise() != cw)this->Reverse();
if(start_span)
{
Point forward = start_span->GetVector(0.0);
Point left(-forward.y, forward.x);
Point offset_start = start_span->m_p + left * leftwards_value;
this->ChangeStart(this->NearestPoint(offset_start));
delete start_span;
}
success = true;
}
}
}
return success;
}
示例4:
ThickLine(const CCurve& curve)
{
m_curve = curve;
m_area.append(curve);
m_area.Thicken(0.001);
}