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


C++ Plane::GetSide方法代码示例

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


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

示例1: Clip

/**
*  @brief
*    Clips the polygon against a plane
*/
Polygon Polygon::Clip(const Plane &cPlane) const
{
	uint32 nNumOfVertices = m_lstVertices.GetNumOfElements();
	Polygon cClipped;

	// Loop through all vertices of this polygon
	for (uint32 i=0; i<nNumOfVertices; i++) {
		// The 2 vertices of an edge
		const Vector3 &vA = m_lstVertices[i];
		const Vector3 &vB = m_lstVertices[(i+1) % nNumOfVertices];

		// Check on which side of the plane the vertices are on
		Plane::ESide nSideA = cPlane.GetSide(vA);
		Plane::ESide nSideB = cPlane.GetSide(vB);

		// Clip
		if (nSideA == Plane::InFront || nSideA == Plane::Coinciding) {
			cClipped.AddVertex(vA);
			if (nSideB == Plane::Behind)
				cClipped.AddVertex(cPlane.ClipEdge(vA, vB));
		} else if (nSideB == Plane::InFront) {
			cClipped.AddVertex(cPlane.ClipEdge(vA, vB));
			cClipped.AddVertex(vB);
		}

	}

	// Return the clipped polygon
	return cClipped;
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:34,代码来源:Polygon.cpp

示例2: IsBehind

/**
*  @brief
*    Checks whether the polygon is completely behind the given plane
*/
bool Polygon::IsBehind(const Plane &cPlane) const
{
	for (uint32 i=0; i<m_lstVertices.GetNumOfElements(); i++) {
		if (cPlane.GetSide(m_lstVertices[i]) != Plane::Behind)
			return false; // Not behind
	}

	// Behind the given plane
	return true;
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:14,代码来源:Polygon.cpp

示例3: IsInFront

/**
*  @brief
*    Checks whether the polygon is completely in front of the given plane
*/
bool Polygon::IsInFront(const Plane &cPlane) const
{
	for (uint32 i=0; i<m_lstVertices.GetNumOfElements(); i++) {
		if (cPlane.GetSide(m_lstVertices[i]) != Plane::InFront)
			return false; // Not in front
	}

	// In front of the given plane
	return true;
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:14,代码来源:Polygon.cpp

示例4: Overlap

 Boole Overlap(const AxisAlignedBox& Box, const Plane& Surface)
 {
     return ( Plane::S_Both == Surface.GetSide(Box.GetCenter(),Box.GetHalfSize()) );
 }
开发者ID:,项目名称:,代码行数:4,代码来源:


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