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


C++ ccBBox::minCorner方法代码示例

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


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

示例1: visit

	void visit(ccKdTree::BaseNode* node)
	{
		assert(node);
		if (node && node->parent)
		{
			assert(node->parent->isNode()); //a leaf can't have children!
			ccKdTree::Node* parent = static_cast<ccKdTree::Node*>(node->parent);

			//we choose the right 'side' of the box that corresponds to the parent's split plane
			CCVector3& boxCorner = (parent->leftChild == node ? m_UpdatedBox.maxCorner() : m_UpdatedBox.minCorner());

			//if this side has not been setup yet...
			if (boxCorner.u[parent->splitDim] != boxCorner.u[parent->splitDim]) //NaN
				boxCorner.u[parent->splitDim] = parent->splitValue;

			visit(node->parent);
		}
	}
开发者ID:Aerochip7,项目名称:trunk,代码行数:18,代码来源:ccKdTree.cpp

示例2: MakeSquare

//Helper
void MakeSquare(ccBBox& box, int pivotType, int defaultDim = -1)
{
	assert(defaultDim<3);
	assert(pivotType>=0 && pivotType<3);

	CCVector3 W = box.getDiagVec();
	if (W.x != W.y || W.x != W.z)
	{
		if (defaultDim < 0)
		{
			//we take the largest one!
			defaultDim = 0;
			if (W.u[1] > W.u[defaultDim])
				defaultDim = 1;
			if (W.u[2] > W.u[defaultDim])
				defaultDim = 2;
		}

		CCVector3 newW(W.u[defaultDim], W.u[defaultDim], W.u[defaultDim]);
		switch(pivotType)
		{
		case 0: //min corner
			{
				CCVector3 A = box.minCorner();
				box = ccBBox(A, A + newW);
			}
			break;
		case 1: //center
			{
				CCVector3 C = box.getCenter();
				box = ccBBox(C - newW / 2.0, C + newW / 2.0);
			}
			break;
		case 2: //max corner
			{
				CCVector3 B = box.maxCorner();
				box = ccBBox(B-newW,B);
			}
			break;
		}
	}
}
开发者ID:jakexie,项目名称:trunk,代码行数:43,代码来源:ccBoundingBoxEditorDlg.cpp

示例3: ComputeVolume

bool ccVolumeCalcTool::ComputeVolume(	ccRasterGrid& grid,
										ccGenericPointCloud* ground,
										ccGenericPointCloud* ceil,
										const ccBBox& gridBox,
										unsigned char vertDim,
										double gridStep,
										unsigned gridWidth,
										unsigned gridHeight,
										ccRasterGrid::ProjectionType projectionType,
										ccRasterGrid::EmptyCellFillOption emptyCellFillStrategy,
										ccVolumeCalcTool::ReportInfo& reportInfo,
										double groundHeight = std::numeric_limits<double>::quiet_NaN(),
										double ceilHeight = std::numeric_limits<double>::quiet_NaN(),
										QWidget* parentWidget/*=0*/)
{
	if (	gridStep <= 1.0e-8
		||	gridWidth == 0
		||	gridHeight == 0
		||	vertDim > 2)
	{
		assert(false);
		ccLog::Warning("[Volume] Invalid input parameters");
		return false;
	}

	if (!ground && !ceil)
	{
		assert(false);
		ccLog::Warning("[Volume] No valid input cloud");
		return false;
	}

	if (!gridBox.isValid())
	{
		ccLog::Warning("[Volume] Invalid bounding-box");
		return false;
	}

	//grid size
	unsigned gridTotalSize = gridWidth * gridHeight;
	if (gridTotalSize == 1)
	{
		if (parentWidget && QMessageBox::question(parentWidget, "Unexpected grid size", "The generated grid will only have 1 cell! Do you want to proceed anyway?", QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
			return false;
	}
	else if (gridTotalSize > 10000000)
	{
		if (parentWidget && QMessageBox::question(parentWidget, "Big grid size", "The generated grid will have more than 10.000.000 cells! Do you want to proceed anyway?", QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
			return false;
	}

	//memory allocation
	CCVector3d minCorner = CCVector3d::fromArray(gridBox.minCorner().u);
	if (!grid.init(gridWidth, gridHeight, gridStep, minCorner))
	{
		//not enough memory
		return SendError("Not enough memory", parentWidget);
	}

	//progress dialog
	QScopedPointer<ccProgressDialog> pDlg(0);
	if (parentWidget)
	{
		pDlg.reset(new ccProgressDialog(true, parentWidget));
	}

	ccRasterGrid groundRaster;
	if (ground)
	{
		if (!groundRaster.init(gridWidth, gridHeight, gridStep, minCorner))
		{
			//not enough memory
			return SendError("Not enough memory", parentWidget);
		}

		if (groundRaster.fillWith(	ground,
									vertDim,
									projectionType,
									emptyCellFillStrategy == ccRasterGrid::INTERPOLATE,
									ccRasterGrid::INVALID_PROJECTION_TYPE,
									pDlg.data()))
		{
			groundRaster.fillEmptyCells(emptyCellFillStrategy, groundHeight);
			ccLog::Print(QString("[Volume] Ground raster grid: size: %1 x %2 / heights: [%3 ; %4]").arg(groundRaster.width).arg(groundRaster.height).arg(groundRaster.minHeight).arg(groundRaster.maxHeight));
		}
		else
		{
			return false;
		}
	}

	//ceil
	ccRasterGrid ceilRaster;
	if (ceil)
	{
		if (!ceilRaster.init(gridWidth, gridHeight, gridStep, minCorner))
		{
			//not enough memory
			return SendError("Not enough memory", parentWidget);
		}
//.........这里部分代码省略.........
开发者ID:Puwong,项目名称:CloudCompare,代码行数:101,代码来源:ccVolumeCalcTool.cpp

示例4:

	GetCellBBoxVisitor()
	{
		//invalidate the initial bounding box
		m_UpdatedBox.maxCorner() = CCVector3(PC_NAN,PC_NAN,PC_NAN);
		m_UpdatedBox.minCorner() = CCVector3(PC_NAN,PC_NAN,PC_NAN);
	}
开发者ID:Aerochip7,项目名称:trunk,代码行数:6,代码来源:ccKdTree.cpp


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