protected override Punto CompletarPunto(Punto puntoCentro)
 {
     if (Orientacion.Equals(OrientacionesCara.Abajo))
     {
         return(puntoCentro.SumarPunto(new Punto(0, 0, Figura.PasoZ)));
     }
     else if (Orientacion.Equals(OrientacionesCara.Adelante))
     {
         return(puntoCentro.SumarPunto(new Punto(-Figura.PasoX, 0, 0)));
     }
     else if (Orientacion.Equals(OrientacionesCara.Arriba))
     {
         return(puntoCentro.SumarPunto(new Punto(0, 0, -Figura.PasoZ)));
     }
     else if (Orientacion.Equals(OrientacionesCara.Atraz))
     {
         return(puntoCentro.SumarPunto(new Punto(Figura.PasoX, 0, 0)));
     }
     else if (Orientacion.Equals(OrientacionesCara.Derecha))
     {
         return(puntoCentro.SumarPunto(new Punto(0, -Figura.PasoY, 0)));
     }
     else //if (Orientacion.Equals(OrientacionesCara.Izquierda))
     {
         return(puntoCentro.SumarPunto(new Punto(0, Figura.PasoY, 0)));
     }
 }
Beispiel #2
0
        /// <summary>
        /// Promedia las normales calculadas con todos los puntos de alrededor
        /// </summary>
        /// <param name="verticeCentro"></param>
        /// <param name="verticeNorte"></param>
        /// <param name="verticeEste"></param>
        /// <param name="verticeSur"></param>
        /// <param name="verticeOeste"></param>
        /// <returns></returns>
        public static Punto CalcularNormal(Punto verticeCentro, Punto verticeNorte, Punto verticeEste, Punto verticeSur, Punto verticeOeste, Boolean invertirSentido)
        {
            if (verticeCentro == null) throw new InvalidOperationException("Este método no puede ser invocado con el vertice central nulo");

            // Numeradas en sentido horario son 4
            Punto normalNorEste = null;
            Punto normalSurEste = null;
            Punto normalSurOeste = null;
            Punto normalNorOeste = null;
            Punto normalRetorno = null;

            if (verticeNorte != null && verticeEste != null)
            {
                if (invertirSentido) normalNorEste = (verticeNorte - verticeCentro) * (verticeEste - verticeCentro);
                else normalNorEste = (verticeEste - verticeCentro) * (verticeNorte - verticeCentro);
            }

            if (verticeSur != null && verticeEste != null)
            {
                if (invertirSentido) normalSurEste = (verticeEste - verticeCentro) * (verticeSur - verticeCentro);
                else normalSurEste = (verticeSur - verticeCentro) * (verticeEste - verticeCentro);
            }

            if (verticeSur != null && verticeOeste != null)
            {
                if (invertirSentido) normalSurOeste = (verticeSur - verticeCentro) * (verticeOeste - verticeCentro);
                else normalSurOeste = (verticeOeste - verticeCentro) * (verticeSur - verticeCentro);
            }

            if (verticeNorte != null && verticeOeste != null)
            {
                if (invertirSentido) normalNorOeste = (verticeOeste - verticeCentro) * (verticeNorte - verticeCentro);
                else normalNorOeste = (verticeNorte - verticeCentro) * (verticeOeste - verticeCentro);
            }

            normalRetorno = new Punto(0, 0, 0);

            if (normalNorEste != null)
                normalRetorno = normalRetorno.SumarPunto(normalNorEste);

            if (normalNorOeste != null)
                normalRetorno = normalRetorno.SumarPunto(normalNorOeste);

            if (normalSurEste != null)
                normalRetorno = normalRetorno.SumarPunto(normalSurEste);

            if (normalSurOeste != null)
                normalRetorno = normalRetorno.SumarPunto(normalSurOeste);

            return normalRetorno;
        }
 protected override Punto CompletarPunto(Punto puntoCentro)
 {
     if (Orientacion.Equals(OrientacionesCara.Abajo))
     {
         return puntoCentro.SumarPunto(new Punto(0, 0, Figura.PasoZ));
     }
     else if (Orientacion.Equals(OrientacionesCara.Adelante))
     {
         return puntoCentro.SumarPunto(new Punto(-Figura.PasoX, 0, 0));
     }
     else if (Orientacion.Equals(OrientacionesCara.Arriba))
     {
         return puntoCentro.SumarPunto(new Punto(0, 0, -Figura.PasoZ));
     }
     else if (Orientacion.Equals(OrientacionesCara.Atraz))
     {
         return puntoCentro.SumarPunto(new Punto(Figura.PasoX, 0, 0));
     }
     else if (Orientacion.Equals(OrientacionesCara.Derecha))
     {
         return puntoCentro.SumarPunto(new Punto(0, -Figura.PasoY, 0));
     }
     else //if (Orientacion.Equals(OrientacionesCara.Izquierda))
     {
         return puntoCentro.SumarPunto(new Punto(0, Figura.PasoY, 0));
     }
 }
