本文整理汇总了C++中YsArray::GetN方法的典型用法代码示例。如果您正苦于以下问题:C++ YsArray::GetN方法的具体用法?C++ YsArray::GetN怎么用?C++ YsArray::GetN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YsArray
的用法示例。
在下文中一共展示了YsArray::GetN方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6:
YSRESULT YsShellExt_RoundUtil3d::CalculateRoundingAll(const YsShell &shl,const double radius)
{
YsArray <unsigned int> vtKeyArray;
YsArray <HalfRoundCorner *> cornerPtrArray;
for(auto &corner : cornerArray)
{
vtKeyArray.Append(shl.GetSearchKey(corner.fromVtHd));
cornerPtrArray.Append(&corner);
}
YsQuickSort <unsigned int,HalfRoundCorner *> (vtKeyArray.GetN(),vtKeyArray,cornerPtrArray);
YsArray <HalfRoundCorner *> cornerPerVertex;
for(YSSIZE_T idx=0; idx<cornerPtrArray.GetN(); ++idx)
{
cornerPerVertex.Append(cornerPtrArray[idx]);
if(cornerPtrArray.GetN()-1==idx || vtKeyArray[idx]!=vtKeyArray[idx+1])
{
if(YSOK!=CalculateRoundingPerVertex(shl,cornerPerVertex,radius))
{
return YSERR;
}
cornerPerVertex.CleanUp();
}
}
return YSOK;
}
示例7: MakeInfo
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]);
}
}
}
}
}
示例8: 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]);
}
}
示例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:
/* 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);
}
示例11: SetUpRoundPolygon
YSRESULT YsShellExt_RoundUtil::SetUpRoundPolygon(const YsShell &shl,YsShellPolygonHandle plHd,const YsShellVertexStore *roundVtx)
{
YsArray <YsShellVertexHandle> plVtHd;
shl.GetPolygon(plVtHd,plHd);
for(YSSIZE_T idx=0; idx<plVtHd.GetN(); ++idx)
{
const YsShellVertexHandle fromVtHd=plVtHd[idx];
if(NULL==roundVtx || YSTRUE==roundVtx->IsIncluded(fromVtHd))
{
const YsShellVertexHandle toVtHd[2]=
{
plVtHd.GetCyclic(idx-1),
plVtHd.GetCyclic(idx+1)
};
AddRoundCorner(shl,fromVtHd,toVtHd);
}
}
targetPlKeyArray.Append(shl.GetSearchKey(plHd));
return YSOK;
}
示例12: sideAPolygon
YSRESULT YsShellExt_RoundUtil3d::SetUpForAroundPolygonGroup(
const YsShellExt &shl,
YSSIZE_T nPl,const YsShellPolygonHandle plHdArray[])
{
CleanUp();
if(YSTRUE!=shl.IsSearchEnabled())
{
YsPrintf("%s\n",__FUNCTION__);
YsPrintf(" This function requires a search table.\n");
return YSERR;
}
YsShellExt_BoundaryInfo boundary;
boundary.MakeInfo((const YsShell &)shl,nPl,plHdArray);
if(YSOK!=boundary.CacheContour((const YsShell &)shl))
{
return YSERR;
}
YsShellPolygonStore sideAPolygon((const YsShell &)shl),sideBPolygon((const YsShell &)shl);
sideAPolygon.AddPolygon(nPl,plHdArray);
YsArray <YsShellPolygonHandle> sideAPolygonArray(nPl,plHdArray),sideBPolygonArray;
YsShellEdgeStore boundaryEdge((const YsShell &)shl);
for(YSSIZE_T contourIdx=0; contourIdx<boundary.GetNumContour(); ++contourIdx)
{
YsArray <YsShellVertexHandle> contourVtHd;
boundary.GetContour(contourVtHd,contourIdx);
if(3<=contourVtHd.GetN())
{
if(contourVtHd[0]!=contourVtHd.Last())
{
const YsShellVertexHandle vtHd0=contourVtHd[0];
contourVtHd.Append(vtHd0);
}
for(YSSIZE_T vtIdx=0; vtIdx<contourVtHd.GetN()-1; ++vtIdx)
{
boundaryEdge.AddEdge(contourVtHd[vtIdx],contourVtHd[vtIdx+1]);
YSSIZE_T nVtPl;
const YsShellPolygonHandle *vtPlHd;
shl.FindPolygonFromVertex(nVtPl,vtPlHd,contourVtHd[vtIdx]);
for(YSSIZE_T plIdx=0; plIdx<nVtPl; ++plIdx)
{
if(YSTRUE!=sideAPolygon.IsIncluded(vtPlHd[plIdx]) &&
YSTRUE!=sideBPolygon.IsIncluded(vtPlHd[plIdx]))
{
sideBPolygon.AddPolygon(vtPlHd[plIdx]);
sideBPolygonArray.Append(vtPlHd[plIdx]);
}
}
}
}
}
return SetUpForVertexSequenceAndPolygonArray(
shl,
boundary.GetContourAll(),
sideAPolygonArray,
sideBPolygonArray);
}
示例13: if
YsArray <YsShellExt_RoundUtil::VertexPositionPair> YsShellExt_RoundUtil::MakeRoundedVertexSequence(const YsShell &shl,YSSIZE_T nVt,const YsShellVertexHandle vtHdArrayIn[],YSBOOL isLoop) const
{
YsArray <YsShellVertexHandle> orgVtHdArray(nVt,vtHdArrayIn);
YsArray <VertexPositionPair> newVtHdArray;
for(YSSIZE_T orgVtIdx=0; orgVtIdx<orgVtHdArray.GetN(); ++orgVtIdx)
{
YSBOOL rounded=YSFALSE;
for(const auto &roundCorner : cornerArray)
{
if(roundCorner.fromVtHd==orgVtHdArray[orgVtIdx])
{
int forward=0,backward=1;
if(roundCorner.toVtHd[0]==orgVtHdArray.GetCyclic(orgVtIdx-1))
{
forward=1;
backward=0;
}
else if(roundCorner.toVtHd[1]==orgVtHdArray.GetCyclic(orgVtIdx-1))
{
forward=0;
backward=1;
}
else
{
continue;
}
YSBOOL skipFirst=YSFALSE;
if(0<newVtHdArray.GetN() && newVtHdArray.Last().pos==roundCorner.subDiv[backward].Last().pos)
{
skipFirst=YSTRUE;
}
newVtHdArray.Append(roundCorner.subDiv[backward]);
newVtHdArray.Increment();
newVtHdArray.Last().vtHd=orgVtHdArray[orgVtIdx];
newVtHdArray.Last().pos=roundCorner.roundedCornerPos;
for(YSSIZE_T i=roundCorner.subDiv[forward].GetN()-1; 0<=i; --i)
{
if(YSTRUE==skipFirst)
{
skipFirst=YSFALSE;
continue;
}
newVtHdArray.Append(roundCorner.subDiv[forward][i]);
}
rounded=YSTRUE;
}
}
if(YSTRUE!=rounded)
{
newVtHdArray.Increment();
newVtHdArray.Last().vtHd=orgVtHdArray[orgVtIdx];
newVtHdArray.Last().pos=shl.GetVertexPosition(newVtHdArray.Last().vtHd);
}
}
if(2<=newVtHdArray.GetN() && YSTRUE==isLoop && newVtHdArray[0].pos==newVtHdArray.Last().pos)
{
newVtHdArray.DeleteLast();
}
return newVtHdArray;
}
示例14: Draw
void GeblGuiEditorBase::Draw(void)
{
if(YSTRUE!=drawingMasterSwitch)
{
DrawGuiOnly();
return;
}
// Do this at the beginning of Draw funtion. This will allow one of the elements set SetNeedRedraw(YSTRUE)
// within drawing function so that Draw function will be called again in the next iteragion. >>
SetNeedRedraw(YSFALSE);
drawEnv.SetNeedRedraw(YSFALSE);
threeDInterface.SetNeedRedraw(YSFALSE);
// <<
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1,1);
if(NULL==slHd)
{
if(NULL!=GetTopStatusBar())
{
GetTopStatusBar()->ClearStringAll();
}
if(NULL!=GetBottomStatusBar())
{
GetBottomStatusBar()->ClearStringAll();
}
}
if(NULL!=slHd && NULL!=GetTopStatusBar())
{
YsWString ful,pth,fil;
slHd->GetFileName(ful);
ful.SeparatePathFile(pth,fil);
if(YSTRUE==slHd->IsModified())
{
fil.Append(L"(*)");
}
YsWString curMsg;
if(0!=YsWString::Strcmp(fil,GetTopStatusBar()->GetString(curMsg,0)))
{
GetTopStatusBar()->SetString(0,fil);
}
}
if(NULL!=slHd && NULL!=GetBottomStatusBar())
{
YsString str("Selection");
YsString append;
{
YsArray <YsShellVertexHandle> selVtHd;
slHd->GetSelectedVertex(selVtHd);
if(0<selVtHd.GetN())
{
append.Printf(" Vertex:%d",(int)selVtHd.GetN());
str.Append(append);
}
}
{
YsArray <YsShellPolygonHandle> selPlHd;
slHd->GetSelectedPolygon(selPlHd);
if(0<selPlHd.GetN())
{
append.Printf(" Polygon:%d",(int)selPlHd.GetN());
str.Append(append);
}
}
{
YsArray <YsShellExt::ConstEdgeHandle> selCeHd;
slHd->GetSelectedConstEdge(selCeHd);
if(0<selCeHd.GetN())
{
append.Printf(" ConstEdge:%d",(int)selCeHd.GetN());
str.Append(append);
}
}
{
YsArray <YsShellExt::FaceGroupHandle> selFgHd;
slHd->GetSelectedFaceGroup(selFgHd);
if(0<selFgHd.GetN())
{
append.Printf(" FaceGroup:%d",(int)selFgHd.GetN());
str.Append(append);
}
}
GetBottomStatusBar()->SetString(0,str);
}
int viewport[4];
drawEnv.GetOpenGlCompatibleViewport(viewport);
drawEnv.SetVerticalOrientation(YSTRUE);
drawEnv.UpdateNearFar();
//.........这里部分代码省略.........
示例15: cutPln
/*static*/ YsArray <double> YsShellExt_SweepInfoMultiStep::CalculateScalingForParallelSweepWithPathAndGuideLine(
const YsVec3 &sweepDir,const YsArray <YsVec3> &pathArray,const YsArray <YsVec3> &guideArray)
{
if(1>=pathArray.GetN() || 1>=guideArray.GetN())
{
YsArray <double> empty;
return empty;
}
YsArray <double> scaling(pathArray.GetN(),NULL);
for(auto &s : scaling)
{
s=1.0;
}
for(auto pathIndex : pathArray.AllIndex())
{
auto &s=scaling[pathIndex];
auto &pathPnt=pathArray[pathIndex];
const YsPlane cutPln(pathPnt,sweepDir);
YSBOOL done=YSFALSE;
for(auto &guidePos : guideArray)
{
if(YSTRUE==cutPln.CheckOnPlane(guidePos))
{
s=(guidePos-pathPnt).GetLength();
done=YSTRUE;
break;
}
}
if(YSTRUE!=done)
{
for(auto guideIndex : guideArray.AllIndex())
{
if(guideIndex<guideArray.GetN()-1)
{
auto &pos0=guideArray[guideIndex];
auto &pos1=guideArray[guideIndex+1];
YsVec3 itsc;
if(YSOK==cutPln.GetPenetrationHighPrecision(itsc,pos0,pos1))
{
s=(itsc-pathPnt).GetLength();
done=YSTRUE;
break;
}
else if(0==guideIndex)
{
if(YSOK==cutPln.GetIntersection(itsc,pos0,pos1-pos0) &&
(0.0<(itsc-pos0)*(pos0-pos1) || 2==guideArray.GetN())) // If guideArray consists of only two points, which side of line doesn't matter.
{
s=(itsc-pathPnt).GetLength();
done=YSTRUE;
break;
}
}
else if(guideArray.GetN()-2==guideIndex)
{
if(YSOK==cutPln.GetIntersection(itsc,pos0,pos1-pos0) &&
0.0<(itsc-pos1)*(pos1-pos0))
{
s=(itsc-pathPnt).GetLength();
done=YSTRUE;
break;
}
}
}
}
}
}
const double ref=scaling[0];
for(auto &s : scaling)
{
s/=ref;
}
scaling[0]=1.0;
return scaling;
}