示例#1
0
        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;
            }
        }
示例#2
0
文件: VertexGraph.cs 项目: kylc/seve
 //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));
 }
示例#3
0
 public VertexBoundRigidBody(Vertex binding, RigidBodyConstructionInfo info)
     : base(info)
 {
     this.Binding = binding;
 }