Ejemplo n.º 1
0
        private static void CallCombine(Tesselator tess, ContourVertex intersectionVertex, int[] vertexIndexArray,
                                        double[] vertexWeights, bool needed)
        {
            var coords = new double[3];

            /* Copy coord data in case the callback changes it. */
            coords[0] = intersectionVertex.coords[0];
            coords[1] = intersectionVertex.coords[1];
            coords[2] = intersectionVertex.coords[2];

            intersectionVertex.clientIndex = 0;
            tess.CallCombine(coords, vertexIndexArray, vertexWeights, out intersectionVertex.clientIndex);
            if (intersectionVertex.clientIndex == 0)
            {
                if (!needed)
                {
                    intersectionVertex.clientIndex = vertexIndexArray[0];
                }
                else
                {
                    /* The only fatal error is when two edges are found to intersect,
                     * but the user has not provided the callback necessary to handle
                     * generated intersection points.
                     */
                    throw new Exception("You need to provided a callback to handle generated intersection points.");
                }
            }
        }