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


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

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


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

示例1: Intersects

bool Polygon::Intersects(const Plane &plane) const
{
    Line intersectLine;
    bool intersects = plane.Intersects(PlaneCCW(), &intersectLine);
    if (!intersects)
        return false;
    return Intersects(intersectLine);
}
开发者ID:katik,项目名称:naali,代码行数:8,代码来源:Polygon.cpp

示例2: Intersects

bool Plane::Intersects(const Plane &plane, const Plane &plane2, Line *outLine, vec *outPoint) const
{
	Line dummy;
	if (!outLine)
		outLine = &dummy;

	// First check all planes for parallel pairs.
	if (this->IsParallel(plane) || this->IsParallel(plane2))
	{
		if (EqualAbs(d, plane.d) || EqualAbs(d, plane2.d))
		{
			bool intersect = plane.Intersects(plane2, outLine);
			if (intersect && outPoint)
				*outPoint = outLine->GetPoint(0);
			return intersect;
		}
		else
			return false;
	}
	if (plane.IsParallel(plane2))
	{
		if (EqualAbs(plane.d, plane2.d))
		{
			bool intersect = this->Intersects(plane, outLine);
			if (intersect && outPoint)
				*outPoint = outLine->GetPoint(0);
			return intersect;
		}
		else
			return false;
	}

	// All planes point to different directions.
	float3x3 m;
	m.SetRow(0, DIR_TO_FLOAT3(normal));
	m.SetRow(1, DIR_TO_FLOAT3(plane.normal));
	m.SetRow(2, DIR_TO_FLOAT3(plane2.normal));
	float3 intersectionPos;
	bool success = m.SolveAxb(float3(d, plane.d, plane2.d), intersectionPos);
	if (!success)
		return false;
	if (outPoint)
		*outPoint = POINT_VEC(intersectionPos);
	return true;
}
开发者ID:ggf31416,项目名称:CompGraf1,代码行数:45,代码来源:Plane.cpp

示例3: Intersects

bool Plane::Intersects(const Plane &plane, const Plane &plane2, Line *outLine, float3 *outPoint) const
{
    Line dummy;
    if (!outLine)
        outLine = &dummy;

    // First check all planes for parallel pairs.
    if (this->IsParallel(plane) || this->IsParallel(plane2))
    {
        if (EqualAbs(d, plane.d) || EqualAbs(d, plane2.d))
        {
            bool intersect = plane.Intersects(plane2, outLine);
            if (intersect && outPoint)
                *outPoint = outLine->GetPoint(0);
            return intersect;
        }
        else
            return false;
    }
    if (plane.IsParallel(plane2))
    {
        if (EqualAbs(plane.d, plane2.d))
        {
            bool intersect = this->Intersects(plane, outLine);
            if (intersect && outPoint)
                *outPoint = outLine->GetPoint(0);
            return intersect;
        }
        else
            return false;
    }

    // All planes point to different directions.
    float3x3 m;
    m.SetRow(0, normal);
    m.SetRow(1, plane.normal);
    m.SetRow(2, plane2.normal);
    bool success = m.Inverse();
    if (!success)
        return false;
    if (outPoint)
        *outPoint = m * float3(d, plane.d, plane2.d);
    return true;
}
开发者ID:Ilikia,项目名称:naali,代码行数:44,代码来源:Plane.cpp

示例4: Intersects

bool Sphere::Intersects(const Plane &plane) const
{
	return plane.Intersects(*this);
}
开发者ID:juj,项目名称:MathGeoLib,代码行数:4,代码来源:Sphere.cpp

示例5: Intersects

bool AABB::Intersects(const Plane &plane) const
{
	return plane.Intersects(*this);
}
开发者ID:ChunHungLiu,项目名称:MathGeoLib,代码行数:4,代码来源:AABB.cpp

示例6: Intersects

bool Frustum::Intersects(const Plane &plane) const
{
	return plane.Intersects(*this);
}
开发者ID:chengzg,项目名称:MathGeoLib,代码行数:4,代码来源:Frustum.cpp

示例7: Intersects

bool Ray::Intersects(const Plane &plane, float *d) const
{
    return plane.Intersects(*this, d);
}
开发者ID:Ilikia,项目名称:naali,代码行数:4,代码来源:Ray.cpp

示例8: Intersects

bool Ray::Intersects(const Plane &plane) const
{
	return plane.Intersects(*this, 0);
}
开发者ID:ggf31416,项目名称:CompGraf1,代码行数:4,代码来源:Ray.cpp

示例9: Intersects

bool Triangle::Intersects(const Plane &plane) const
{
    return plane.Intersects(*this);
}
开发者ID:katik,项目名称:naali,代码行数:4,代码来源:Triangle.cpp

示例10: Intersects

int Circle::Intersects(const Plane &plane) const
{
	return plane.Intersects(*this);
}
开发者ID:360degrees-fi,项目名称:tundra,代码行数:4,代码来源:Circle.cpp

示例11: Intersects

bool Polyhedron::Intersects(const Plane &plane) const
{
	return plane.Intersects(*this);
}
开发者ID:360degrees-fi,项目名称:tundra,代码行数:4,代码来源:Polyhedron.cpp


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