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


C# INode.GetCoords方法代码示例

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


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

示例1: ProcessTerminal

    private void ProcessTerminal(INode node, float tx0, float ty0, float tz0)
    {
        var entryDistance = Mathf.Max(tx0, ty0, tz0);

        var entryPlane = GetEntryPlane(tx0, ty0, tz0);

        var normal = GetNormal(entryPlane);
        if (_debug) {
            const float normalSize = 1f;
            Debug.DrawLine(_ray.origin, _ray.GetPoint(entryDistance), Color.white, 0, false);

            Debug.DrawLine(_ray.GetPoint(entryDistance),
                _ray.GetPoint(entryDistance) + _transform.TransformDirection(normal) * normalSize, Color.green, 0, false);

            var bounds = node.GetBounds();
            DrawBounds(bounds, Color.cyan, true);
        }

        var result = new RayIntersectionResult(_tree, node, node.GetCoords(), entryDistance, _ray.GetPoint(entryDistance),
            normal, GetNeighbourSide(entryPlane));

        if (_filter == null || _filter(result)) {
            results.Add(result);
        }
    }
开发者ID:toxicFork,项目名称:vox,代码行数:25,代码来源:RayIntersection.cs

示例2: RayIntersection

    public RayIntersection(Transform transform, IOctree octree, Ray r, bool intersectMultiple, int? wantedDepth,
		Filter filter, bool debug = false)
    {
        _filter = filter;

        _debug = debug;
        _tree = octree;
        _rootNode = octree.GetRoot();
        if (_rootNode == null) {
            //we had a good run guys, time to call it a day
            return;
        }

        _transform = transform;
        _ray = r;
        _intersectMultiple = intersectMultiple;
        _dimensionFlipFlags = 0;

        var rootBounds = _rootNode.GetBounds();
        if (_debug) {
            DrawBounds(rootBounds, Color.gray);
        }

        var rootCenter = rootBounds.center;

        var ro = transform.InverseTransformPoint(r.origin) - rootCenter;
        var rd = transform.InverseTransformDirection(r.direction);

        var rox = ro.x;
        var roy = ro.y;
        var roz = ro.z;

        var rdx = rd.x;
        var rdy = rd.y;
        var rdz = rd.z;

        var ocMin = rootBounds.min - rootCenter;
        var ocMax = rootBounds.max - rootCenter;

        if (rdx < 0.0f) {
            rox = -rox;
            rdx = -rdx;
            _dimensionFlipFlags |= 1;
        }

        if (rdy < 0.0f) {
            roy = -roy;
            rdy = -rdy;
            _dimensionFlipFlags |= 2;
        }

        if (rdz < 0.0f) {
            roz = -roz;
            rdz = -rdz;
            _dimensionFlipFlags |= 4;
        }

        float tx0, tx1, ty0, ty1, tz0, tz1;

        if (!Mathf.Approximately(rdx, 0.0f)) {
            tx0 = (ocMin.x - rox) / rdx;
            tx1 = (ocMax.x - rox) / rdx;
        } else {
            tx0 = 99999.9f;
            tx1 = 99999.9f;
        }

        if (!Mathf.Approximately(rdy, 0.0f)) {
            ty0 = (ocMin.y - roy) / rdy;
            ty1 = (ocMax.y - roy) / rdy;
        } else {
            ty0 = 99999.9f;
            ty1 = 99999.9f;
        }

        if (!Mathf.Approximately(rdz, 0.0f)) {
            tz0 = (ocMin.z - roz) / rdz;
            tz1 = (ocMax.z - roz) / rdz;
        } else {
            tz0 = 99999.9f;
            tz1 = 99999.9f;
        }

        if (_debug) {
            Debug.DrawLine(_ray.origin, _ray.GetPoint(5000), Color.yellow);
        }

        if (Mathf.Max(tx0, ty0, tz0) < Mathf.Min(tx1, ty1, tz1)) {
            ProcSubtree(tx0, ty0, tz0, tx1, ty1, tz1, _rootNode, _rootNode.IsSolid(), 0, wantedDepth,
                _rootNode.GetCoords());
        }
    }
开发者ID:toxicFork,项目名称:vox,代码行数:92,代码来源:RayIntersection.cs


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