Beispiel #1
0
    public List <Solutions> SolvePosition(List <Constraint> guide, Dictionary <string, int> arraySize)
    {
        List <Solutions> res = new List <Solutions>();
        string           entityConstraints = BuildPositionConstraints(guide, arraySize);

        SolveConstraints(entityConstraints);
        List <String[]>  sol     = ParseSolution();
        int              pos     = 0;
        ConstraintObject current = objects[0];

        foreach (string entry in sol[0])
        {
            foreach (ConstraintObject e in objects)
            {
                if (e.GetType().ToString() == entry)
                {
                    current = e;
                    break;
                }
            }
            for (int i = 0; i < arraySize[entry]; i++)
            {
                res.Add(new Solutions(current, float.Parse(sol[1][pos]) / 10, float.Parse(sol[1][pos + 1]) / 10, float.Parse(sol[1][pos + 2]) / 10));
                pos += 3;
            }
        }
        return(res);
    }
Beispiel #2
0
 public Solutions(ConstraintObject type, float x, float y, float z)
 {
     this.type = type;
     pos       = new Vector3(x, y, z);
 }