• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ YsArray类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中YsArray的典型用法代码示例。如果您正苦于以下问题:C++ YsArray类的具体用法?C++ YsArray怎么用?C++ YsArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了YsArray类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:34,代码来源:ysshellext_roundutil.cpp


示例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;
	
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:26,代码来源:ysshellext_roundutil.cpp


示例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;
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:31,代码来源:ysshellext_duplicateutil.cpp


示例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;
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:31,代码来源:ysshellext_duplicateutil.cpp


示例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;
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:31,代码来源:ysshellext_duplicateutil.cpp


示例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;
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:33,代码来源:ysshellext_duplicateutil.cpp


示例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]);
	}
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:35,代码来源:filename.cpp


示例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;
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:35,代码来源:ysunixthread.cpp


示例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;
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:57,代码来源:ysshellfileio.cpp


示例10:

YsArray <YsShellVertexHandle> YsShellExt_SweepInfo::GetVertexAll(void) const
{
	YsArray <YsShellVertexHandle> vtHdArray;
	for(auto vtHd : allSrcVtHd)
	{
		vtHdArray.Append(vtHd);
	}
	return vtHdArray;
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:9,代码来源:ysshellext_sweeputil.cpp


示例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]);
				}
			}
		}
	}
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:56,代码来源:ysshellext_sweeputil.cpp


示例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);
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:54,代码来源:fsgui3dmain.cpp


示例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;
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:12,代码来源:ysshellext_duplicateutil.cpp


示例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));
	}
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:12,代码来源:yswizard.cpp


示例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;
	}
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:52,代码来源:ysstring.cpp


示例16: FsGuiCopyStringFromClipBoard

