当前位置: 首页>>代码示例>>C++>>正文


C++ Box3::EnlargeBy方法代码示例

本文整理汇总了C++中Box3::EnlargeBy方法的典型用法代码示例。如果您正苦于以下问题:C++ Box3::EnlargeBy方法的具体用法?C++ Box3::EnlargeBy怎么用?C++ Box3::EnlargeBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Box3的用法示例。


在下文中一共展示了Box3::EnlargeBy方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EdgeIntersect

int UVW_ChannelClass::EdgeIntersect(Point3 p, float threshold, int i1,int i2)
{

 static int startEdge = 0;
 if (startEdge >= ePtrList.Count()) startEdge = 0;
 if (ePtrList.Count() == 0) return -1;

 int ct = 0;
 BOOL done = FALSE;


 int hitEdge = -1;
 while (!done) 
	{
 //check bounding volumes

	Box3 bounds;
	bounds.Init();

	int index1 = ePtrList[startEdge]->a;
	int index2 = ePtrList[startEdge]->b;
	if (v[index1].IsHidden() && v[index2].IsHidden())
		{
		}
	else if (v[index1].IsFrozen() && v[index1].IsFrozen()) 
		{
		}
	else
		{
		Point3 p1(0.0f,0.0f,0.0f);
		p1[i1] = v[index1].GetP()[i1];
		p1[i2] = v[index1].GetP()[i2];
//		p1.z = 0.0f;
		bounds += p1;
		Point3 p2(0.0f,0.0f,0.0f);
		p2[i1] = v[index2].GetP()[i1];
		p2[i2] = v[index2].GetP()[i2];
//		p2.z = 0.0f;
		bounds += p2;
		bounds.EnlargeBy(threshold);
		if (bounds.Contains(p))
			{
//check edge distance
			if (LineToPoint(p, p1, p2) < threshold)
				{
				hitEdge = startEdge;
				done = TRUE;
//				LineToPoint(p, p1, p2);
				}
			}
		}
 	ct++;
	startEdge++;
	if (ct == ePtrList.Count()) done = TRUE;
	if (startEdge >= ePtrList.Count()) startEdge = 0;
	}
 
 return hitEdge;
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:59,代码来源:tvdata.cpp

示例2: LengthSquared

void
UniformGrid::ClosestPoint(Point3 p, float radius, int &pindex, float &d)
{
	xHitList.ClearAll();
	yHitList.ClearAll();
	zHitList.ClearAll();
	hitList.SetCount(0);

	//find the cell in the XGrid
	TagCells(p,radius, 0);
	//find the cell in the YGrid
	TagCells(p,radius, 1);
	//find the cell in the ZGrid
	TagCells(p,radius, 2);

	BitArray usedList;
	usedList.SetSize(pointBase.Count());
	usedList.ClearAll();

	int closest = -1;
	d = 0.0f;
	Box3 localBounds;
	localBounds.Init();
	localBounds += p;
	localBounds.EnlargeBy(radius);


	for (int i = 0; i < hitList.Count(); i++)
	{
		int index = hitList[i];
		if (!usedList[index])  //check to see if we have processed this one or not
		{
			if (xHitList[index] && yHitList[index] && zHitList[index])
			{
				usedList.Set(index);
				Point3 source = pointBase[index];
				if (localBounds.Contains(source))
				{
					float dist = LengthSquared(source-p);
					if ((dist < d) || (closest == -1))
					{
						d = dist;
						closest = index;
					}
				}
			}
		}
	}
	pindex = closest;
	d = sqrt(d);


}
开发者ID:DimondTheCat,项目名称:xray,代码行数:53,代码来源:UniformGrid.cpp

示例3:

void
UniformGrid::InRadius(Point3 p,  Tab<int> &indexList)
{
	float radius = largestRadius;
	xHitList.ClearAll();
	yHitList.ClearAll();
	zHitList.ClearAll();
	hitList.SetCount(0);

	//find the cell in the XGrid
	TagCells(p,radius, 0);
	//find the cell in the YGrid
	TagCells(p,radius, 1);
	//find the cell in the ZGrid
	TagCells(p,radius, 2);

	BitArray usedList;
	usedList.SetSize(pointBase.Count());
	usedList.ClearAll();

	int closest = -1;
	float d = 0.0f;
	Box3 localBounds;
	localBounds.Init();
	localBounds += p;
	localBounds.EnlargeBy(radius);


	for (int i = 0; i < hitList.Count(); i++)
	{
		int index = hitList[i];
		if (!usedList[index])  //check to see if we have processed this one or not
		{
			if (xHitList[index] && yHitList[index] && zHitList[index])
			{
				usedList.Set(index);
				Point3 source = pointBase[index];
				if (localBounds.Contains(source))
				{
					indexList.Append(1,&index,1000);

				}
			}
		}
	}

}
开发者ID:DimondTheCat,项目名称:xray,代码行数:47,代码来源:UniformGrid.cpp

示例4: GetLocalBoundBox

void PointHelpObject::GetLocalBoundBox(
		TimeValue t, INode* inode, ViewExp* vpt, Box3& box ) 
	{
	
	if ( ! vpt || ! vpt->IsAlive() )
	{
		box.Init();
		return;
	}

	Matrix3 tm = inode->GetObjectTM(t);	
	
	float size;
	int screenSize;
	pblock2->GetValue(pointobj_size, t, size, FOREVER);
	pblock2->GetValue(pointobj_screensize, t, screenSize, FOREVER);

	float zoom = 1.0f;
	if (screenSize) {
		zoom = vpt->GetScreenScaleFactor(tm.GetTrans())*ZFACT;
		}
	if (zoom==0.0f) zoom = 1.0f;

	size *= zoom;
	box =  Box3(Point3(0,0,0), Point3(0,0,0));
	box += Point3(size*0.5f,  0.0f, 0.0f);
	box += Point3( 0.0f, size*0.5f, 0.0f);
	box += Point3( 0.0f, 0.0f, size*0.5f);
	box += Point3(-size*0.5f,   0.0f,  0.0f);
	box += Point3(  0.0f, -size*0.5f,  0.0f);
	box += Point3(  0.0f,  0.0f, -size*0.5f);

	//JH 6/18/03
	//This looks odd but I'm being conservative an only excluding it for
	//the case I care about which is when computing group boxes
	//	box.EnlargeBy(10.0f/zoom);
	if(!(extDispFlags & EXT_DISP_GROUP_EXT)) 
		box.EnlargeBy(10.0f/zoom);

	/*
	if (showAxis)
		box = GetAxisBox(vpt,tm,showAxis?axisLength:0.0f, TRUE);
	else
		box = Box3(Point3(0,0,0), Point3(0,0,0));
	*/
	}
开发者ID:mathieumg,项目名称:inf4715,代码行数:46,代码来源:pthelp.cpp

示例5: GetWorldsBounds

Box3 SplineData::GetWorldsBounds()
{
	Box3 bounds;
	bounds.Init();

	mShapeCache.BuildBoundingBox();
	bounds = mShapeCache.bdgBox;
	float extraPadding = 0.0f;
	for (int i = 0; i < mSplineElementData.Count(); i++)
	{
		for (int j = 0; j < NumberOfCrossSections(i); j++)
		{
			SplineCrossSection *section = GetCrossSection(i,j);
			float d = section->GetLargestScale();
			if (d > extraPadding)
				extraPadding = d;
		}
	}
	
	bounds.EnlargeBy(extraPadding);


	return bounds;
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:24,代码来源:ToolSplineMapping_SplineData.cpp

示例6: GetAxisBox

Box3 GetAxisBox(ViewExp *vpt, const Matrix3 &tm,float length,int resetTM)
	{
	Matrix3 tmn = tm;
	Box3 box;
	float zoom;

	// Get width of viewport in world units:  --DS
	zoom = vpt->GetScreenScaleFactor(tmn.GetTrans())*ZFACT;
	if (zoom==0.0f) zoom = 1.0f;
//	tmn.Scale(Point3(zoom,zoom,zoom));
	length *= zoom;
	if(resetTM)
		tmn.IdentityMatrix();

	box += Point3(0.0f,0.0f,0.0f) * tmn;
	box += Point3(length,0.0f,0.0f) * tmn;
	box += Point3(0.0f,length,0.0f) * tmn;
	box += Point3(0.0f,0.0f,length) * tmn;	
	box += Point3(-length/5.f,0.0f,0.0f) * tmn;
	box += Point3(0.0f,-length/5.f,0.0f) * tmn;
	box += Point3(0.0f,0.0f,-length/5.0f) * tmn;
	box.EnlargeBy(10.0f/zoom);
	return box;
	}
开发者ID:mathieumg,项目名称:inf4715,代码行数:24,代码来源:pthelp.cpp

示例7: tm

void 
UniformGrid::Display(GraphicsWindow *gw)
{
	return;
	Matrix3 tm(1);
//	gw->setTransform(tm);
	DrawBounds(gw, bounds);

	float sx,sy,sz;
	float incx,incy,incz;

	sx = 0.0f;
	sy = bounds.pmin.y;
	sz = bounds.pmin.z;
	incx = 0.0f;
	incy = (bounds.pmax.y - bounds.pmin.y)/width;
	incz = (bounds.pmax.z - bounds.pmin.z)/width;


	int index =0;
	float x,y,z;

	sx = bounds.pmin.x;
	sy = 0.0f;
	sz = bounds.pmin.z;
	incx = (bounds.pmax.x - bounds.pmin.x)/width;
	incy = 0.0f;
	incz = (bounds.pmax.z - bounds.pmin.z)/width;


	index =0;
	z = sz;
	for (int i = 0; i < width; i++)
	{
		x = sx;
		y = 0.0;
		for (int j = 0; j < width; j++)
		{
			Box3 b;
			b.Init();
			Point3 p(x,y,z);
			b += p;
			p.x += incx;
			p.y += incy;
			p.z += incz; 
			b += p;

			if (yGrid[index]!=NULL)
				{
				if (index == whichLargestCell)
					{
					Point3 color (1.0f,0.0f,0.0f);
					gw->setColor(LINE_COLOR,color);
					}
				else
					{
					Point3 color (0.0f,1.0f,0.0f);
					gw->setColor(LINE_COLOR,color);
					}

				gw->marker(&b.Center(),CIRCLE_MRKR);
				DrawBounds(gw, b);
				}
			
			index++;
			x += incx;
		}
		z += incz;
	}

	gw->setColor(LINE_COLOR,GetUIColor(COLOR_SEL_GIZMOS));
	gw->marker(&debugP,BIG_BOX_MRKR);


	Point3 red (1.0f,0.0f,0.0f);

	gw->setColor(LINE_COLOR,red);
	gw->marker(&bounds.pmin,BIG_BOX_MRKR);
	Box3 cb;
	cb.Init();
	cb += bounds.pmin;
	cb.EnlargeBy(mRadius);
	DrawBounds(gw, cb);

}
开发者ID:artemeliy,项目名称:inf4715,代码行数:85,代码来源:BonesDef_UniformGrid.cpp

示例8: GeometryCheckWithUVMesh

IGeometryChecker::ReturnVal OverlappedUVWFacesChecker::GeometryCheckWithUVMesh(UVWChannel &uvmesh,TimeValue t,INode *nodeToCheck, BitArray &arrayOfFaces)
{
	LARGE_INTEGER	ups,startTime;
	QueryPerformanceFrequency(&ups);
	QueryPerformanceCounter(&startTime); //used to see if we need to pop up a dialog 
	bool checkTime = GetIGeometryCheckerManager()->GetAutoUpdate();//only check time for the dialog if auto update is active!
	//get our bounding box
	Box3 bounds;
	bounds.Init();

	int numVerts = uvmesh.GetNumTVVerts();
	int i;
	for (i = 0; i < numVerts; ++i)
	{
		Point3 tv = uvmesh.GetTVVert(i);
		if(_isnan(tv.x) || !_finite(tv.x)||_isnan(tv.y) || !_finite(tv.y)||_isnan(tv.z) || !_finite(tv.z))
			return IGeometryChecker::eFail; //if we have a bad tvert bail out...
		bounds += uvmesh.GetTVVert(i);
	}
	//put a small fudge to keep faces off the edge
	bounds.EnlargeBy(0.05f);
	//build our transform

	float xScale = bounds.pmax.x - bounds.pmin.x;
	float yScale = bounds.pmax.y - bounds.pmin.y;
	Point3 offset = bounds.pmin;

	//create our buffer
	OverlapMap overlapMap;
	overlapMap.Init();
	
	Interface *ip = GetCOREInterface();
	int numProcsToUse = omp_get_num_procs()-1;
	if(numProcsToUse<0)
		numProcsToUse = 1;
	TCHAR buf[256];
	TCHAR tmpBuf[64];
	_tcscpy(tmpBuf,GetString(IDS_CHECK_TIME_USED));
	_tcscpy(buf,GetString(IDS_RUNNING_GEOMETRY_CHECKER));
	ip->PushPrompt(buf);
	int total = 0;
	bool compute = true;
	EscapeChecker::theEscapeChecker.Setup();
	for (int i = 0; i < uvmesh.GetNumOfFaces(); ++i)
	{
		if(compute==true)
		{
			//loop through the faces
			int deg = uvmesh.GetFaceDegree(i);
			int index[4];
			index[0] = uvmesh.GetFaceTVVert(i,0);
			Point3 pa = uvmesh.GetTVVert(index[0]);
			pa.x -= offset.x;
			pa.x /= xScale;

			pa.y -= offset.y;
			pa.y /= yScale;

			for (int j = 0; j < deg -2; j++)
			{
				index[1] = uvmesh.GetFaceTVVert(i,j+1);
				index[2] = uvmesh.GetFaceTVVert(i,j+2);
				Point3 pb = uvmesh.GetTVVert(index[1]);
				Point3 pc = uvmesh.GetTVVert(index[2]);

				pb.x -= offset.x;
				pb.x /= xScale;
				pb.y -= offset.y;
				pb.y /= yScale;

				pc.x -= offset.x;
				pc.x /= xScale;
				pc.y -= offset.y;
				pc.y /= yScale;

				//add face to buffer
				//select anything that overlaps
				overlapMap.Map(uvmesh,i,pa,pb,pc,arrayOfFaces);
			}
		}
		total += 1;
		
		if(compute==true)
		{
			if(EscapeChecker::theEscapeChecker.Check())
			{
				compute = false;
				_tcscpy(buf,GetString(IDS_EXITING_GEOMETRY_CHECKER));
				ip->ReplacePrompt(buf);
				break; //can now break, no omp
			}
		
			if((total%100)==0)
			{
				{
					float percent = (float)total/(float)uvmesh.GetNumOfFaces()*100.0f;
					_stprintf(buf,tmpBuf,percent);
					ip->ReplacePrompt(buf);
				}     
			}
//.........这里部分代码省略.........
开发者ID:artemeliy,项目名称:inf4715,代码行数:101,代码来源:OverlappedUVWFaces.cpp

示例9: AddWeightFromSegment

void PointGatherer::AddWeightFromSegment(Point3 a, float radiusA, float strA,
									Point3 b, float radiusB, float strB, ICurve *pCurve,
									BOOL additveMode, BOOL isMirror,
									float currentLength)
{

	float segLength = Length(a-b);

//get the bounding box from the segment
	Box3 bounds;

	bounds.Init();

	bounds += a;
	bounds += b;
	if (radiusA > radiusB)
		bounds.EnlargeBy(radiusA);
	else bounds.EnlargeBy(radiusB);
	int startX, endX;
	int startY, endY;
	int startZ, endZ;
	
	startX = (bounds.pmin.x - upperLeft.x)/xOffset;
	startY= (bounds.pmin.y - upperLeft.y)/yOffset;
	startZ= (bounds.pmin.z - upperLeft.z)/zOffset;

	endX = (bounds.pmax.x - upperLeft.x)/xOffset;
	endY= (bounds.pmax.y - upperLeft.y)/yOffset;
	endZ= (bounds.pmax.z - upperLeft.z)/zOffset;

//need to constrains the indices since a brush envelope can exist past our bounds
	if (startX < 0) startX = 0;
	if (startX >=  width) startX = width-1;
	if (endX < 0) endX = 0;
	if (endX >=  width) endX = width-1;

	if (startY < 0) startY = 0;
	if (startY >=  width) startY = width-1;
	if (endY < 0) endY = 0;
	if (endY >=  width) endY = width-1;

	if (startZ < 0) startZ = 0;
	if (startZ >=  width) startZ = width-1;
	if (endZ < 0) endZ = 0;
	if (endZ >=  width) endZ = width-1;


//get all the cells that intersect with the bounding box
//loop through those points adding weight to em if they are within the envelope
	float u = 0.0f;
	float dist = 0.0f;
	float envDist = 0.0f;
/*
//Brute force method checks against every point
	for (int i = 0; i < cellData.Count(); i++)
		{

		for (int j = 0; j < cellElementCount[i]; j++)
			{
			Point3 p = *cellData[i].p[j];

			dist = LineToPoint(p,a,b,u);
				envDist = radiusA + ((radiusB-radiusA) * u);
				if (dist <= envDist)
					{
//DebugPrint("dist %f envdist %f\n",dist,envDist);
					float weight = 1.0f - dist/envDist;
					float str = (strA + ((strB-strA) * u)) * weight;
					float listWeight = cellData[i].weight[j];
					if (weight > listWeight) 
						{
						cellData[i].str[j] = str;
						cellData[i].weight[j] = weight;
						}
					
					}

			}	
		}
*/
//checks against cells first then those points only within the hit cells
//2 d gather
/*
	for (int i = startY; i <= endY; i++)
		{
		int currentCell = i * width;
		
		for (int j = startX; j <= endX; j++)
			{
			if (CellDataXY[currentCell+j])
				{
				for (int k = 0; k < CellDataXY[currentCell+j]->whichPoint.Count(); k++)
					{
					int whichPoint = CellDataXY[currentCell+j]->whichPoint[k];
					int whichNode = CellDataXY[currentCell+j]->whichNode[k];
					Point3 p = *cellData[whichNode].p[whichPoint];
					dist = LineToPoint(p,a,b,u);
					envDist = radiusA + ((radiusB-radiusA) * u);
					if (dist <= envDist)
						{
//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:xray,代码行数:101,代码来源:PointGatherer.cpp


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