本文整理汇总了C++中YsArray类的典型用法代码示例。如果您正苦于以下问题:C++ YsArray类的具体用法?C++ YsArray怎么用?C++ YsArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了YsArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetUpRoundConstEdge
YSRESULT YsShellExt_RoundUtil::SetUpRoundConstEdge(const YsShellExt &shl,YsShellExt::ConstEdgeHandle ceHd,const YsShellVertexStore *roundVtx)
{
YsArray <YsShellVertexHandle> ceVtHd;
YSBOOL isLoop;
shl.GetConstEdge(ceVtHd,isLoop,ceHd);
if(YSTRUE==isLoop && 3>ceVtHd.GetN())
{
return YSERR;
}
else if(YSTRUE!=isLoop && 2>ceVtHd.GetN())
{
return YSERR;
}
if(YSTRUE==isLoop)
{
ceVtHd.Append(ceVtHd[0]);
ceVtHd.Append(ceVtHd[1]);
}
for(YSSIZE_T idx=1; idx<ceVtHd.GetN()-1; ++idx)
{
if(NULL==roundVtx || YSTRUE==roundVtx->IsIncluded(ceVtHd[idx]))
{
const YsShellVertexHandle toVtHd[2]={ceVtHd[idx-1],ceVtHd[idx+1]};
AddRoundCorner((const YsShell &)shl,ceVtHd[idx],toVtHd);
}
}
targetCeKeyArray.Append(shl.GetSearchKey(ceHd));
return YSOK;
}
示例2:
YSRESULT YsShellExt_RoundUtil3d::CalculateRoundingDirectionAll(const YsShell &shl)
{
YsArray <HalfRoundCorner *> cornerPtrArray=MakeSortedHalfRoundCorner(shl);
YsArray <HalfRoundCorner *> cornerPerVertex;
for(YSSIZE_T idx=0; idx<cornerPtrArray.GetN(); ++idx)
{
cornerPerVertex.Append(cornerPtrArray[idx]);
if(cornerPtrArray.GetN()-1==idx || cornerPtrArray[idx]->fromVtHd!=cornerPtrArray[idx+1]->fromVtHd)
{
const YsVec3 roundDir=CalculateRoundingDirction(shl,cornerPerVertex);
if(YsOrigin()==roundDir)
{
return YSERR;
}
for(auto ptr : cornerPerVertex)
{
ptr->roundDir=roundDir;
}
cornerPerVertex.CleanUp();
}
}
return YSOK;
}
示例3: AddFaceGroup
YSSIZE_T YsShellExt_DuplicateUtil::AddFaceGroup(YsShellExt::FaceGroupHandle fgHd,YSBOOL derived)
{
const YSSIZE_T newIdx=faceGroupArray.GetN();
auto &last=faceGroupArray.New();
last.srcFgHd=fgHd;
YsArray <YsShellPolygonHandle,4> plHdArray;
srcShl->GetFaceGroup(plHdArray,fgHd);
last.polygonArray.Set(plHdArray.GetN(),NULL);
for(YSSIZE_T plIdx=0; plIdx<plHdArray.GetN(); ++plIdx)
{
YsArray <YSSIZE_T> found;
plHdMap.FindMapping(found,*srcShl,plHdArray[plIdx]);
if(0<found.GetN())
{
last.polygonArray[plIdx]=found[0];
}
else
{
last.polygonArray[plIdx]=AddPolygon(plHdArray[plIdx],YSTRUE);
}
}
last.attrib=srcShl->GetFaceGroupAttrib(fgHd);
last.derived=derived;
fgHdMap.AddMapping(*srcShl,fgHd,newIdx);
return newIdx;
}
示例4: AddVolume
YSSIZE_T YsShellExt_DuplicateUtil::AddVolume(YsShellExt::VolumeHandle vlHd,YSBOOL derived)
{
const YSSIZE_T newIdx=volumeArray.GetN();
auto &last=volumeArray.New();
last.srcVlHd=vlHd;
YsArray <YsShellExt::FaceGroupHandle,4> fgHdArray;
srcShl->GetVolume(fgHdArray,vlHd);
last.faceGroupArray.Set(fgHdArray.GetN(),NULL);
for(YSSIZE_T plIdx=0; plIdx<fgHdArray.GetN(); ++plIdx)
{
YsArray <YSSIZE_T> found;
fgHdMap.FindMapping(found,*srcShl,fgHdArray[plIdx]);
if(0<found.GetN())
{
last.faceGroupArray[plIdx]=found[0];
}
else
{
last.faceGroupArray[plIdx]=AddFaceGroup(fgHdArray[plIdx],YSTRUE);
}
}
last.attrib=srcShl->GetVolumeAttrib(vlHd);
last.derived=derived;
vlHdMap.AddMapping(*srcShl,vlHd,newIdx);
return newIdx;
}
示例5: AddConstEdge
YSSIZE_T YsShellExt_DuplicateUtil::AddConstEdge(YsShellExt::ConstEdgeHandle ceHd,YSBOOL derived)
{
const YSSIZE_T newIdx=constEdgeArray.GetN();
auto &last=constEdgeArray.New();
last.srcCeHd=ceHd;
YsArray <YsShellVertexHandle,4> vtHdArray;
srcShl->GetConstEdge(vtHdArray,last.isLoop,ceHd);
last.vertexArray.Set(vtHdArray.GetN(),NULL);
for(YSSIZE_T vtIdx=0; vtIdx<vtHdArray.GetN(); ++vtIdx)
{
YsArray <YSSIZE_T> found;
vtHdMap.FindMapping(found,*srcShl,vtHdArray[vtIdx]);
if(0<found.GetN())
{
last.vertexArray[vtIdx]=found[0];
}
else
{
last.vertexArray[vtIdx]=AddVertex(vtHdArray[vtIdx],YSTRUE);
}
}
last.attrib=srcShl->GetConstEdgeAttrib(ceHd);
last.derived=derived;
ceHdMap.AddMapping(*srcShl,ceHd,newIdx);
return newIdx;
}
示例6: AddPolygon
YSSIZE_T YsShellExt_DuplicateUtil::AddPolygon(YsShellPolygonHandle plHd,YSBOOL derived)
{
const YSSIZE_T newIdx=polygonArray.GetN();
auto &last=polygonArray.New();
last.srcPlHd=plHd;
YsArray <YsShellVertexHandle,4> plVtHd;
srcShl->GetPolygon(plVtHd,plHd);
last.vertexArray.Set(plVtHd.GetN(),NULL);
for(YSSIZE_T vtIdx=0; vtIdx<plVtHd.GetN(); ++vtIdx)
{
YsArray <YSSIZE_T> found;
vtHdMap.FindMapping(found,*srcShl,plVtHd[vtIdx]);
if(0<found.GetN())
{
last.vertexArray[vtIdx]=found[0];
}
else
{
last.vertexArray[vtIdx]=AddVertex(plVtHd[vtIdx],YSTRUE);
}
}
last.attrib=(*srcShl->GetPolygonAttrib(plHd));
srcShl->GetColor(last.col,plHd);
srcShl->GetNormal(last.nom,plHd);
last.derived=derived;
plHdMap.AddMapping(*srcShl,plHd,newIdx);
return newIdx;
}
示例7: ful
/* static */ void PolyCreFileName::MakeDirectoryForFile(const wchar_t wfn[])
{
YsWString ful(wfn),pth,fil;
ful.SeparatePathFile(pth,fil);
ful=pth;
YsArray <YsWString> backTrack;
for(;;)
{
if(ful.LastChar()=='\\' || ful.LastChar()=='/')
{
ful.BackSpace();
}
printf("%ls\n",ful.Txt());
backTrack.Append(ful);
YsWString pth,fil;
ful.SeparatePathFile(pth,fil);
if(0<pth.Strlen() && 0<fil.Strlen())
{
ful=pth;
}
else
{
break;
}
}
for(YSSIZE_T idx=backTrack.GetN()-1; 0<=idx; --idx)
{
printf("MkDir %ls\n",backTrack[idx].Txt());
YsFileIO::MkDir(backTrack[idx]);
}
}
示例8: RunParallel
YSRESULT YsThreadController::RunParallel(int nTask,YsThreadTask *task[])
{
if(0>=nTask)
{
return YSOK;
}
int i;
for(i=0; i<nTask; i++)
{
task[i]->taskId=i;
task[i]->sta=YSTHREADTASKSTATE_IDLE;
}
if(1==nTask)
{
task[0]->EntryPoint();
return YSOK;
}
YsArray <pthread_t,16> hThread;
hThread.Set(nTask,0);
for(i=0; i<nTask; i++)
{
pthread_create(&hThread[i],NULL,YsPthreadLaunch,(void *)task[i]);
}
for(i=0; i<nTask; i++)
{
pthread_join(hThread[i],NULL);
}
// Do I have to clean threads? Does pthread_destory exist?
return YSOK;
}
示例9: LoadSrf
YSRESULT YsShell::LoadSrf(
FILE *fp,YsArray <YsShellPolygonHandle> *noShadingPolygon,YsArray <YsShellVertexHandle> *roundVtx)
{
if(NULL!=fp)
{
YsArray <YsString,16> args;
if(noShadingPolygon!=NULL)
{
noShadingPolygon->Set(0,NULL);
}
if(roundVtx!=NULL)
{
roundVtx->Set(0,NULL);
}
if(BeginReadSrf()==YSOK)
{
YsString str;
while(str.Fgets(fp)!=NULL)
{
if(ReadSrfOneLine(str,noShadingPolygon,roundVtx)!=YSOK)
{
str.Arguments <16> (args);
if(args.GetN()>0)
{
YSBOOL srmExtension;
srmExtension=YSFALSE;
args[0].Capitalize();
switch(args[0][0])
{
case 'G': // GE, GL, GF
case 'Z': // ZE, ZF, ZNBE,ZNBF, ZT, ZA, ZZ, ZH, ZU
case 'Y': // YE, YF, YN, Y1
case 'M': // M
case 'C': // CV
case 'X': // X
case 'L': // LF, LE, LL
srmExtension=YSTRUE;
break;
}
if(srmExtension!=YSTRUE)
{
return YSERR;
}
}
}
}
EndReadSrf();
return YSOK;
}
}
return YSERR;
}
示例10:
YsArray <YsShellVertexHandle> YsShellExt_SweepInfo::GetVertexAll(void) const
{
YsArray <YsShellVertexHandle> vtHdArray;
for(auto vtHd : allSrcVtHd)
{
vtHdArray.Append(vtHd);
}
return vtHdArray;
}
示例11: CleanUp
void YsShellExt_SweepInfo::MakeInfo(
const YsShellExt &shl,
YSSIZE_T nPl,const YsShellPolygonHandle plHdArray[],
YSSIZE_T nCe,const YsShellExt::ConstEdgeHandle ceHdArray[])
{
CleanUp();
YsShellExt_BoundaryInfo::MakeInfo(*(const YsShell *)&shl,nPl,plHdArray);
allSrcVtHd.SetShell((const YsShell &)shl);
for(YSSIZE_T idx=0; idx<nPl; ++idx)
{
YsArray <YsShellVertexHandle,4> plVtHd;
shl.GetPolygon(plVtHd,plHdArray[idx]);
for(auto vtHd : plVtHd)
{
allSrcVtHd.AddVertex(vtHd);
}
}
for(YSSIZE_T idx=0; idx<nCe; ++idx)
{
YsArray <YsShellVertexHandle,4> ceVtHd;
YSBOOL isLoop;
shl.GetConstEdge(ceVtHd,isLoop,ceHdArray[idx]);
for(auto vtHd : ceVtHd)
{
allSrcVtHd.AddVertex(vtHd);
}
}
for(YSSIZE_T ceIdx=0; ceIdx<nCe; ++ceIdx)
{
YSBOOL isLoop;
YsArray <YsShellVertexHandle,16> ceVtHd;
shl.GetConstEdge(ceVtHd,isLoop,ceHdArray[ceIdx]);
if(2<=ceVtHd.GetN())
{
if(YSTRUE==isLoop)
{
YsShellVertexHandle first=ceVtHd[0];
ceVtHd.Append(first);
}
for(int edIdx=0; edIdx<ceVtHd.GetN()-1; ++edIdx)
{
if(YSTRUE!=visited.IsIncluded(ceVtHd[edIdx],ceVtHd[edIdx+1]))
{
visited.AddEdge(ceVtHd[edIdx],ceVtHd[edIdx+1]);
srcEdVtHd.Append(ceVtHd[edIdx]);
srcEdVtHd.Append(ceVtHd[edIdx+1]);
}
}
}
}
}
示例12: while
/* virtual */ void FsLazyWindowApplication::GetOpenWindowOption(FsOpenWindowOption &opt) const
{
opt.x0=96;
opt.y0=0;
opt.wid=1200;
opt.hei=640;
auto *cfg=PolyCreConfig::Create();
auto *fileAndDirName=PolyCreFileName::Create();
cfg->Load(fileAndDirName->GetOptionFileName());
if(YSTRUE==cfg->saveWindowPositionAndSize)
{
auto wposFn=fileAndDirName->GetLastWindowPositionFileName();
FILE *fp=YsFileIO::Fopen(wposFn,"r");
if(NULL!=fp)
{
YsString str;
while(NULL!=str.Fgets(fp))
{
YsArray <YsString> args;
str.Arguments(args);
if(0==strcmp(args[0],"POS") && 5<=args.GetN())
{
opt.x0=atoi(args[1]);
opt.y0=atoi(args[2]);
opt.wid=atoi(args[3]);
opt.hei=atoi(args[4]);
if(0>opt.x0)
{
opt.x0=0;
}
if(0>opt.y0)
{
opt.y0=0;
}
if(120>opt.wid)
{
opt.wid=120;
}
if(120>opt.hei)
{
opt.hei=120;
}
}
}
fclose(fp);
}
}
PolyCreConfig::Delete(cfg);
PolyCreFileName::Delete(fileAndDirName);
}
示例13:
YsArray <YsShellExt::FaceGroupHandle> YsShellExt_DuplicateUtil::GetNonDerivedNewFaceGroup(void) const
{
YsArray <YsShellExt::FaceGroupHandle> ary;
for(auto elem : faceGroupArray)
{
if(YSTRUE!=elem.derived)
{
ary.Append(elem.newFgHd);
}
}
return ary;
}
示例14:
void YsBoundingBoxMaker2::Make(const YsArray <YsVec2> &ary)
{
if(ary.GetNumItem()>0)
{
Begin(ary.GetItem(0));
}
int i;
for(i=0; i<ary.GetNumItem(); i++)
{
Add(ary.GetItem(i));
}
}
示例15: va_start
int YsString::Printf(const char *fom,...)
{
const int trialBufSize=256;
char buf[trialBufSize];
va_list arg_ptr;
va_start(arg_ptr,fom);
const int n=vsnprintf(buf,trialBufSize,fom,arg_ptr);
va_end(arg_ptr);
if(n<0)
{
// This compiler s**ks! It's not C99 compliant! (I'm talking about Visual C++ 2008)
int bufSize=trialBufSize*2;
YsArray <char> buf;
for(;;)
{
buf.Set(bufSize,NULL);
va_start(arg_ptr,fom);
const int n=vsnprintf(buf,bufSize,fom,arg_ptr);
va_end(arg_ptr);
if(0<=n && n<bufSize)
{
YsArray <char,16>::Set(n+1,buf);
return n;
}
bufSize*=2;
}
}
else if(n<trialBufSize)
{
YsArray <char,16>::Set(n+1,buf);
return n;
}
else
{
// Good compiler! It is C99 Compliant.
char *buf=new char [n+1];
va_start(arg_ptr,fom);
vsnprintf(buf,n+1,fom,arg_ptr);
va_end(arg_ptr);
YsArray <char,16>::Set(n+1,buf);
delete [] buf;
return n;
}
}