本文整理汇总了C++中PolyLine::CurveLength方法的典型用法代码示例。如果您正苦于以下问题:C++ PolyLine::CurveLength方法的具体用法?C++ PolyLine::CurveLength怎么用?C++ PolyLine::CurveLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PolyLine
的用法示例。
在下文中一共展示了PolyLine::CurveLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildPatchFromShape
//.........这里部分代码省略.........
if(level == 0)
offset1 = offset;
else
if(level == levels)
offset2 = offset;
for(knot = 0; knot < knots; ++knot) {
Point3 p = spline->GetKnotPoint(knot);
pmesh.setVert(vert++, p + offset);
}
}
}
assert(vert == nverts);
BOOL usePhysUVs = GetUsePhysicalScaleUVs();
// Maybe create the texture vertices
if(texturing) {
int tvert = 0;
int level;
for(poly = 0; poly < polys; ++poly) {
Spline3D *spline = bShape.splines[poly];
if(!spline->KnotCount())
continue;
// Make it a polyline
PolyLine pline;
spline->MakePolyLine(pline, 10);
int knots = spline->KnotCount();
for(level = 0; level < TVlevels; ++level) {
float tV = (float)level / (float)(TVlevels - 1);
float vScale = usePhysUVs ? amount : 1.0f;
int lverts = pline.numPts;
int tp = 0;
int texPts = spline->Segments() + 1;
float cumLen = 0.0f;
float totLen = pline.CurveLength();
float uScale = usePhysUVs ? totLen : 1.0f;
Point3 prevPt = pline.pts[0].p;
int plix = 0;
while(tp < texPts) {
Point3 &pt = pline[plix].p;
cumLen += Length(pt - prevPt);
prevPt = pt;
if(pline[plix].flags & POLYPT_KNOT) {
float tU;
if(tp == (texPts - 1))
tU = 1.0f;
else
tU = cumLen / totLen;
pmesh.setTVert(tvert++, UVVert(uScale*tU, vScale*tV, 0.0f));
tp++;
}
plix = (plix + 1) % pline.numPts;
}
}
}
assert(tvert == ntverts);
}
// Create the vectors!
int seg;
int vec = 0;
for(poly = 0; poly < polys; ++poly) {
Spline3D *spline = bShape.splines[poly];
if(!spline->KnotCount())
continue;
int segs = spline->Segments();
int knots = spline->KnotCount();