Example #1
0
		/// <summary>
		/// Distanza punto - tratto generico
		/// </summary>
		/// <param name="p">Punto</param>
		/// <param name="te">Tratto</param>
		/// <returns></returns>
		public static double Distance(Point2D p, Tratto te)
		    {
		    Type tp;
		    tp = te.GetType();
		    if(tp == typeof(Line2D))
		        {
		        return Distance( p, (Line2D) te);
		        }		
		    if(tp == typeof(Arc2D))
		        {
				throw new Exception("Tipo non implementato");		
		        // return Distance(p, (Arc2D) te);
		        }		
		    throw new Exception("Tipo non implementato");
		    }
Example #2
0
		/// <summary>
		/// Versore uscente
		/// </summary>
		/// <param name="p">Punto sul tratto</param>
		/// <param name="te">Tratto</param>
		/// <param name="ext">Punto esterno opzionale</param>
		/// <returns></returns>
		public static Point2D	VersorOut( Point2D p, Tratto te, Point2D ext = null)
			{
			Type tp;
			tp = te.GetType();
			if(tp == typeof(Line2D))
			    {
			    return VersorOut( p, (Line2D) te, ext);
			    }		
			if(tp == typeof(Arc2D))
			    {
			    return VersorOut( p, (Arc2D) te, ext);
			    }		
		    throw new Exception("Tipo non implementato");
			}
Example #3
0
		/// <summary>
		/// Linea uscente
		/// </summary>
		/// <param name="p">Punto sul tratto</param>
		/// <param name="te">Tratto</param>
		/// <param name="vOut">Versore uscente (parametro out)</param>
		/// <param name="ext">Punto esterno opzionale</param>
		/// <returns>bool</returns>
		public static bool		LineOut( Point2D p, Tratto te, out Line2D vOut, Point2D ext = null)
			{
			Type tp;
			tp = te.GetType();
			if(tp == typeof(Line2D))
			    {
			    return LineOut( p, (Line2D) te, out vOut, ext);
			    }		
			if(tp == typeof(Arc2D))
			    {
			    return LineOut( p, (Arc2D) te, out vOut, ext);
			    }		
		    throw new Exception("Tipo non implementato");
			}
Example #4
0
		/// <summary>
		/// Proiezione di un punto su un tratto generico
		/// </summary>
		/// <param name="p">Punto</param>
		/// <param name="te">Tratto</param>
		/// <param name="bInside">true se richiesta appartenenza proiezione all'interno del tratto</param>
		/// <returns>La proiezione</returns>
		public static Point2D	Projection( Point2D p, Tratto te, bool bInside = false)
			{
			Type tp;
			tp = te.GetType();
			if(tp == typeof(Line2D))
			    {
			    return Projection( p, (Line2D) te, bInside);
			    }		
			if(tp == typeof(Arc2D))
			    {
			    return Projection( p, (Arc2D) te, bInside);
			    }		
		    throw new Exception("Tipo non implementato");
			}
Example #5
0
		/// <summary>
		/// Punto piu` vicino, su un tratto generico
		/// </summary>
		/// <param name="p">Punto</param>
		/// <param name="te">Tratto</param>
		/// <param name="nearest">Punto trovato (parametro out)</param>
		/// <param name="distance">Distanza (parametro out)</param>
		/// <param name="bInside">true se richiesta intersezione interna al tratto</param>
		/// <returns>true se trovato</returns>
		public static bool		Nearest( Point2D p, Tratto te, out Point2D nearest, out double distance, bool bInside = false)
			{
			Type tp;
			tp = te.GetType();
			if(tp == typeof(Line2D))
			    {
			    return Nearest( p, (Line2D)te, out nearest, out distance, bInside);
			    }		
			if(tp == typeof(Arc2D))
			    {
			    return Nearest(p, (Arc2D)te, out nearest, out distance, bInside);
			    }		
		    throw new Exception("Tipo non implementato");
			}
Example #6
0
		/// <summary>
		/// Intersezione tra linea e tratto generico
		/// </summary>
		/// <param name="l1">Linea</param>
		/// <param name="te">Tratto</param>
		/// <param name="bCheckInside1">Richiesta intersezione interna alla linea</param>
		/// <param name="bCheckInside2">Richiesta intersezione interna al tratto</param>
		/// <returns></returns>
		public static List<Intersection> Intersect( Line2D l1, Tratto te, bool bCheckInside1 = false, bool bCheckInside2 = false)
		    {
			Type tp;
			tp = te.GetType();
			if(tp == typeof(Line2D))
			    {
			    return Intersect( l1, (Line2D)te, bCheckInside1 , bCheckInside2 );
			    }		
			if(tp == typeof(Arc2D))
			    {
			    return Intersect( l1, (Arc2D)te, bCheckInside1 , bCheckInside2 );
			    }		
		    throw new Exception("Tipo non implementato");
		    }