Exemplo n.º 1
0
        public static float Distance(RecastVertex left, RecastVertex right)
        {
            float dx = right.X - left.X;
            float dy = right.Y - left.Y;
            float dz = right.Z - left.Z;

            return((float)Math.Sqrt(dx * dx + dy * dy + dz * dz));
        }
Exemplo n.º 2
0
        public static float SquareDistance(RecastVertex left, RecastVertex right)
        {
            float dx = right.X - left.X;
            float dy = right.Y - left.Y;
            float dz = right.Z - left.Z;

            return(dx * dx + dy * dy + dz * dz);
        }
Exemplo n.º 3
0
 public static RecastVertex Cross(RecastVertex left, RecastVertex right)
 {
     return(new RecastVertex
     {
         X = left.Y * right.Z - left.Z * right.Y,
         Y = left.Z * right.X - left.X * right.Z,
         Z = left.X * right.Y - left.Y * right.X
     });
 }
Exemplo n.º 4
0
 public static RecastVertex Max(RecastVertex left, RecastVertex right)
 {
     return(new RecastVertex
     {
         X = Math.Max(left.X, right.X),
         Y = Math.Max(left.Y, right.Y),
         Z = Math.Max(left.Z, right.Z)
     });
 }
Exemplo n.º 5
0
 public static RecastVertex Mult(RecastVertex left, RecastVertex right, int scale)
 {
     return(new RecastVertex
     {
         X = left.X + (right.X * scale),
         Y = left.Y + (right.Y * scale),
         Z = left.Z + (right.Z * scale)
     });
 }
Exemplo n.º 6
0
 public static RecastVertex Mult(RecastVertex left, int scale)
 {
     return(new RecastVertex
     {
         X = left.X * scale,
         Y = left.Y * scale,
         Z = left.Z * scale
     });
 }
Exemplo n.º 7
0
 public static RecastVertex Sub(RecastVertex left, RecastVertex right)
 {
     return(new RecastVertex
     {
         X = left.X - right.X,
         Y = left.Y - right.Y,
         Z = left.Z - right.Z
     });
 }
Exemplo n.º 8
0
 public static RecastVertex Add(RecastVertex left, RecastVertex right)
 {
     return(new RecastVertex
     {
         X = left.X + right.X,
         Y = left.Y + right.Y,
         Z = left.Z + right.Z
     });
 }
Exemplo n.º 9
0
 public void AddOffMeshConnection(RecastVertex start, RecastVertex end, float radius, bool biDirectional,
                                  short area, int flags)
 {
     OffMeshConnectionVerts.AddRange(new [] { start.X, start.Y, start.Z, end.X, end.Y, end.Z });
     OffMeshConnectionRadii.Add(radius);
     OffMeshConnectionDirections.Add(biDirectional ? 1 : 0);
     OffMeshConnectionAreas.Add(area);
     OffMeshConnectionFlags.Add(flags);
     OffMeshConnectionIds.Add(1000 + OffMeshConnectionCount++);
 }
Exemplo n.º 10
0
        private void CalcTriNormal(RecastVertex v0, RecastVertex v1, RecastVertex v2, out float[] norm)
        {
            RecastVertex e0, e1, n;

            e0 = RecastVertex.Sub(v1, v0);
            e1 = RecastVertex.Sub(v2, v0);
            n  = RecastVertex.Cross(e0, e1);
            n.Normalize();
            norm = n.ToArray();
        }
Exemplo n.º 11
0
 public bool Equals(RecastVertex other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other.X.Equals(X) && other.Y.Equals(Y) && other.Z.Equals(Z));
 }
Exemplo n.º 12
0
 public void CalculateBounds()
 {
     if (Vertexes.Count != 0)
     {
         MinBounds = Vertexes[0];
         MaxBounds = Vertexes[0];
         foreach (RecastVertex recastVertex in Vertexes)
         {
             MinBounds = RecastVertex.Min(MinBounds, recastVertex);
             MaxBounds = RecastVertex.Max(MaxBounds, recastVertex);
         }
     }
 }
Exemplo n.º 13
0
 public RecastVertex(RecastVertex copy) : this()
 {
     X = copy.X;
     Y = copy.Y;
     Z = copy.Z;
 }
Exemplo n.º 14
0
 public static float Dot(RecastVertex left, RecastVertex right)
 {
     return(left.X * right.X + left.Y * right.Y + left.Z * right.Z);
 }