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


C++ AABB::CenterPoint方法代码示例

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


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

示例1: initTree

void ChunkManager::initTree(ChunkTree&  pChild)
{
    boost::shared_ptr<Chunk>& pChunk = pChild.getValue();
    

    AABB bounds = pChild.getParent()->getValue()->m_bounds;
    vec center = bounds.CenterPoint();
    vec c0 = bounds.CornerPoint(pChild.getCorner().index());

    AABB b0(vec(min(c0.x, center.x),
                min(c0.y, center.y),
                min(c0.z, center.z)), 
            vec(max(c0.x, center.x),
                max(c0.y, center.y),
                max(c0.z, center.z)));

    pChunk = boost::make_shared<Chunk>(b0, 1.0f/pChild.getLevel(), this);

    pChunk->m_pTree = &pChild;

    *pChunk->m_workInProgress = true;

    m_chunkGeneratorQueue.push(pChild.getValueCopy());

}
开发者ID:Regiuz,项目名称:GfxApi,代码行数:25,代码来源:ChunkManager.cpp

示例2: SetFrom

void OBB::SetFrom(const AABB &aabb)
{
    pos = aabb.CenterPoint();
    r = aabb.HalfSize();
    axis[0] = float3(1,0,0);
    axis[1] = float3(0,1,0);
    axis[2] = float3(0,0,1);
}
开发者ID:Ilikia,项目名称:naali,代码行数:8,代码来源:OBB.cpp

示例3: OBBSetFrom

void OBBSetFrom(OBB &obb, const AABB &aabb, const Matrix &m)
{
    obb.pos = m.MulPos(aabb.CenterPoint());
    float3 size = aabb.HalfSize();
    obb.axis[0] = m.MulDir(float3(size.x, 0, 0));
    obb.axis[1] = m.MulDir(float3(0, size.y, 0));
    obb.axis[2] = m.MulDir(float3(0, 0, size.z));
    obb.r.x = obb.axis[0].Normalize();
    obb.r.y = obb.axis[1].Normalize();
    obb.r.z = obb.axis[2].Normalize();
}
开发者ID:Ilikia,项目名称:naali,代码行数:11,代码来源:OBB.cpp

示例4: Intersects

/// Set Christer Ericson's Real-Time Collision Detection, p.164.
bool Plane::Intersects(const AABB &aabb) const
{
    float3 c = aabb.CenterPoint();
    float3 e = aabb.HalfDiagonal();

    // Compute the projection interval radius of the AABB onto L(t) = aabb.center + t * plane.normal;
    float r = e[0]*Abs(normal[0]) + e[1]*Abs(normal[1]) + e[2]*Abs(normal[2]);
    // Compute the distance of the box center from plane.
    float s = Dot(normal, c) - d;
    return Abs(s) <= r;
}
开发者ID:Ilikia,项目名称:naali,代码行数:12,代码来源:Plane.cpp

示例5: Intersects

/// The Plane-AABB intersection is implemented according to Christer Ericson's Real-Time Collision Detection, p.164. [groupSyntax]
bool Plane::Intersects(const AABB &aabb) const
{
	vec c = aabb.CenterPoint();
	vec e = aabb.HalfDiagonal();

	// Compute the projection interval radius of the AABB onto L(t) = aabb.center + t * plane.normal;
	float r = e[0]*Abs(normal[0]) + e[1]*Abs(normal[1]) + e[2]*Abs(normal[2]);
	// Compute the distance of the box center from plane.
//	float s = Dot(normal, c) - d;
	float s = Dot(normal.xyz(), c.xyz()) - d; ///\todo Use the above form when Plane is SSE'ized.
	return Abs(s) <= r;
}
开发者ID:ggf31416,项目名称:CompGraf1,代码行数:13,代码来源:Plane.cpp

示例6: AABBTransformAsAABB

void AABBTransformAsAABB(AABB &aabb, Matrix &m)
{
	float3 newCenter = m.MulPos(aabb.CenterPoint());

	float3 newDir;
	float3 h = aabb.HalfSize();
	// The following is equal to taking the absolute value of the whole matrix m.
	newDir.x = ABSDOT3(m[0], h);
	newDir.y = ABSDOT3(m[1], h);
	newDir.z = ABSDOT3(m[2], h);
	aabb.minPoint = newCenter - newDir;
	aabb.maxPoint = newCenter + newDir;
}
开发者ID:katik,项目名称:naali,代码行数:13,代码来源:AABB.cpp

示例7: min

void ChunkManager::initTree1(ChunkTree&  pChild)
{
    boost::shared_ptr<Chunk>& pChunk = pChild.getValue();

    AABB bounds = pChild.getParent()->getValue()->m_bounds;
    vec center = bounds.CenterPoint();
    vec c0 = bounds.CornerPoint(pChild.getCorner().index());

    AABB b0(vec(min(c0.x, center.x),
                min(c0.y, center.y),
                min(c0.z, center.z)), 
            vec(max(c0.x, center.x),
                max(c0.y, center.y),
                max(c0.z, center.z)));

    pChunk = boost::make_shared<Chunk>(b0, 1.0f/pChild.getLevel(), this);

    pChunk->m_pTree = &pChild;

    pChunk->generateTerrain();
    pChunk->generateMesh();

}
开发者ID:Regiuz,项目名称:GfxApi,代码行数:23,代码来源:ChunkManager.cpp

示例8: OBBSetFrom

void OBBSetFrom(OBB &obb, const AABB &aabb, const Matrix &m)
{
	assume(m.IsColOrthogonal()); // We cannot convert transform an AABB to OBB if it gets sheared in the process.
	assume(m.HasUniformScale()); // Nonuniform scale will produce shear as well.
	obb.pos = m.MulPos(aabb.CenterPoint());
	obb.r = aabb.HalfSize();
	obb.axis[0] = DIR_VEC(m.Col(0));
	obb.axis[1] = DIR_VEC(m.Col(1));
	obb.axis[2] = DIR_VEC(m.Col(2));
	// If the matrix m contains scaling, propagate the scaling from the axis vectors to the half-length vectors,
	// since we want to keep the axis vectors always normalized in our representation.
	float matrixScale = obb.axis[0].LengthSq();
	matrixScale = Sqrt(matrixScale);
	obb.r *= matrixScale;
	matrixScale = 1.f / matrixScale;
	obb.axis[0] *= matrixScale;
	obb.axis[1] *= matrixScale;
	obb.axis[2] *= matrixScale;

//	mathassert(vec::AreOrthogonal(obb.axis[0], obb.axis[1], obb.axis[2]));
//	mathassert(vec::AreOrthonormal(obb.axis[0], obb.axis[1], obb.axis[2]));
	///@todo Would like to simply do the above, but instead numerical stability requires to do the following:
	vec::Orthonormalize(obb.axis[0], obb.axis[1], obb.axis[2]);
}
开发者ID:OtterOrder,项目名称:TBToolkit,代码行数:24,代码来源:OBB.cpp


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