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


C++ line::start方法代码示例

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


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

示例1:

	std::pair<bool, vector3> plane::intersection(const line& l)const
	{
		auto ret = std::make_pair<bool, vector3>(false, vector3());
		if (isInPlane(l))
			return ret;

		ret.first = true;
		auto t = (norm_.dotProduct(point_) - norm_.dotProduct(l.start())) / (norm_.dotProduct(l.dir()));
		ret.second = l.start() + t * l.dir();
		return ret;
	}
开发者ID:zouxiaohang,项目名称:zengine,代码行数:11,代码来源:plane.cpp

示例2: isInPlane

	bool plane::isInPlane(const line& l)const
	{
		auto dot = norm_.dotProduct(l.dir());
		if (!floatEqual(dot, 0.0f))
			return false;

		return isInPlane(l.start());
	}
开发者ID:zouxiaohang,项目名称:zengine,代码行数:8,代码来源:plane.cpp

示例3: if

__HOST____DEVICE__
scalar line<point2D, const point2D&>::nearestDist
(
    const line<point2D, const point2D&>& e,
    point2D& thisPt,
    point2D& edgePt
) const
{
    vector2D u = end()-start();
    vector2D v = e.end()-e.start();
    vector2D w = start()-e.start();

    scalar d = u.perp(v);

    if (Foam::mag(d) > VSMALL)
    {
        scalar s = v.perp(w) / d;

        if (s <= SMALL)
        {
            thisPt = start();
        }
        else if (s >= (1-SMALL))
        {
            thisPt = end();
        }
        else
        {
            thisPt = start()+s*u;
        }


        scalar t = u.perp(w) / d;

        if (t <= SMALL)
        {
            edgePt = e.start();
        }
        else if (t >= (1-SMALL))
        {
            edgePt = e.end();
        }
        else
        {
            edgePt = e.start()+t*v;
        }
    }
    else
    {
        // Parallel lines. Find overlap of both lines by projecting onto
        // direction vector (now equal for both lines).

        scalar edge0 = e.start() & u;
        scalar edge1 = e.end() & u;
        bool edgeOrder = edge0 < edge1;

        scalar minEdge = (edgeOrder ? edge0 : edge1);
        scalar maxEdge = (edgeOrder ? edge1 : edge0);
        const point2D& minEdgePt = (edgeOrder ? e.start() : e.end());
        const point2D& maxEdgePt = (edgeOrder ? e.end() : e.start());

        scalar this0 = start() & u;
        scalar this1 = end() & u;
        bool thisOrder = this0 < this1;

        scalar minThis = min(this0, this1);
        scalar maxThis = max(this1, this0);
        const point2D& minThisPt = (thisOrder ? start() : end());
        const point2D& maxThisPt = (thisOrder ? end() : start());

        if (maxEdge < minThis)
        {
            // edge completely below *this
            edgePt = maxEdgePt;
            thisPt = minThisPt;
        }
        else if (maxEdge < maxThis)
        {
            // maxEdge inside interval of *this
            edgePt = maxEdgePt;
            thisPt = nearestDist(edgePt).rawPoint();
        }
        else
        {
            // maxEdge outside. Check if minEdge inside.
            if (minEdge < minThis)
            {
                // Edge completely envelops this. Take any this point and
                // determine nearest on edge.
                thisPt = minThisPt;
                edgePt = e.nearestDist(thisPt).rawPoint();
            }
            else if (minEdge < maxThis)
            {
                // minEdge inside this interval.
                edgePt = minEdgePt;
                thisPt = nearestDist(edgePt).rawPoint();
            }
            else
            {
//.........这里部分代码省略.........
开发者ID:Kiiree,项目名称:RapidCFD-dev,代码行数:101,代码来源:line.C


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