예제 #1
0
파일: Lente01.cs 프로젝트: Fred68/Lente01
		private void test4ToolStripMenuItem_Click(object sender,EventArgs e)
			{
			Point2D p1 = new Point2D(1, 0);
			Point2D p2 = new Point2D(0, 1);
			Point2D p3 = new Point2D (0,2);
			Point2D pc = new Point2D (0,0);
			Point2D p4 = new Point2D (2, 1);
			Point2D p1w = new Point2D(1, -0.01);

			Arc2D ar1 = new Arc2D(pc, p1, p2);
			Line2D ln1 = new Line2D(p2, p3);
			Line2D ln2 = new Line2D(p4, p3);
			Line2D ln3;
			ln3 = new Line2D(p4,p1);
//			ln3 = new Line2D(p4,p1w);

			CorpoOttico cc = new CorpoOttico(new MaterialeOttico("vetro",1.4));
			cc.Add(new Contorno(ln3));
			cc.Add(new Contorno(ln2));
			cc.Add(new Contorno(ln1));
			cc.Add(new Contorno(ar1));
			cc.Validate();

			Point2D po = new Point2D(1.5, -1);

			Line2D ray;
			ray = new Line2D(po, p1 + new Point2D(0.05,0));
			ray.Normalize();
			List<Intersection> intersezioni = cc.TrovaIntersezioniPositive(ray);

			#pragma warning disable
			int tmp;
			tmp = 1;
			#pragma warning restore

			}
예제 #2
0
파일: Lente01.cs 프로젝트: Fred68/Lente01
		private void test5ToolStripMenuItem_Click(object sender,EventArgs e)
			{
			Line2D lin = new Line2D(0,0,1,1);
			Raggio ray0 = new Raggio(lin,700);

			Matrix mm = Matrix.Lower(4);
			Matrix mm1 = !mm;

            Point2D p1 = new Point2D(1, 0);
            Point2D p2 = new Point2D(0, 1);
            Point2D p3 = new Point2D (0,2);
            Point2D pc = new Point2D (0,0);
            Point2D p4 = new Point2D (2, 1);
            Point2D p1w = new Point2D(1, -0.01);

            Arc2D ar1 = new Arc2D(pc, p1, p2);
            Line2D ln1 = new Line2D(p2, p3);
            Line2D ln2 = new Line2D(p4, p3);
            Line2D ln3;
            ln3 = new Line2D(p4,p1);

			CorpoOttico cc = new CorpoOttico(new MaterialeOttico("vetro",1.4));
			cc.Add(new Contorno(ln3));
			cc.Add(new Contorno(ln2));
			cc.Add(new Contorno(ln1));
			cc.Add(new Contorno(ar1));
			cc.Validate();

			Point2D po = new Point2D(1.5, -1);

			Arc2D cerchio = new Arc2D(po, 4);
			

			Raggio ray;
			ray = new Raggio(new Line2D(po, p1 + new Point2D(0.05,0)),Ottica.LunghezzaOnda.Rosso);

			List<Intersection> intersezioni = cc.TrovaIntersezioniPositive(ray);
			Contorno xx = cc.Contorno(intersezioni[0].tr2);
			
			#pragma warning disable
			int tmp;
			tmp = 1;
			
			}
