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)); }
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); }
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 }); }
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) }); }
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) }); }
public static RecastVertex Mult(RecastVertex left, int scale) { return(new RecastVertex { X = left.X * scale, Y = left.Y * scale, Z = left.Z * scale }); }
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 }); }
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 }); }
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++); }
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(); }
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)); }
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); } } }
public RecastVertex(RecastVertex copy) : this() { X = copy.X; Y = copy.Y; Z = copy.Z; }
public static float Dot(RecastVertex left, RecastVertex right) { return(left.X * right.X + left.Y * right.Y + left.Z * right.Z); }