示例#1
0
		public static SectorOctree Sector(Octree Octree, Recta3D Recta)
		{
			int Resultado = Octree.SectorRaiz.Pertenece(ref Recta);
			SectorOctree S = Octree.SectorRaiz;

			if (Resultado != -2) {
				if (Resultado == -1) {
					return S;
				} else {
					while (Resultado != -2 && Resultado != -1) {
						Resultado = S.Pertenece(ref Recta);
						if (Resultado != -2) {
							if (Resultado == -1) {
								return S;
							} else {
								S = S.Hijos[Resultado];
							}
						} else {
							return S.Padre;
						}
					}

					return S;
				}
			} else {
				throw new ExcepcionGeometrica3D("OCTREE (PERTENECE): La recta especificada no pertenece al espacio dominado por el quadtree." + Constants.vbNewLine + "Punto=" + Recta.ToString() + Constants.vbNewLine + "Espacio=" + Octree.Espacio.ToString());
			}
		}
示例#2
0
		public static SectorOctree[] Sectores(Octree Octree, Recta3D Recta)
		{
			SectorOctree S = Octree.SectorRaiz;
			List<SectorOctree> Retorno = new List<SectorOctree>();

			if (Octree.SectorRaiz.Pertenece(ref Recta)) {
				InterseccionRecta(Recta, S, ref Retorno);

				return Retorno.ToArray();
			} else {
				throw new ExcepcionGeometrica3D("OCTREE (PERTENECE): La recta especificado no pertenece al espacio dominado por el quadtree." + Constants.vbNewLine + "Recta=" + Recta.ToString() + Constants.vbNewLine + "Espacio=" + Octree.Espacio.ToString());
			}
		}
示例#3
0
		public static Punto3D Interseccion(Plano3D Plano, Recta3D Recta)
		{
			SistemaEcuaciones sis = null;

			if (Plano.VectorNormal * Recta.VectorDirector != 0) {
				sis = new SistemaEcuaciones(Plano.ObtenerEcuacion(), Recta.PrimerPlano.ObtenerEcuacion(), Recta.SegundoPlano.ObtenerEcuacion());

				if (sis.Solucion.TipoSolucion == TipoSolucionSistema.SistemaCompatibleDeterminado) {
					return new Punto3D(sis.Solucion.ValorSolucion[0], sis.Solucion.ValorSolucion[1], sis.Solucion.ValorSolucion[2]);
				} else {
					if (sis.Solucion.TipoSolucion == TipoSolucionSistema.SistemaCompatibleIndeterminado) {
						return Plano.ObtenerPunto(0, 0);
					} else {
						throw new ExcepcionGeometrica3D("PLANO3D (INTERSECCION): No se ha podido calcular la interseccion. Es posible que los datos de los planos sean erroneos, o que el cálculo del sistema halla fallado." + Constants.vbNewLine + "Recta=" + Recta.ToString() + Constants.vbNewLine + "Plano: " + Plano.ToString() + Constants.vbNewLine + "Primer plano: " + Recta.PrimerPlano.ToString() + Constants.vbNewLine + "Seundo plano: " + Recta.SegundoPlano.ToString() + Constants.vbNewLine + "Primera ecuación del sistema: " + Plano.ObtenerEcuacion().ToString() + Constants.vbNewLine + "Segunda ecuación del sistema: " + Recta.PrimerPlano.ObtenerEcuacion().ToString() + Constants.vbNewLine + "Tercera ecuación del sistema: " + Recta.SegundoPlano.ObtenerEcuacion().ToString() + Constants.vbNewLine + "Solución obtenida: " + sis.Solucion.ToString());
					}
				}
			} else {
				if (Recta3D.Distancia(Recta, Plano) == 0) {
					return Recta.PuntoInicial;
				} else {
					throw new ExcepcionGeometrica3D("PLANO3D (INTERSECCION): La recta y el plano son paralelos" + Constants.vbNewLine + "Recta: " + Recta.ToString() + Constants.vbNewLine + "Plano: " + Plano.ToString());
				}
			}
		}