public override Individual FromBinary(Stream stream) { var graph = new VertexGraph(); using (stream) { var reader = new BinaryReader(stream); for (int i = 0; i < VertexCount; i++) { var vertex = new Vertex(ReadNormalLong(reader), ReadNormalLong(reader), ReadNormalLong(reader), Max); graph.Vertices.Add(vertex); } var individual = new SkyscraperIndividual(graph); return individual; } }
//Calculates the distance between two Vertices public long DistanceTo(Vertex other) { return (long) Math.Sqrt(Math.Pow(X - other.X, 2) + Math.Pow(Y - other.Y, 2) + Math.Pow(Z - other.Z, 2)); }
public VertexBoundRigidBody(Vertex binding, RigidBodyConstructionInfo info) : base(info) { this.Binding = binding; }