Esempio n. 1
0
        /// <summary>
        /// gets the dual <see cref="Edge"/> of the <see cref="Face"/>. The Edge is <see cref="Face.Bounds"/>[inLoop][id].
        /// </summary>
        /// <param name="Face">Face from the edge.</param>
        /// <param name="inLoop">Index in <see cref="Face.Bounds"/>.</param>
        /// <param name="id">Index in <see cref="Face.Bounds"/>[inLoop]</param>
        /// <returns>the dual <see cref="Edge"/>.</returns>
        public static Edge GetDualEdge(Face Face, int inLoop, int id)
        {
            Edge     E        = Face.Bounds[inLoop][id];
            Vertex3d A        = E.EdgeStart;
            Vertex3d B        = E.EdgeEnd;
            Face     Neighbor = Face.Neighbor(inLoop, id) as Face;

            if (Neighbor == null)
            {
                return(null);
            }
            int OutLoop = -1;

            for (int i1 = 0; i1 < Neighbor.Bounds.Count; i1++)
            {
                OutLoop = i1;

                for (int i = 0; i < Neighbor.Bounds[i1].Count; i++)
                {
                    if (((Neighbor.Bounds[i1][i].EdgeStart.Value.dist(B.Value) < 0.00001) &&
                         (Neighbor.Bounds[i1][i].EdgeEnd.Value.dist(A.Value) < 0.00001)) ||
                        ((Neighbor.Bounds[i1][i].EdgeStart.Value.dist(A.Value) < 0.00001)) &&
                        (Neighbor.Bounds[i1][i].EdgeEnd.Value.dist(B.Value) < 0.00001))
                    {
                        return(Neighbor.Bounds[i1][i]);
                    }
                }
            }
            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// gets the dual <see cref="Edge"/> in a <see cref="Face"/> which is given by <see cref="Face.Bounds"/>[Bound][(int)Param] In <b>OutBound</b> is the index of the dual <see cref="Edge"/> relativ to <b>Neighbor.Bounds</b>
        /// and the result value gives the parameter for the <see cref="Edge.ParamCurve"/> of this <see cref="Edge"/>. <b>Neighbor</b> is the neighbor <see cref="Face"/>.
        /// If no dual edge is found -1 will be returned.
        /// </summary>
        /// <param name="Face"><see cref="Face"/> in which <b>Bound</b> and <b>Param</b> are taken.</param>
        /// <param name="Bound">gives together with <b>Param</b> the <see cref="Edge"/> by <see cref="Face.Bounds"/>[Bound][(int)Param].</param>
        /// <param name="Param">gives together with <b>Bound</b> the <see cref="Edge"/> by <see cref="Face.Bounds"/>[Bound][(int)Param].</param>
        /// <param name="OutBound">is the bound index of the dual edge.</param>
        /// <param name="Neighbor">is the neighbor of <b>Face</b>.</param>
        /// <returns>a parameter, which gives togethe with <b>Outbound</b> the same point in the <b>dualedge</b> with dualedge.Paramcurve.value(parameter-(int)parameter.</returns>
        public static double GetDualEdge(Face Face, int Bound, double Param, ref int OutBound, ref Face Neighbor)
        {
            Edge E = Face.Bounds[Bound][(int)Param];

            Vertex3d A = E.EdgeStart;
            Vertex3d B = E.EdgeEnd;

            Neighbor = Face.Neighbor(Bound, (int)Param) as Face;
            if (Neighbor == null)
            {
                return(-1);
            }
            OutBound = -1;
            for (int i1 = 0; i1 < Neighbor.Bounds.Count; i1++)
            {
                OutBound = i1;

                for (int i = 0; i < Neighbor.Bounds[i1].Count; i++)
                {
                    if ((Neighbor.Bounds[i1][i].EdgeStart == B) &&
                        (Neighbor.Bounds[i1][i].EdgeEnd == A))
                    {
                        if (Param != (int)Param)
                        {
                            return(i + (1 - (Param - (int)Param)));
                        }

                        return(i);
                    }
                    if ((Neighbor.Bounds[i1][i].EdgeStart == A) &&
                        (Neighbor.Bounds[i1][i].EdgeEnd == B))
                    {
                        if (Param != (int)Param)
                        {
                            return(i + (1 - (Param - (int)Param)));
                        }
                        return(i);
                    }
                }
            }

            return(-1);
        }