Exemplo n.º 1
0
		public static double Distancia(Recta3D R1, Recta3D R2)
		{
			switch (PosicionRelativa(R1, R2).Tipo) {
				case TipoPosicionRelativa3D.Coincidente:
					return 0;
				case TipoPosicionRelativa3D.Secante:
					return 0;
				case TipoPosicionRelativa3D.Paralelo:
					return Distancia(R1, R2.ObtenerPuntoParametrico(0));
				case TipoPosicionRelativa3D.Cruce:
					return Math.Abs(Vector3D.ProductoMixto(R1.VectorDirector, R2.VectorDirector, new Vector3D(R1.ObtenerPuntoParametrico(0), R2.ObtenerPuntoParametrico(0)))) / (R1.VectorDirector + R2.VectorDirector).Modulo;
			}
		}
Exemplo n.º 2
0
		public static Punto3D Proyeccion(Punto3D Punto, Recta3D Recta)
		{
			int Landa = 0;
			double Vx = 0;
			double Vy = 0;
			double Vz = 0;
			double VVx = 0;
			double VVy = 0;
			double VVz = 0;
			double Qx = 0;
			double Qy = 0;
			double Qz = 0;
			double x = 0;
			double y = 0;
			double z = 0;

			Vx = Recta.VectorDirector.X;
			Vy = Recta.VectorDirector.Y;
			Vz = Recta.VectorDirector.Z;

			VVx = Vx * Vx;
			VVy = Vy * Vy;
			VVz = Vz * Vz;

			Qx = Recta.PuntoInicial.X;
			Qy = Recta.PuntoInicial.Y;
			Qz = Recta.PuntoInicial.Z;

			x = Punto.X;
			y = Punto.Y;
			z = Punto.Z;

			Landa = ((Vx * (x - Qx)) + (Vy * (y - Qy)) + (Vz * (z - Qz))) / (VVx + VVy + VVz);

			return Recta.ObtenerPuntoParametrico(Landa);
		}
Exemplo n.º 3
0
		public static double Distancia(Recta3D Recta, Punto3D Punto)
		{
			return (new Vector3D(Recta.ObtenerPuntoParametrico(0), Punto) + Recta.VectorDirector).Modulo;
		}