本文整理汇总了C++中YsShellExt类的典型用法代码示例。如果您正苦于以下问题:C++ YsShellExt类的具体用法?C++ YsShellExt怎么用?C++ YsShellExt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了YsShellExt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CleanUp
YSRESULT YsShellExt_RoundUtil3d::SetUpForVertexSequence(
const YsShellExt &shl,
YSSIZE_T nVt,const YsShellVertexHandle vtHdArray[])
{
CleanUp();
if(2>nVt || YSTRUE!=shl.IsSearchEnabled())
{
return YSERR;
}
YSSIZE_T nEdPl;
const YsShellPolygonHandle *edPlHd;
if(YSOK==shl.FindPolygonFromEdgePiece(nEdPl,edPlHd,vtHdArray[0],vtHdArray[1]) && 2==nEdPl)
{
YsArray <YsShellPolygonHandle> sideAPolygonArray=YsShellExt_TrackingUtil::TrackPolygonOneSideOfVertexSequence(
shl,nVt,vtHdArray,1,edPlHd);
YsArray <YsShellPolygonHandle> sideBPolygonArray=YsShellExt_TrackingUtil::TrackPolygonOneSideOfVertexSequence(
shl,nVt,vtHdArray,1,edPlHd+1);
if(0==sideAPolygonArray.GetN() || 0==sideBPolygonArray.GetN())
{
return YSERR;
}
YsArray <YsArray <YsShellVertexHandle> > allBoundary(1,NULL);
allBoundary[0].Set(nVt,vtHdArray);
return YsShellExt_RoundUtil3d::SetUpForVertexSequenceAndPolygonArray(shl,allBoundary,sideAPolygonArray,sideBPolygonArray);
}
return YSERR;
}
示例2:
/* static */ void FsLazyWindowApplication::YsShellToVtxNom(std::vector <float> &vtx,std::vector <float> &nom,std::vector <float> &col,const YsShellExt &shl)
{
vtx.clear();
nom.clear();
col.clear();
for(auto plHd : shl.AllPolygon())
{
auto plVtHd=shl.GetPolygonVertex(plHd);
if(3<=plVtHd.GetN())
{
auto plNom=shl.GetNormal(plHd);
for(auto vtHd : plVtHd)
{
auto vtPos=shl.GetVertexPosition(vtHd);
vtx.push_back(vtPos.xf());
vtx.push_back(vtPos.yf());
vtx.push_back(vtPos.zf());
nom.push_back(plNom.xf());
nom.push_back(plNom.yf());
nom.push_back(plNom.zf());
col.push_back(0);
col.push_back(0);
col.push_back(1);
col.push_back(0.5);
}
}
}
}
示例3: MakeEdgeMidVertexInfo
void YsShellExt_SewingInfo::MakeEdgeMidVertexInfo(const YsShellExt &shl)
{
edgeMidVtx.CleanUp();
edgeMidVtx.SetShell(shl.Conv());
for(auto &vone : vtxOnEdge)
{
YsShell_LocalOperation::EdgeMidVertex *midVtx=edgeMidVtx.FindAttrib(vone.edVtHd[0],vone.edVtHd[1]);
if(NULL==midVtx)
{
YsShell_LocalOperation::EdgeMidVertex newEdgeMidVtx;
newEdgeMidVtx.edge[0]=vone.edVtHd[0];
newEdgeMidVtx.edge[1]=vone.edVtHd[1];
newEdgeMidVtx.midVtHd.MakeUnitLength(vone.createdVtHd);
edgeMidVtx.SetAttrib(vone.edVtHd,newEdgeMidVtx);
}
else
{
midVtx->midVtHd.Append(vone.createdVtHd);
}
}
for(auto hd : edgeMidVtx.AllHandle())
{
auto &edgVtxInfo=edgeMidVtx.GetAttrib(hd);
if(1<edgVtxInfo.midVtHd.GetN())
{
YsArray <double> dist(edgVtxInfo.midVtHd.GetN(),NULL);
for(YSSIZE_T idx=0; idx<edgVtxInfo.midVtHd.GetN(); ++idx)
{
dist[idx]=shl.GetEdgeLength(edgVtxInfo.edge[0],edgVtxInfo.midVtHd[idx]);
}
YsQuickSort(dist.GetN(),dist.GetEditableArray(),edgVtxInfo.midVtHd.GetEditableArray());
}
}
}
示例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: 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]);
}
}
}
}
}
示例6: SetUpSolidOfRevolution
YSRESULT YsShellExt_SweepInfoMultiStep::SetUpSolidOfRevolution(
const YsShellExt &shl,const YsVec3 &axiso,const YsVec3 &axisv,int nStep,const double stepAngle,const YsVec3 &stepOffset,YSBOOL closeSolid)
{
if(0<nStep)
{
const auto &allVtHd=GetVertexAll(); // Need the original normal.
const YSSIZE_T nMidLayer=(YSTRUE==closeSolid ? nStep-1 : nStep);
SetUpNLayer(shl,nStep+1); // 2015/03/05 I think I ended up making the second parameter to be (number of layers)+1....
for(auto layerIdx=0; layerIdx<nMidLayer; ++layerIdx)
{
const double angle=(double)(layerIdx+1)*stepAngle;
YsRotation rot(axisv,angle);
for(auto vtHd : allVtHd)
{
YSSIZE_T indexInLayer;
if(YSOK==srcVtKeyToMidPointIndex.FindElement(indexInLayer,shl.GetSearchKey(vtHd)))
{
auto &point=layerArray[layerIdx].pointArray[indexInLayer];
point.pos=rot*shl.GetVertexPosition(vtHd)+stepOffset*(double)(layerIdx+1);
if(point.pos==shl.GetVertexPosition(vtHd)) // Vertex on axis
{
point.vtHd=vtHd;
}
else
{
point.vtHd=NULL;
}
}
}
}
if(YSTRUE==closeSolid)
{
for(auto vtHd : allVtHd)
{
YSSIZE_T indexInLayer;
if(YSOK==srcVtKeyToMidPointIndex.FindElement(indexInLayer,shl.GetSearchKey(vtHd)))
{
auto &point=layerArray[nStep-1].pointArray[indexInLayer];
point.vtHd=vtHd;
point.pos=shl.GetVertexPosition(vtHd);
}
}
}
return YSOK;
}
return YSERR;
}
示例7: CalculateScalingForParallelSweepWithPathAndGuideLine
/*static*/ YsArray <double> YsShellExt_SweepInfoMultiStep::CalculateScalingForParallelSweepWithPathAndGuideLine(
const YsShellExt &shl,const YsVec3 &sweepDir,const YsArray <YsShellVertexHandle> &pathVtHdArray,const YsArray <YsShellVertexHandle> &guideVtHdArray)
{
YsArray <YsVec3> pathVtPosArray,guideVtPosArray;
for(auto vtHd : pathVtHdArray)
{
pathVtPosArray.Append(shl.GetVertexPosition(vtHd));
}
for(auto vtHd : guideVtHdArray)
{
guideVtPosArray.Append(shl.GetVertexPosition(vtHd));
}
return CalculateScalingForParallelSweepWithPathAndGuideLine(sweepDir,pathVtPosArray,guideVtPosArray);
}
示例8: SetUpNLayer
void YsShellExt_SweepInfoMultiStep::SetUpNLayer(const YsShellExt &shl,YSSIZE_T nLayer)
{
// For nLayers, layerArray needs to be nLayer-1 long.
layerArray.Set(nLayer-1,NULL);
for(auto &layer : layerArray)
{
layer.Initialize();
}
for(auto srcVtHd : allSrcVtHd)
{
const YSSIZE_T nextIdx=layerArray[0].pointArray.GetN();
layerArray[0].pointArray.Increment();
srcVtKeyToMidPointIndex.UpdateElement(shl.GetSearchKey(srcVtHd),nextIdx);
}
for(auto idx : layerArray.AllIndex())
{
if(0<idx)
{
layerArray[idx].pointArray.Set(layerArray[0].pointArray.GetN(),NULL);
}
for(auto &point : layerArray[idx].pointArray)
{
point.Initialize();
}
}
}
示例9: SetUpParallelSweepWithPath
YSRESULT YsShellExt_SweepInfoMultiStep::SetUpParallelSweepWithPath(const YsShellExt &shl,YSSIZE_T nPathVt,const YsShellVertexHandle pathVtHdArray[],const double scaling[])
{
CleanUpLayer();
if(2<=nPathVt)
{
YsArray <YsVec3> pathPnt(nPathVt,NULL);
for(YSSIZE_T idx=0; idx<nPathVt; ++idx)
{
pathPnt[idx]=shl.GetVertexPosition(pathVtHdArray[idx]);
}
SetUpNLayer(shl,nPathVt);
for(auto vtHd : allSrcVtHd)
{
YSSIZE_T indexInLayer;
if(YSOK==srcVtKeyToMidPointIndex.FindElement(indexInLayer,shl.GetSearchKey(vtHd)))
{
if(vtHd==pathVtHdArray[0])
{
for(auto idx : layerArray.AllIndex())
{
auto &point=layerArray[idx].pointArray[indexInLayer];
point.vtHd=pathVtHdArray[idx+1];
point.pos=shl.GetVertexPosition(pathVtHdArray[idx+1]);
}
}
else
{
for(auto idx : layerArray.AllIndex())
{
auto &point=layerArray[idx].pointArray[indexInLayer];
point.pos=(shl.GetVertexPosition(vtHd)-pathPnt[0])*scaling[idx+1]+pathPnt[idx+1];
}
}
}
}
return YSOK;
}
return YSERR;
}
示例10: VtxNomToYsShell
void FsLazyWindowApplication::VtxNomToYsShell(YsShellExt &shl,const std::vector <float> &vtx,const std::vector <float> &nom)
{
PrepareLatticeForConnection(ltc,vtx);
shl.CleanUp();
for(int i=0; i<vtx.size()/9; ++i)
{
const YsVec3 plNom(nom[i*9],nom[i*9+1],nom[i*9+2]);
const YsVec3 vtPos[3]=
{
YsVec3(vtx[i*9 ],vtx[i*9+1],vtx[i*9+2]),
YsVec3(vtx[i*9+3],vtx[i*9+4],vtx[i*9+5]),
YsVec3(vtx[i*9+6],vtx[i*9+7],vtx[i*9+8]),
};
YsShell::VertexHandle vtHd[3];
for(int i=0; i<3; ++i)
{
vtHd[i]=nullptr;
auto idx=ltc.GetBlockIndex(vtPos[i]);
if(true==ltc.IsInRange(idx))
{
for(auto tstVtHd : ltc.Elem(idx.x(),idx.y(),idx.z()))
{
if(shl.GetVertexPosition(tstVtHd)==vtPos[i])
{
vtHd[i]=tstVtHd;
break;
}
}
}
if(nullptr==vtHd[i])
{
vtHd[i]=shl.AddVertex(vtPos[i]);
if(true==ltc.IsInRange(idx))
{
ltc.Elem(idx.x(),idx.y(),idx.z()).push_back(vtHd[i]);
}
}
}
YsShell::PolygonHandle plHd;
plHd=shl.AddPolygon(3,vtHd);
shl.SetPolygonNormal(plHd,plNom);
}
}
示例11: MakeInfo
YSRESULT YsShellExt_SewingInfo::MakeInfo(const YsShellExt &shl,YSSIZE_T nVt,const YsShellVertexHandle vtHd[])
{
if(0<nVt)
{
YsArray <YsVec3> pathPnt(nVt,NULL);
for(YSSIZE_T idx=0; idx<nVt; ++idx)
{
pathPnt[idx]=shl.GetVertexPosition(vtHd[idx]);
}
return MakeInfoWithVertexHandle(shl,vtHd[0],nVt,pathPnt,vtHd);
}
return YSERR;
}
示例12:
YsArray <YsShellExt_SweepInfoMultiStep::Quad> YsShellExt_SweepInfoMultiStep::MakeSideFaceAndFirstToLastVertexMapping(const YsShellExt &shl)
{
YsShellExt_Mapping <YsShellVertexHandle,YsShellVertexHandle>::CleanUp();
YsArray <Quad> quadArray;
for(YSSIZE_T edIdx=0; edIdx<=srcEdVtHd.GetN()-2; edIdx+=2)
{
YSSIZE_T idxInLayer[2];
if(YSOK==srcVtKeyToMidPointIndex.FindElement(idxInLayer[0],shl.GetSearchKey(srcEdVtHd[edIdx])) &&
YSOK==srcVtKeyToMidPointIndex.FindElement(idxInLayer[1],shl.GetSearchKey(srcEdVtHd[edIdx+1])))
{
YsShellVertexHandle curEdVtHd[2]={srcEdVtHd[edIdx],srcEdVtHd[edIdx+1]};
for(auto &layer : layerArray)
{
YsShellVertexHandle nxtEdVtHd[2]={layer.pointArray[idxInLayer[0]].vtHd,layer.pointArray[idxInLayer[1]].vtHd};
quadArray.Increment();
quadArray.Last().quadVtHd[0]=curEdVtHd[1];
quadArray.Last().quadVtHd[1]=curEdVtHd[0];
quadArray.Last().quadVtHd[2]=nxtEdVtHd[0];
quadArray.Last().quadVtHd[3]=nxtEdVtHd[1];
curEdVtHd[0]=nxtEdVtHd[0];
curEdVtHd[1]=nxtEdVtHd[1];
}
if(YSTRUE!=YsShellExt_VertexToVertexMapping::CheckMappingExist(shl,srcEdVtHd[edIdx]))
{
YsShellExt_VertexToVertexMapping::AddMapping(shl,srcEdVtHd[edIdx], curEdVtHd[0]);
}
if(YSTRUE!=YsShellExt_VertexToVertexMapping::CheckMappingExist(shl,srcEdVtHd[edIdx+1]))
{
YsShellExt_VertexToVertexMapping::AddMapping(shl,srcEdVtHd[edIdx+1],curEdVtHd[1]);
}
}
}
return quadArray;
}
示例13: MakeInfoWithVertexHandle
YSRESULT YsShellExt_SewingInfo::MakeInfoWithVertexHandle(
const YsShellExt &shl,YsShellVertexHandle vtHdFrom,
YSSIZE_T nPathIn,const YsVec3 pathPntIn[],const YsShellVertexHandle pathVtHdIn[])
{
// if(NULL!=goalVtHd), goalVtHd must be at path[nPath-1].
if(0>=nPathIn)
{
return YSERR;
}
if(0<nPathIn && pathPntIn[0]==shl.GetVertexPosition(vtHdFrom))
{
return MakeInfoWithVertexHandle(shl,vtHdFrom,nPathIn-1,pathPntIn+1,pathVtHdIn+1);
}
YsConstArrayMask <YsVec3> pathPnt(nPathIn,pathPntIn);
YsConstArrayMask <YsShellVertexHandle> pathVtHd(nPathIn,pathVtHdIn);
CleanUp();
YsShellVertexHandle currentVtHd=vtHdFrom;
YsShell::Edge currentEdge(NULL,NULL);
YsShellPolygonHandle currentPlHd=NULL;
YsVec3 currentPos=shl.GetVertexPosition(vtHdFrom);
for(YSSIZE_T idx=0; idx<pathPnt.GetN(); ++idx)
{
if(YSOK!=CrawlOneSegment(
currentVtHd,currentEdge,currentPlHd,currentPos,shl,pathPnt[idx],pathVtHd[idx]))
{
return YSERR;
}
}
return YSOK;
}
示例14:
YSBOOL YsShellExt_RoundUtil3d::IsPolygonOnTheSameContour(const YsShellExt &shl,YsShellPolygonHandle plHd,const YsHashTable <YSSIZE_T> &vtKeyToBoundaryIdx)
{
auto plVtHd=shl.GetPolygonVertex(plHd);
if(0<plVtHd.GetN())
{
YSSIZE_T boundaryIdx0;
if(YSOK!=vtKeyToBoundaryIdx.FindElement(boundaryIdx0,shl.GetSearchKey(plVtHd[0])))
{
return YSFALSE;
}
for(auto vtHd : plVtHd)
{
YSSIZE_T boundaryIdx;
if(YSOK!=vtKeyToBoundaryIdx.FindElement(boundaryIdx,shl.GetSearchKey(vtHd)) || boundaryIdx!=boundaryIdx0)
{
return YSFALSE;
}
}
return YSTRUE;
}
return YSFALSE;
}
示例15: plHdToDivider
void YsShellExt_SewingInfo::MakePolygonSplitInfo(const YsShellExt &shl)
{
// A concave polygon may be cut twice by one crawling.
YsShellPolygonAttribTable <YsArray <YsArray <YsShellVertexHandle,2> > > plHdToDivider(shl.Conv());
for(auto &v : vtxSequence)
{
if(NULL==v.vtHd)
{
if(0<=v.vtxOnEdgeIdx)
{
v.vtHd=vtxOnEdge[v.vtxOnEdgeIdx].createdVtHd;
}
else if(0<=v.vtxOnPlgIdx)
{
v.vtHd=vtxOnPlg[v.vtxOnPlgIdx].vtHd;
}
}
}
{
YsShellPolygonHandle currentPlHd=NULL;
YsArray <YsShellVertexHandle,2> currentDivider;
for(YSSIZE_T idx=0; idx<vtxSequence.GetN(); ++idx)
{
if(0==currentDivider.GetN())
{
currentPlHd=vtxSequence[idx].plHd;
currentDivider.Append(vtxSequence[idx].vtHd);
}
else
{
currentDivider.Append(vtxSequence[idx].vtHd);
if(idx==vtxSequence.GetN()-1 || vtxSequence[idx].plHd!=currentPlHd)
{
if(2<=currentDivider.GetN())
{
YsArray <YsArray <YsShellVertexHandle,2> > *pldv=plHdToDivider[currentPlHd];
if(NULL==pldv)
{
YsArray <YsArray <YsShellVertexHandle,2> > newDividerArray(1,NULL);
newDividerArray[0].MoveFrom(currentDivider);
plHdToDivider.SetAttrib(currentPlHd,newDividerArray);
}
else
{
pldv->Append(currentDivider);
}
}
currentDivider.CleanUp();
currentDivider.Append(vtxSequence[idx].vtHd);
}
currentPlHd=vtxSequence[idx].plHd;
}
}
}
for(auto hashHd : plHdToDivider.AllHandle())
{
auto plKey=plHdToDivider.GetKey(hashHd);
auto plHd=shl.FindPolygon(plKey);
auto ÷r=*plHdToDivider[plHd];
YsSegmentedArray <YsArray <YsShellVertexHandle,4>,4> plVtHd(1,NULL);
plVtHd[0]=shl.GetPolygonVertex(plHd);
for(auto d : divider)
{
YsArray <YsShellVertexHandle,4> fragment;
for(auto &pl : plVtHd)
{
if(YSOK==YsShellExt_SplitLoopByHandleAndMidNode(pl,fragment,d))
{
plVtHd.Append(fragment);
break;
}
}
}
plgSplit.Increment();
plgSplit.Last().plHd=plHd;
plgSplit.Last().plVtHdArray=plVtHd;
}
}