Beispiel #4
0
        /// <summary>
        /// Promedia las normales calculadas con todos los puntos de alrededor
        /// </summary>
        /// <param name="verticeCentro"></param>
        /// <param name="verticeNorte"></param>
        /// <param name="verticeEste"></param>
        /// <param name="verticeSur"></param>
        /// <param name="verticeOeste"></param>
        /// <returns></returns>
        public static Punto CalcularNormal(Punto verticeCentro, Punto verticeNorte, Punto verticeEste, Punto verticeSur, Punto verticeOeste, Boolean invertirSentido)
        {
            if (verticeCentro == null)
            {
                throw new InvalidOperationException("Este método no puede ser invocado con el vertice central nulo");
            }

            // Numeradas en sentido horario son 4
            Punto normalNorEste  = null;
            Punto normalSurEste  = null;
            Punto normalSurOeste = null;
            Punto normalNorOeste = null;
            Punto normalRetorno  = null;

            if (verticeNorte != null && verticeEste != null)
            {
                if (invertirSentido)
                {
                    normalNorEste = (verticeNorte - verticeCentro) * (verticeEste - verticeCentro);
                }
                else
                {
                    normalNorEste = (verticeEste - verticeCentro) * (verticeNorte - verticeCentro);
                }
            }

            if (verticeSur != null && verticeEste != null)
            {
                if (invertirSentido)
                {
                    normalSurEste = (verticeEste - verticeCentro) * (verticeSur - verticeCentro);
                }
                else
                {
                    normalSurEste = (verticeSur - verticeCentro) * (verticeEste - verticeCentro);
                }
            }

            if (verticeSur != null && verticeOeste != null)
            {
                if (invertirSentido)
                {
                    normalSurOeste = (verticeSur - verticeCentro) * (verticeOeste - verticeCentro);
                }
                else
                {
                    normalSurOeste = (verticeOeste - verticeCentro) * (verticeSur - verticeCentro);
                }
            }

            if (verticeNorte != null && verticeOeste != null)
            {
                if (invertirSentido)
                {
                    normalNorOeste = (verticeOeste - verticeCentro) * (verticeNorte - verticeCentro);
                }
                else
                {
                    normalNorOeste = (verticeNorte - verticeCentro) * (verticeOeste - verticeCentro);
                }
            }

            normalRetorno = new Punto(0, 0, 0);

            if (normalNorEste != null)
            {
                normalRetorno = normalRetorno.SumarPunto(normalNorEste);
            }

            if (normalNorOeste != null)
            {
                normalRetorno = normalRetorno.SumarPunto(normalNorOeste);
            }

            if (normalSurEste != null)
            {
                normalRetorno = normalRetorno.SumarPunto(normalSurEste);
            }

            if (normalSurOeste != null)
            {
                normalRetorno = normalRetorno.SumarPunto(normalSurOeste);
            }

            return(normalRetorno);
        }