예제 #3
0
파일: Lente.cs 프로젝트: Fred68/Engineering
		/// <summary>
		/// Crea corpo ottico dalla lente nella posizione standard
		/// </summary>
		/// <returns></returns>
		//public CorpoOttico CreaCorpoOttico() 
		//    {
		//    #warning Creare funzione CreaCorpoOttivo(Transform2D)
		//    CorpoOttico co = null;
		//    if(this.IsValid)
		//        {
		//        Point2D pt1 = new Point2D(0, RL);						// Punti caratteristici
		//        Point2D pt2 = new Point2D(-ET, RL);
		//        Point2D pt3 = new Point2D(-ET, -RL);
		//        Point2D pt4 = new Point2D(0.0, -RL);
		//        Point2D ct1 = new Point2D(XCC1,0.0);
		//        Point2D ct2 = new Point2D(XCC2,0.0);

		//        Tratto sup1, sup2;											// Contorni
		//        Tratto bordo1, bordo2;
		//        if(TIPO1 == Lente.TipoSuperficie.piana)
		//            sup1 = new Line2D(pt2,pt3);
		//        else if(TIPO1 == Lente.TipoSuperficie.convessa)
		//            sup1 = new Arc2D(pt2,pt3,ct1,Arc2D.TrePunti.Estremi_e_Centro);
		//        else
		//            sup1 = new Arc2D(pt3,pt2,ct1,Arc2D.TrePunti.Estremi_e_Centro);
		//        if(TIPO2 == Lente.TipoSuperficie.piana)
		//            sup2 = new Line2D(pt1,pt4);
		//        else if(TIPO2 == Lente.TipoSuperficie.convessa)
		//            sup2 = new Arc2D(pt4,pt1,ct2,Arc2D.TrePunti.Estremi_e_Centro);
		//        else
		//            sup2 = new Arc2D(pt1,pt4,ct2,Arc2D.TrePunti.Estremi_e_Centro);
		//        bordo1 = new Line2D(pt1, pt2);
		//        bordo2 = new Line2D(pt3,pt4);

		//        string nome_materiale = GetNomeMateriale();									// Imposta i nomi
		//        string nome_lente = GetNomeCorpoOttico();
		//        MaterialeOttico mat_lente = new MaterialeOttico(nome_materiale, this.N);	// Crea il materiale
		//        co = new CorpoOttico(mat_lente,nome_lente);									// Crea il corpo ottico
		//        co.Add(new Contorno(bordo1, StatoSuperficie.Opaca));						// Aggiunge i contorni
		//        co.Add(new Contorno(sup1));
		//        co.Add(new Contorno(bordo2, StatoSuperficie.Opaca));
		//        co.Add(new Contorno(sup2));

		//        }			
		//    return co;
		//    }
		public CorpoOttico CreaCorpoOttico(Transform2D tr = null) 
			{
			CorpoOttico co = null;
			if(this.IsValid)
				{
				if(tr==null)
					{
					tr = new Transform2D(Matrix.Id(Transform2D.Dim2Dhom));
					}
				Point2D pt1 = tr.Transform(new Point2D(0, RL));				// Punti caratteristici
				Point2D pt2 = tr.Transform(new Point2D(-ET, RL));
				Point2D pt3 = tr.Transform(new Point2D(-ET, -RL));
				Point2D pt4 = tr.Transform(new Point2D(0.0, -RL));
				Point2D ct1 = tr.Transform(new Point2D(XCC1,0.0));
				Point2D ct2 = tr.Transform(new Point2D(XCC2,0.0));
				Tratto sup1, sup2;											// Contorni
				Tratto bordo1, bordo2;
				if(TIPO1 == Lente.TipoSuperficie.piana)
					sup1 = new Line2D(pt2,pt3);
				else if(TIPO1 == Lente.TipoSuperficie.convessa)
					sup1 = new Arc2D(pt2,pt3,ct1,Arc2D.TrePunti.Estremi_e_Centro);
				else
					sup1 = new Arc2D(pt3,pt2,ct1,Arc2D.TrePunti.Estremi_e_Centro);
				if(TIPO2 == Lente.TipoSuperficie.piana)
					sup2 = new Line2D(pt1,pt4);
				else if(TIPO2 == Lente.TipoSuperficie.convessa)
					sup2 = new Arc2D(pt4,pt1,ct2,Arc2D.TrePunti.Estremi_e_Centro);
				else
					sup2 = new Arc2D(pt1,pt4,ct2,Arc2D.TrePunti.Estremi_e_Centro);
				bordo1 = new Line2D(pt1, pt2);
				bordo2 = new Line2D(pt3,pt4);

				string nome_materiale = GetNomeMateriale();									// Imposta i nomi
				string nome_lente = GetNomeCorpoOttico();
				MaterialeOttico mat_lente = new MaterialeOttico(nome_materiale, this.N);	// Crea il materiale
				co = new CorpoOttico(mat_lente,nome_lente);									// Crea il corpo ottico
				co.Add(new Contorno(bordo1, StatoSuperficie.Opaca));						// Aggiunge i contorni
				co.Add(new Contorno(sup1));
				co.Add(new Contorno(bordo2, StatoSuperficie.Opaca));
				co.Add(new Contorno(sup2));

				}			
			return co;
			}