YSRESULT FsGuiCopyStringFromClipBoard(YsString &str)
{
	const int bufLen=FsGuiGetStringLengthInClipBoardC();
	if(0<bufLen)
	{
		YsArray <char> copyBuf;
		copyBuf.Set(bufLen+1,NULL);
		FsGuiCopyStringFromClipBoardC(copyBuf);
		str.Set(copyBuf);
	}
	else
	{
		str.Set("");
	}
	return YSOK;
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:16,代码来源:fsguiclipboard.cpp


示例17: 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;
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:21,代码来源:ysshellext_roundutil.cpp


示例18:

/*static*/ void YsShellExtEdit_OrientationUtil::FixOrientationOfClosedSolid(YsShellExtEdit &shl)
{
	YsShellExt_OrientationUtil orientationUtil;
	orientationUtil.CleanUp();
	orientationUtil.FixOrientationOfClosedSolid(shl.Conv());
	auto plHdNeedFip=orientationUtil.GetPolygonNeedFlip();

	for(auto plHd : plHdNeedFip)
	{
		YsArray <YsShellVertexHandle,4> plVtHd;
		shl.GetPolygon(plVtHd,plHd);
		plVtHd.Invert();
		shl.SetPolygonVertex(plHd,plVtHd);
	}

	orientationUtil.RecalculateNormalFromCurrentOrientation(shl.Conv());
	auto plNomPairNeedNormalReset=orientationUtil.GetPolygonNormalPair();
	for(auto plNomPair : plNomPairNeedNormalReset)
	{
		shl.SetPolygonNormal(plNomPair.plHd,plNomPair.nom);
	}
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:22,代码来源:ysshellextedit_orientationutil.cpp


示例19: pathVtHd

YSRESULT YsShellExt_SweepInfoMultiStep::SetUpNonParallelSweepWithPath(const YsShellExt &shl,YSSIZE_T nPathVt,const YsShellVertexHandle pathVtHdArrayIn[],YSBOOL isLoop,const double scaling[],ORIENTATION_CONTROL_TYPE oriconTypeMid,ORIENTATION_CONTROL_TYPE oriconTypeLast)
{
	YsArray <YsShellVertexHandle> pathVtHd(nPathVt,pathVtHdArrayIn);
	for(auto idx=pathVtHd.GetN()-1; 0<idx; --idx)
	{
		if(pathVtHd[idx]==pathVtHd[idx-1])
		{
			pathVtHd.Delete(idx);
		}
	}

	if(0<pathVtHd.GetN() && pathVtHd.Last()==pathVtHd[0])
	{
		pathVtHd.DeleteLast();
		isLoop=YSTRUE;
	}

	if(2>pathVtHd.GetN() || (YSTRUE==isLoop && 3>pathVtHd.GetN()))
	{
		return YSERR;
	}



	const auto &allVtHd=GetVertexAll();
	YsArray <YsVec3> iniPos;
	for(auto vtHd : allVtHd)
	{
		iniPos.Append(shl.GetVertexPosition(vtHd));
	}
	YsVec3 lfpNom;
	if(YSOK!=YsFindLeastSquareFittingPlaneNormal(lfpNom,iniPos))
	{
		return YSERR;
	}

	if(0.0>lfpNom*(shl.GetVertexPosition(pathVtHd[1])-shl.GetVertexPosition(pathVtHd[0])))
	{
		lfpNom=-lfpNom;
	}



	YsArray <YsVec3> nomArray(nPathVt,NULL);
	nomArray[0]=lfpNom;

	for(YSSIZE_T idx=1; idx<nPathVt-1; ++idx)
	{
		switch(oriconTypeMid)
		{
		case ORICON_PREVIOUS_SEGMENT:
			nomArray[idx]=YsUnitVector(shl.GetVertexPosition(pathVtHd[idx])-shl.GetVertexPosition(pathVtHd[idx-1]));
			break;
		case ORICON_NEXT_SEGMENT:
			nomArray[idx]=YsUnitVector(shl.GetVertexPosition(pathVtHd[idx+1])-shl.GetVertexPosition(pathVtHd[idx]));
			break;
		case ORICON_AVERAGE_ANGLE:
			{
				auto v1=YsUnitVector(shl.GetVertexPosition(pathVtHd[idx])-shl.GetVertexPosition(pathVtHd[idx-1]));
				auto v2=YsUnitVector(shl.GetVertexPosition(pathVtHd[idx+1])-shl.GetVertexPosition(pathVtHd[idx]));
				nomArray[idx]=YsUnitVector(v1+v2);
			}
			break;
		case ORICON_FROMPREVPOINT_TO_NEXTPOINT:
			nomArray[idx]=YsUnitVector(shl.GetVertexPosition(pathVtHd[idx+1])-shl.GetVertexPosition(pathVtHd[idx-1]));
			break;
		}
	}

	switch(oriconTypeLast)
	{
	case ORICON_PREVIOUS_SEGMENT:
	case ORICON_NEXT_SEGMENT:
		nomArray.Last()=YsUnitVector(shl.GetVertexPosition(pathVtHd[nPathVt-1])-shl.GetVertexPosition(pathVtHd[nPathVt-2]));
		break;
	case ORICON_AVERAGE_ANGLE:               // There's no next point
	case ORICON_FROMPREVPOINT_TO_NEXTPOINT:  // There's no next point
		if(YSTRUE==isLoop)
		{
			YsVec3 v1=YsUnitVector(shl.GetVertexPosition(pathVtHd[0])-shl.GetVertexPosition(pathVtHd[nPathVt-1]));
			YsVec3 v2=YsUnitVector(shl.GetVertexPosition(pathVtHd[nPathVt-1])-shl.GetVertexPosition(pathVtHd[nPathVt-2]));
			v1.Normalize();
			v2.Normalize();
			nomArray.Last()=YsUnitVector(v1+v2);
		}
		else
		{
			nomArray.Last()=YsUnitVector(shl.GetVertexPosition(pathVtHd[nPathVt-1])-shl.GetVertexPosition(pathVtHd[nPathVt-2]));
		}
		break;
	}

	return SetUpNonParallelSweepWithPath(shl,nPathVt,pathVtHd,isLoop,nomArray,scaling);
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:94,代码来源:ysshellext_sweeputil.cpp


示例20: scaling

/*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;
}
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:82,代码来源:ysshellext_sweeputil.cpp



注:本文中的YsArray类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ YsAtt3类代码示例发布时间:2022-05-31
下一篇:
C++ YarpPluginSettings类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap