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


C++ CAABBox::getMin方法代码示例

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


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

示例1:

//==========================================================================
void	CAABBox::computeIntersection(const CAABBox &b1, const CAABBox &b2)
{
	CVector	min1 = b1.getMin(), max1 = b1.getMax(),
			min2 = b2.getMin(), max2 = b2.getMax();
	CVector	minr, maxr;

	// don't test if intersect or not.
	maxr.minof(max1, max2);
	minr.maxof(min1, min2);

	setMinMax(minr, maxr);
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:13,代码来源:aabbox.cpp

示例2: computeAABBoxUnion

CAABBox CAABBox::computeAABBoxUnion(const CAABBox &b1, const CAABBox &b2)
{
	CAABBox result;
	CVector min, max;
	CVector min1 = b1.getMin()
		    ,max1 = b1.getMax()
			,min2 = b2.getMin()
		    ,max2 = b2.getMax();
	max.maxof(max1, max2);
	min.minof(min1, min2);
	result.setMinMax(min, max);
	return result;
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:13,代码来源:aabbox.cpp

示例3:

/*
 *		render()
 */
void	CPrimChecker::render(CPrimZone *zone, uint8 bits)
{
	if (zone->VPoints.size() < 3)
		return;

	string	name;
	if (zone->getPropertyByName("name", name) && Verbose)
		nlinfo("Rendering CPrimZone '%s'", name.c_str());

	// get the bouding box of the CPrimZone
	CAABBox	box;

	box.setCenter(zone->VPoints[0]);
	box.setHalfSize(CVector::Null);

	uint	i;
	for (i=1; i<zone->VPoints.size(); ++i)
		box.extend(zone->VPoints[i]);

	sint32	xmin, ymin, xmax, ymax;

	xmin = (sint32)(floor(box.getMin().x));
	ymin = (sint32)(floor(box.getMin().y));

	xmax = (sint32)(ceil(box.getMax().x));
	ymax = (sint32)(ceil(box.getMax().y));

	// Fill grid with points that belong to the CPrimZone
	sint32	x, y;
	for (y=ymin; y<=ymax; ++y)
		for (x=xmin; x<=xmax; ++x)
			if (zone->contains(CVector((float)x, (float)y, 0.0f)))
				_Grid.set(x, y, bits);
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:37,代码来源:prim_checker.cpp

示例4: transformAABBox

//==========================================================================
CAABBox CAABBox::transformAABBox(const CMatrix &mat, const CAABBox &box)
{
	// TODO : optimize this a bit if possible...
	CAABBox result;

	/* OMG. Old code was false!!
		if we have ht= M * h
		then CVector(-ht.x, ht.y, ht.z) != M * CVector(-h.x, h.y, h.z) !!!!
	*/
	// compute corners.
	CVector	p[8];
	CVector	min= box.getMin();
	CVector	max= box.getMax();
	p[0].set(min.x, min.y, min.z);
	p[1].set(max.x, min.y, min.z);
	p[2].set(min.x, max.y, min.z);
	p[3].set(max.x, max.y, min.z);
	p[4].set(min.x, min.y, max.z);
	p[5].set(max.x, min.y, max.z);
	p[6].set(min.x, max.y, max.z);
	p[7].set(max.x, max.y, max.z);
	CVector tmp;
	min = max = mat * p[0];
	// transform corners.
	for(uint i=1;i<8;i++)
	{
		tmp= mat * p[i];
		min.minof(min, tmp);
		max.maxof(max, tmp);
	}

	result.setMinMax(min, max);

	return result;
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:36,代码来源:aabbox.cpp

示例5: getMin

// ***************************************************************************
bool			CAABBox::intersect(const CAABBox &box) const
{
	CVector	mina = getMin(), maxa = getMax(),
			minb = box.getMin(), maxb = box.getMax();

	return ! ( mina.x > maxb.x ||
			   mina.y > maxb.y ||
			   mina.z > maxb.z ||
			   minb.x > maxa.x ||
			   minb.y > maxa.y ||
			   minb.z > maxa.z);
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:13,代码来源:aabbox.cpp

示例6: main

int main(int argc, char **argv)
{
	// Filter addSearchPath
	NLMISC::createDebug();
	InfoLog->addNegativeFilter("adding the path");

	createDebug();

	try
	{
		// Init
		init();

		uint	i, j, k;

		for (i=0; i<IGs.size(); ++i)
		{
			// load ig associated to the zone
			string			igName = IGs[i]+".ig";
			CIFile			igStream(CPath::lookup(igName));
			CInstanceGroup	ig;
			igStream.serial(ig);

			CAABBox			igBBox;
			bool			boxSet = false;

			nlinfo("Generating BBOX for %s", igName.c_str());

			// search in group for water instance
			for (j=0; j<ig._InstancesInfos.size(); ++j)
			{
				/*
				   Ben: c'est degueulasse, mais c'est les coders a la 3D, y savent pas coder
				   Hld: ouai, mais ca marche pas ton truc, alors p'tet qu'on sait pas coder mais toi non plus :p Special Dedicace to SupaGreg!
				string	shapeName = ig._InstancesInfos[j].Name+".shape";
				*/
				string	shapeName = ig._InstancesInfos[j].Name;
				if (CFile::getExtension (shapeName) == "")
					shapeName += ".shape";

				if (NonWaterShapes.find(shapeName) != NonWaterShapes.end())
					continue;

				string	shapeNameLookup = CPath::lookup (shapeName, false, false);
				if (!shapeNameLookup.empty())
				{
					CIFile			f;
					if (f.open (shapeNameLookup))
					{
						CShapeStream	shape;
						shape.serial(f);

						CWaterShape	*wshape = dynamic_cast<CWaterShape *>(shape.getShapePointer());
						if (wshape == NULL)
						{
							NonWaterShapes.insert(shapeName);
							continue;
						}

						CMatrix	matrix;
						ig.getInstanceMatrix(j, matrix);

						CPolygon			wpoly;
						wshape->getShapeInWorldSpace(wpoly);

						for (k=0; k<wpoly.Vertices.size(); ++k)
						{
							if (boxSet)
							{
								igBBox.extend(matrix * wpoly.Vertices[k]);
							}
							else
							{
								igBBox.setCenter(matrix * wpoly.Vertices[k]);
								boxSet = true;
							}
						}
					}
					else
					{
						nlwarning ("Can't load shape %s", shapeNameLookup.c_str());
					}
				}
				else
				{
					NonWaterShapes.insert(shapeName);
				}
			}

			if (boxSet)
			{
				Boxes.push_back(CIGBox(igName, igBBox));
				nlinfo("Bbox: (%.1f,%.1f)-(%.1f,%.1f)", igBBox.getMin().x, igBBox.getMin().y, igBBox.getMax().x, igBBox.getMax().y);
			}
		}

		COFile	output(Output);
		output.serialCont(Boxes);
	}
	catch (Exception &e)
//.........这里部分代码省略.........
开发者ID:mixxit,项目名称:solinia,代码行数:101,代码来源:main.cpp

示例7: CheckZone

/**  Check a zone and report the total number of errors
  */
static uint CheckZone(std::string middleZoneFile, float weldThreshold, float middleEdgeWeldThreshold)
{
	uint numErrors = 0;
	uint k, l, m, n, p, q;	// some loop counters	
	// This avoid reporting errors twice (for readability)
	std::set<CPatchIdentPair> errorPairs;

	////////////////////////////
	// Load the zones around  //
	////////////////////////////

		std::auto_ptr<CZone>		zones[9];
		std::string					zoneNames[9];
		CZoneInfo					zoneInfos[9];				
		uint16  xPos, yPos;
		const sint16 posOffs[][2] = { {0, 0}, {1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1} };

		std::string middleZoneName = CFile::getFilenameWithoutExtension(middleZoneFile);
		::getZoneCoordByName(middleZoneName.c_str(), xPos, yPos);
		try
		{
			std::string ext = CFile::getExtension(middleZoneFile);
			zones[0].reset(::LoadZone(xPos, yPos, ext.empty() ? "" : "." + ext));
			if (zones[0].get() == NULL)
			{
				nlwarning("Can't load zone  %s", middleZoneName.c_str());
				return 0;
			}
			for (uint k = 1; k < 9; ++k)
			{
				zones[k].reset(::LoadZone(xPos + posOffs[k][0], yPos + posOffs[k][1], ext.empty() ? "" : "." + ext));
			}
		}
		catch (NLMISC::Exception &e)
		{
			nlinfo("Zones loading failed : %d", e.what());
			return 0;
		}
	
	///////////////////////////////
	// retrieve datas from zones //
	///////////////////////////////

		for (k = 0; k < 9; ++k)
		{
			::getZoneNameByCoord(xPos + posOffs[k][0], yPos + posOffs[k][1], zoneNames[k]);			
			if (zones[k].get() != NULL) zones[k]->retrieve(zoneInfos[k]);
		}	

		// fill the quad grid
		CAABBox zoneBBox = zones[0]->getZoneBB().getAABBox();
		float zoneSize = 2.f * weldThreshold + std::max(zoneBBox.getMax().x - zoneBBox.getMin().x,
														 zoneBBox.getMax().y - zoneBBox.getMin().y);
		TPVQuadGrid qg;
		const uint numQGElt = 128;
		qg.create(numQGElt, zoneSize / numQGElt);

		// insert vertices in quadgrid
		for (k = 0; k < 9; ++k)
		{		
			for (l = 0; l < zoneInfos[k].Patchs.size(); ++l)
			{
				CPatchInfo &patch = zoneInfos[k].Patchs[l];
				// for each base vertex of the patch
				for (m = 0; m < 4; ++m)
				{
					CVector &pos = patch.Patch.Vertices[m];
					CBSphere s(pos, weldThreshold);
					if (zoneBBox.intersect(s)) // does this vertex and its zone of influence intersect the bbox ?
					{
						CVector half(weldThreshold, weldThreshold, weldThreshold);
						// yes, insert it in the tree
						qg.insert(pos - half, pos + half, CPatchVertexInfo(k, l, m, pos));
					}			
				}
			}
		}

	////////////////////////////////////////////////
	// check wether each patch is correctly bound //
	////////////////////////////////////////////////

	for (l = 0; l < zoneInfos[0].Patchs.size(); ++l)
	{	
		CPatchInfo &patch = zoneInfos[0].Patchs[l];
		// deals with each border
		for (m = 0; m < 4; ++m)
		{			
			// if this border is said to be bound, no need to test..
			if (patch.BindEdges[m].NPatchs == 0)
			{
				// maps from an index to  a (s, t) couple
				static const float indexToST[][2] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}};

				// index of this border vertices
				const uint vIndex[]  = { m, (m + 1) & 0x03 };

				bool errorFound = false;
//.........这里部分代码省略.........
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:101,代码来源:zone_check_bind.cpp

示例8: UpdatePrimitives

void UpdatePrimitives ()
{
	// Get the tools window
	CMainFrame *mainWnd = getMainFrame ();
	if (mainWnd)
	{
		CToolsLogic *toolWnd = dynamic_cast<CToolsLogic*>(getMainFrame ()->m_wndSplitter.GetPane(0,1));

		// Sort the list
		static vector<CDatabaseLocatorPointer>	toSort;
		toSort.clear ();

		CWorldEditorDoc *doc = getDocument ();
		std::list<NLLIGO::IPrimitive*>::iterator ite = ModifiedPrimitive.begin ();
		while (ite != ModifiedPrimitive.end ())
		{
			CDatabaseLocatorPointer locator;
			doc->getLocator (locator, *ite);
			toSort.push_back (locator);
			ite++;
		}
		sort (toSort.begin (), toSort.end ());

		// For each modified primitive 
		sint i;
		sint count = (sint)toSort.size ();
		for (i=count-1; i>=0; i--)
		{
			CDatabaseLocatorPointer locator;
			doc->getLocator (locator, toSort[i].Primitive);
			IPrimitiveEditor *primitiveEditor = getPrimitiveEditor (const_cast<IPrimitive*>(toSort[i].Primitive));

			// Logic tree structure modified ?
			if (primitiveEditor->_Channels & LogicTreeStruct)
			{
				// Remove from the tree
				primitiveEditor->removeFromLogicTree ();
			}
		}

		// Selection is changed ?
		bool selectionChanged = false;

		// For each modified primitive 
		for (i=0; i<count; i++)
		{
			const IPrimitive *primitive = toSort[i].Primitive;
			CDatabaseLocatorPointer locator;
			doc->getLocator (locator, primitive);
			IPrimitiveEditor *primitiveEditor = getPrimitiveEditor (const_cast<IPrimitive*>(primitive));

			// Quad grid ?
			if (primitiveEditor->_Channels & QuadTree)
			{
				// Remove from the container
				primitiveEditor->removeFromQuadGrid ();

				// Num points
				uint pointCount = (primitive)->getNumVector ();
				if (pointCount > 0)
				{
					// Point pointer
					const CPrimVector *points = (primitive)->getPrimVector ();

					// BBox
					CAABBox	bbox;
					bbox.setCenter (points[0]);

					// Extend the bbox
					uint j;
					for (j=1; j<pointCount; j++)
					{
						bbox.extend (points[j]);
					}

					// Insert in the quadtree
					primitiveEditor->_QuadIterator = PrimitiveQuadGrid.insert (bbox.getMin (), bbox.getMax (), const_cast<IPrimitive*> (primitive));

					// Get the linked primitives
					const IPrimitive* linkedPrimitive = theApp.Config.getLinkedPrimitive (*primitive);

					// Is this primitive linked with another one ?
					if (linkedPrimitive)
					{
						IPrimitiveEditor *primitiveEditorLinked = getPrimitiveEditor (const_cast<IPrimitive*>(linkedPrimitive));
						if (linkedPrimitive->getNumVector () > 0)
						{
							bbox.setCenter (points[0]);
							bbox.extend (linkedPrimitive->getPrimVector ()[0]);

							// Insert in the quadtree
							primitiveEditor->_QuadIteratorLink = PrimitiveQuadGrid.insert (bbox.getMin (), bbox.getMax (), CQuadGridEntry 
								(const_cast<IPrimitive*> (primitive), const_cast<IPrimitive*> (linkedPrimitive)));
						}
					}
				}

				// Validate
				primitiveEditor->_Channels &= ~QuadTree;
			}
//.........这里部分代码省略.........
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:101,代码来源:editor_primitive.cpp

示例9: mirrorPhysiqueSelection


//.........这里部分代码省略.........
			}
		}
	}
	if(!ok)
		return false;

	// no vertices? abort
	if(vertCount==0)
		return true;


	// **** Mark all Input vertices
	for(i=0;i<vertIn.size();i++)
	{
		nlassert(vertIn[i]<vertCount);
		tempVertex[vertIn[i]].Input= true;
	}


	// **** Build the output vertices
	std::vector<uint>	vertOut;
	vertOut.reserve(tempVertex.size());

	// Build the in bbox
	CAABBox		bbox;
	bbox.setCenter(tempVertex[vertIn[0]].Pos);
	for(i=0;i<vertIn.size();i++)
	{
		bbox.extend(tempVertex[vertIn[i]].Pos);
	}
	bbox.setHalfSize(bbox.getHalfSize()+CVector(threshold, threshold, threshold));

	// mirror in X
	CVector		vMin= bbox.getMin();
	CVector		vMax= bbox.getMax();
	vMin.x= -vMin.x;
	vMax.x= -vMax.x;
	std::swap(vMin.x, vMax.x);
	bbox.setMinMax(vMin, vMax);

	// get all out vertices in the mirrored bbox.
	for(i=0;i<tempVertex.size();i++)
	{
		if(bbox.include(tempVertex[i].Pos))
		{
			vertOut.push_back(i);
		}
	}


	// **** Build the skin information
	// Get the skin modifier
	Modifier* skin=getModifier (&node, PHYSIQUE_CLASS_ID);

	// Found it ?
	ok= false;
	if (skin)
	{
		// Get a com_skin2 interface
		IPhysiqueExport *physiqueInterface=(IPhysiqueExport *)skin->GetInterface (I_PHYINTERFACE);

		// Found com_skin2 ?
		if (physiqueInterface)
		{
			// Get local data
			IPhyContextExport *localData= physiqueInterface->GetContextInterface(&node);
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:67,代码来源:export_skinning.cpp


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