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


C# Plane.DotCoordinate方法代码示例

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


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

示例1: wall_avoidance

        public Vector3 wall_avoidance()
        {
            makeFeelers();

            Plane worldPlane = new Plane(new Vector3(0, 1, 0), 0);
            Vector3 force = Vector3.Zero;

            foreach (Vector3 feeler in fighter.Feelers)
            {
                float dot = worldPlane.DotCoordinate(feeler);
                if (dot < 0)
                {
                    float distance = Math.Abs(dot - worldPlane.D);
                    force += worldPlane.Normal * distance;
                }
            }

            if (force.Length() > 0.0)
            {
                fighter.DrawFeelers = true;
            }
            else
            {
                fighter.DrawFeelers = false;
            }
            fighter.DrawAxis = false;
            return force;
        }
开发者ID:elena1905,项目名称:DoctorWho,代码行数:28,代码来源:SteeringBehavoiurs.cs

示例2: Intersects

        /// <summary>
        /// Classify the triangle (v0,v1,v2) with respect to the given plane.
        /// </summary>
        public static PlaneIntersectionType Intersects(ref Plane plane, ref Vector3 v0, ref Vector3 v1, ref Vector3 v2)
        {
            float dV0 = plane.DotCoordinate(v0);
            float dV1 = plane.DotCoordinate(v1);
            float dV2 = plane.DotCoordinate(v2);

            if (Math.Min(dV0, Math.Min(dV1, dV2)) >= 0)
            {
                return PlaneIntersectionType.Front;
            }
            if (Math.Max(dV0, Math.Max(dV1, dV2)) <= 0)
            {
                return PlaneIntersectionType.Back;
            }
            return PlaneIntersectionType.Intersecting;
        }
开发者ID:Gevil,项目名称:Projects,代码行数:19,代码来源:TriangleTest.cs

示例3: ClosestPointOnPlane

 public static Vector3 ClosestPointOnPlane(Vector3 point, Plane plane)
 {
     return (point - plane.Normal * plane.DotCoordinate(point));
 }
开发者ID:WCell,项目名称:WCell-Terrain,代码行数:4,代码来源:Intersection.cs

示例4: Split

 private void Split(OCTPoly poly, Plane p, ref OCTPoly[] newPolys, out int numPolys)
 {
     numPolys = 0;
     var num = p.DotCoordinate(poly.Verts[0]);
     var num2 = p.DotCoordinate(poly.Verts[1]);
     var num3 = p.DotCoordinate(poly.Verts[2]);
     var vector = MathExtensions.NormalFromPoints(poly.Verts[0], poly.Verts[1], poly.Verts[2]);
     if (((num > 0f) && (num2 > 0f)) && (num3 > 0f))
     {
         newPolys[0] = new OCTPoly(poly.Verts[0], poly.Verts[1], poly.Verts[2]);
         numPolys = 1;
     }
     else if (((num < 0f) && (num2 < 0f)) && (num3 < 0f))
     {
         numPolys = 0;
     }
     else if (((num == 0f) && (num2 == 0f)) && (num3 == 0f))
     {
         if (p.DotNormal(vector) >= 0f)
         {
             newPolys[0] = new OCTPoly(poly.Verts[0], poly.Verts[1], poly.Verts[2]);
             numPolys = 1;
         }
         else
         {
             numPolys = 0;
         }
     }
     else
     {
         var vectorArray = new Vector3[4];
         var num4 = 0;
         for (var i = 0; i < 3; i++)
         {
             var vector2 = poly.Verts[i];
             var vector3 = poly.Verts[((i + 1) > 2) ? 0 : (i + 1)];
             var num6 = p.DotCoordinate(vector2);
             var num7 = p.DotCoordinate(vector3);
             if (num6 >= 0f)
             {
                 vectorArray[num4++] = vector2;
             }
             if (((num7 <= 0f) && (num6 > 0f)) || ((num7 >= 0f) && (num6 < 0f)))
             {
                 var zero = Vector3.Zero;
                 if (Intersection.LineSegmentIntersectsPlane(vector2, vector3, p, ref zero))
                 {
                     vectorArray[num4++] = zero;
                 }
             }
         }
         switch (num4)
         {
             case 3:
             case 4:
                 newPolys[0] = new OCTPoly(vectorArray[0], vectorArray[1], vectorArray[2]);
                 numPolys = 1;
                 if (num4 == 4)
                 {
                     newPolys[1] = new OCTPoly(vectorArray[0], vectorArray[2], vectorArray[3]);
                     numPolys = 2;
                 }
                 break;
         }
     }
 }
开发者ID:WCell,项目名称:WCell-Terrain,代码行数:66,代码来源:OCTreeBuilder.cs


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