Esempio n. 1
0
        private static bool isBorderByPosition(int vertex, V2FDict ref_dict)
        {
#if IGNORE_NEAR
            if (checkNear(vertex) >= 0)
            {
                return(false);
            }
#endif
            if (ref_dict[vertex].Count < MIN_FACES)
            {
                return(true);
            }
            PEPlugin.SDX.V3 around = new PEPlugin.SDX.V3(0.0f, 0.0f, 0.0f);
            foreach (int[] face in ref_dict[vertex])
            {
                int             pos = Array.IndexOf(face, vertex);
                int             v1  = face[(pos + 1) % 3];
                int             v2  = face[(pos + 2) % 3];
                PEPlugin.SDX.V3 sub =
                    all_vertex_list[v2].Position -
                    all_vertex_list[v1].Position;
                around = around + sub;
            }
            return(norm2(around) > NEAR * NEAR);
        }
Esempio n. 2
0
        private static int checkNear(int vertex)
        {
            int index = reverse_v[vertex];

            while (index < sorted_v.Length - 1)
            {
                index++;
                PEPlugin.SDX.V3 sub_next =
                    all_vertex_list[vertex].Position -
                    all_vertex_list[sorted_v[index]].Position;
                if (sub_next.Y * sub_next.Y >= NEAR * NEAR)
                {
                    break;
                }
                if (norm2(sub_next) < NEAR * NEAR)
                {
                    return(index + 1);
                }
            }
            index = reverse_v[vertex];
            while (index > 1)
            {
                index--;
                PEPlugin.SDX.V3 sub_before =
                    all_vertex_list[vertex].Position -
                    all_vertex_list[sorted_v[index]].Position;
                if (sub_before.Y * sub_before.Y >= NEAR * NEAR)
                {
                    break;
                }
                if (norm2(sub_before) < NEAR * NEAR)
                {
                    return(index - 1);
                }
            }
            return(-1);
        }
Esempio n. 3
0
 private static float norm2(PEPlugin.SDX.V3 v)
 {
     return(v.X * v.X + v.Y * v.Y + v.Z * v.Z);
 }