예제 #1
0
    protected bool IsVertex(Geometry geometry, FormElement formElement)
    {
        if (!formElement.IsFull())
        {
            return(false);
        }
        if (formElement.count != 1)
        {
            return(false);
        }

        string[] fields = formElement.fields;

        int  id     = geometry.SignVertex(fields[0]);
        bool result = id >= 0;

        return(result);
    }
예제 #2
0
    protected bool IsTopEdge(TriPyramid triPyramid, FormElement formElement)
    {
        if (!formElement.IsFull())
        {
            return(false);
        }
        if (formElement.count != 2)
        {
            return(false);
        }

        string[] fields = formElement.fields;

        bool result = (triPyramid.IsSignTop(fields[0]) && triPyramid.IsSignBottom(fields[1])) ||
                      (triPyramid.IsSignTop(fields[1]) && triPyramid.IsSignBottom(fields[0]));

        return(result);
    }
예제 #3
0
    protected bool IsTwoVertex(Geometry geometry, FormElement formElement)
    {
        if (!formElement.IsFull())
        {
            return(false);
        }
        if (formElement.count != 2)
        {
            return(false);
        }

        string[] fields = formElement.fields;

        int  id1    = geometry.SignVertex(fields[0]);
        int  id2    = geometry.SignVertex(fields[1]);
        bool result = (id1 >= 0 && id2 >= 0) && (fields[0] != fields[1]);

        return(result);
    }
예제 #4
0
    protected bool IsTopTCorner(TriPyramid triPyramid, FormElement formElement)
    {
        if (!formElement.IsFull())
        {
            return(false);
        }
        if (formElement.count != 3)
        {
            return(false);
        }

        string[] fields = formElement.fields;

        bool result = triPyramid.IsSignTop(fields[1]) && triPyramid.IsSignBottom(fields[0]) && triPyramid.IsSignBottom(fields[2]);

        result = result && (fields[0] != fields[1]) && (fields[0] != fields[2]) && (fields[1] != fields[2]);

        return(result);
    }
예제 #5
0
    protected bool IsFace(Geometry geometry, FormElement formElement)
    {
        if (!formElement.IsFull())
        {
            return(false);
        }
        if (formElement.count < 3)
        {
            return(false);
        }

        string[] fields = formElement.fields;
        int[]    ids    = new int[fields.Length];
        for (int i = 0; i < fields.Length; i++)
        {
            ids[i] = geometry.SignVertex(fields[i]);
        }
        bool result = geometry.IsFace(ids);

        return(result);
    }
예제 #6
0
파일: Measure.cs 프로젝트: Y-dc/GeoSpace
    protected bool IsCorner(Geometry geometry, FormElement formElement)
    {
        if (!formElement.IsFull())
        {
            return(false);
        }
        if (formElement.count != 3)
        {
            return(false);
        }

        string[] fields = formElement.fields;

        int id1 = geometry.SignVertex(fields[0]);
        int id2 = geometry.SignVertex(fields[1]);
        int id3 = geometry.SignVertex(fields[2]);

        bool result = geometry.IsEdge(id1, id2) && geometry.IsEdge(id3, id2);

        result = result && (fields[0] != fields[1]) && (fields[0] != fields[2]) && (fields[1] != fields[2]);

        return(result);
    }
예제 #7
0
    protected FormElement EdgesToCorner(FormElement formElement1, FormElement formElement2)
    {
        FormElement result = new FormElement(3);

        if (!formElement1.IsFull() || !formElement2.IsFull())
        {
            return(result);
        }
        if (formElement1.count != 2 || formElement2.count != 2)
        {
            return(result);
        }

        string[] fields1 = formElement1.fields;
        string[] fields2 = formElement2.fields;

        Dictionary <string, int> map = new Dictionary <string, int>();

        MapIncrement(map, fields1[0]);
        MapIncrement(map, fields1[1]);
        MapIncrement(map, fields2[0]);
        MapIncrement(map, fields2[1]);

        List <KeyValuePair <string, int> > list = map.OrderBy(o => o.Value).ToList();

        if (list.Count != 3)
        {
            return(result);
        }

        result.fields[0] = list[0].Key;
        result.fields[1] = list[2].Key;
        result.fields[2] = list[1].Key;

        return(result);
    }