c't

c't-Projekte - Mailinglisten


[Voriger (Datum)] [Nächster (Datum)] [Voriger (Thread)] [Nächster (Thread)]
[Nach Datum][Nach Thread]

Re: [ct-bot] Linienkreuzungen

Absender: Frank Menzel
Datum: Mi, 02.07.2008 11:05:26
In-reply-to: <AF9871FF-AF74-4D08-8862-CA9D3B06A242@xxxxxxxxxxxxxxx>
References: <20080630183821.300030@xxxxxxx> <AF9871FF-AF74-4D08-8862-CA9D3B06A242@xxxxxxxxxxxxxxx>


Hallo,
anbei wie gewünscht mit den Anpassungen für getFlatParcours
()...
Gruss, Frank Menzel
-------- Original-Nachricht --------
> Datum: Tue, 1 Jul 2008 15:21:28 +0200
> Von: Timo Sandmann <Mail@xxxxxxxxxxxxxxx>
> An: Entwicklung rund um den c\'t-bot <ct-bot-entwickler@xxxxxxxxxxxxxxxxx>
> Betreff: Re: [ct-bot] Linienkreuzungen

> Hallo,
> 
> das sieht sehr gut aus.
> Nur für Parcours.getFlatParcours() fehlt noch eine Anpassung, sonst  
> liefert getShortestPath() falsche Daten zurück (glaube ich). Die  
> Kreuzungen müssten wohl wie Linien behandelt werden. Das sollte dann  
> auf jeden Fall aber noch mal ausprobiert werden, ich bin mir bei der  
> Methode jetzt nicht so ganz sicher.
> 
> Gruß,
> Timo
> 
> Am 30.06.2008 um 20:38 schrieb Frank Menzel:
> > Hallo,
> > anbei mal der neue Patch für die Linienkreuzungen...
> > In dem Artikellink war ja so ein schönes Bild mit den Linienarten.  
> > Das Bild wollte ich erweitern mit diesen Kreuzungen. Doch diese  
> > Newsliste nimmt doch keine Bilder oder ? Also dann wohin mit dem  
> > Bild ?
> > Gruss, Frank Menzel
> > -- 
> > Psssst! Schon vom neuen GMX MultiMessenger gehört?
> > Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
> > <linecrossings.txt>_______________________________________________
> > ct-bot-entwickler Mailingliste
> > ct-bot-entwickler@xxxxxxxxxxxxxxxxx
> > http://www.heise.de/bin/newsletter/listinfo/ct-bot-entwickler
> 
> 
> _______________________________________________
> ct-bot-entwickler Mailingliste
> ct-bot-entwickler@xxxxxxxxxxxxxxxxx
> http://www.heise.de/bin/newsletter/listinfo/ct-bot-entwickler

-- 
Psssst! Schon das coole Video vom GMX MultiMessenger gesehen?
Der Eine für Alle: http://www.gmx.net/de/go/messenger03
Index: C:/botneu/ct-Sim/ctSim/model/ParcoursLoader.java
===================================================================
--- C:/botneu/ct-Sim/ctSim/model/ParcoursLoader.java	(revision 1451)
+++ C:/botneu/ct-Sim/ctSim/model/ParcoursLoader.java	(working copy)
@@ -63,6 +63,12 @@
 
 /**
  * Diese Klasse hilft einen Parcours aus einer ASCII-Datei zu laden
+ * Linien-Kreuzungen:
+ * [ - X-Kreuzung
+ * T - sieht aus wie das T, d.h. Linie geht nach unten weg 
+ * ] - T-Kreuzung steht auf dem Kopf, d.h. die Linie geht nach oben weg
+ * { - in Uhrzeigersinn gedrehte T-Kreuzung, Linie geht nach links weg (Richtung der Mittelspitze)
+ * } - entgegen Uhrzeigersinn gedrehte T-Kreuzung (Linie geht in Richtung der Mittelspitze nach rechts weg)
  *
  * @author bbe (bbe@xxxxxxxx)
  */
@@ -138,6 +144,88 @@
 													  0f +LINEWIDTH/2 , 0.5f			   ,0f,  // lange Linie nach oben
 	};
 
+	/**
+	 * X-Kreuzung
+	 */
+	public static final float[] LINE_CROSSING_X = 	{
+		  0f - LINEWIDTH/2  , -0.5f,0f,                 // Start unten links
+		  0f + LINEWIDTH/2  , -0.5f,0f,                 // kurze Linie nach rechts
+		  0f + LINEWIDTH/2  ,  0.0f - LINEWIDTH/2 ,0f,  //  Linie hoch bis Mitte
+		  0.5f			    ,  0.0f - LINEWIDTH/2 ,0f,  // Lange Linie nach rechts
+		  0.5f			    ,  0.0f + LINEWIDTH/2 ,0f,  // kurze Linie hoch
+		  0f + LINEWIDTH/2  ,  0.0f + LINEWIDTH/2 ,0f,  // Linie bis Mitte
+		  0f + LINEWIDTH/2  ,  0.5f ,0f,                // Linie bis Hoch
+		  0f - LINEWIDTH/2  ,  0.5f ,0f,                // kurze Linie nach links
+		  0f - LINEWIDTH/2  ,  0.0f + LINEWIDTH/2 ,0f,  // Linie runter bis Mitte
+		  -0.5f, 0f + LINEWIDTH/2,0f,                   //Linie nach links
+		  -0.5f, 0f - LINEWIDTH/2,0f,                   //kurze Linie runter
+		  0f - LINEWIDTH/2	,  0.0f - LINEWIDTH/2 ,0f,  // Linie nach rechts bis Mitte
+		  0f - LINEWIDTH/2  , -0.5f,0f,                 // Kreuz schliessen zum Ausgangspunkt
+	};
+	
+	/**
+	 * T-Kreuzung, Ausrichtung wie das T selbst, also Linie geht nach unten
+	 */
+	public static final float[] LINE_CROSSING_T = 	{
+		  0f - LINEWIDTH/2, -0.5f, 0f,                  // Start unten links
+		  0f + LINEWIDTH/2, -0.5f, 0f,                  // kurze Linie nach rechts
+		  0f + LINEWIDTH/2,  0.0f - LINEWIDTH/2 ,0f,    //  Linie hoch bis Mitte
+		  0.5f			  ,  0.0f - LINEWIDTH/2 ,0f,    // Lange Linie nach rechts
+		  0.5f			  ,  0.0f + LINEWIDTH/2 ,0f,    // kurze Linie hoch
+		  -0.5f  , 0.0f + LINEWIDTH/2 , 0f,             // lange Linie nach links
+		  -0.5f, 0f - LINEWIDTH/2,0f  ,                 //kurze Linie runter
+		  0f - LINEWIDTH/2	, 0.0f - LINEWIDTH/2 , 0f,  // Linie nach rechts bis Mitte
+		  0f - LINEWIDTH/2  ,-0.5f,0f,                  // T schliessen zum Ausgangspunkt
+	};
+	
+	/**
+	 * gespiegelte T-Kreuzung, Ausrichtung wie gespiegeltes, also Linie geht nach oben
+	 */
+	public static final float[] LINE_CROSSING_T_MIRR = 	{
+		  -0.5f,0.0f - LINEWIDTH/2,0f,                 // Start Ecke unten links
+		  0.5f,0.0f - LINEWIDTH/2,0f,                  // lange Linie nach rechts
+		  0.5f			  , 0 + LINEWIDTH/2 ,0f,       // kurze Linie hoch
+		  0f + LINEWIDTH/2  , 0f + LINEWIDTH/2 ,0f,    // Linie links bis Mitte
+		  0f + LINEWIDTH/2  , 0.5f ,0f,                // Linie hoch
+		  0f - LINEWIDTH/2 , 0.5f ,0f,                 // kurze Linie nach links
+		  0f - LINEWIDTH/2, 0f + LINEWIDTH/2,0f,       //Linie runter bis Mitte
+		  -0.5f ,0f + LINEWIDTH/2 ,0f,                 // Linie nach links
+		  -0.5f,0f - LINEWIDTH/2,0f,                   //kurze Linie runter zum Ausgangspunkt
+		  
+		 
+	};
+	
+	/**
+	 * T-Kreuzung, 90 Grad gedreht entgegen Uhrzeigersinn, also Linie geht nach rechts
+	 */
+	public static final float[] LINE_CROSSING_T_ROT_UNCLOCKWISE = 	{
+		  0f - LINEWIDTH/2,-0.5f,0f,                  // Start Ecke unten links
+		  0f + LINEWIDTH/2,-0.5f,0f,                  // kurze Linie nach rechts
+		  0f + LINEWIDTH/2 , 0.0f - LINEWIDTH/2 ,0f,  // Linie hoch bis Mitte		  
+		  0.5f,0.0f - LINEWIDTH/2,0f,                 // Linie nach rechts
+		  0.5f			  , 0f + LINEWIDTH/2 ,0f,     // kurze Linie hoch		  
+		  0f + LINEWIDTH/2  , 0f + LINEWIDTH/2 ,0f,   // Linie nach links bis Mitte
+		  0f + LINEWIDTH/2 , 0.5f ,0f,                // Linie hoch		  
+		  0f - LINEWIDTH/2, 0.5f ,0f,                 // kurze Linie nach links		  
+		  0f - LINEWIDTH/2, -0.5f,0f,                 //lange Linie runter zum Ausgangspunkt
+		 
+	};
+	
+	/**
+	 * T-Kreuzung, 90 Grad gedreht in Uhrzeigersinn, also Linie geht nach links
+	 */
+	public static final float[] LINE_CROSSING_T_ROT_CLOCKWISE = 	{
+		  0f - LINEWIDTH/2,-0.5f,0f,                 // Start Ecke unten links
+		  0f + LINEWIDTH/2,-0.5f,0f,                 // kurze Linie nach rechts
+		  0f + LINEWIDTH/2 , 0.5f  ,0f,              // lange Linie hoch 
+		  0f - LINEWIDTH/2, 0.5f ,0f,                // kurze Linie nach links	
+		  0f - LINEWIDTH/2, 0f + LINEWIDTH/2 ,0f,    // Linie runter bis Mitte
+		  -0.5f  , 0f + LINEWIDTH/2 ,0f,             // Linie nach links 
+		  -0.5f  , 0f - LINEWIDTH/2 ,0f,             // kurze Linie runter 
+		  0f - LINEWIDTH/2  , 0f - LINEWIDTH/2 ,0f,  // Linie rechts bis Mitte 
+		  0f - LINEWIDTH/2  , -0.5f ,0f,             // Linie runter zum Ausgangspunkt
+	};
+	
 	/** Wand-Hoehe */
 	private static final float WALL_HEIGHT = 0.2f;
 
@@ -437,8 +525,21 @@
 					    case '~':
 							createLine(x,y,LINE_CORNER_NW,getAppearance(this.parcoursMap[x][y]));
 							break;
-
-
+					    case '[':
+							createLine(x,y,LINE_CROSSING_X,getAppearance(this.parcoursMap[x][y]));
+							break;
+					    case 'T':
+							createLine(x,y,LINE_CROSSING_T,getAppearance(this.parcoursMap[x][y]));
+							break;
+					    case ']':
+							createLine(x,y,LINE_CROSSING_T_MIRR,getAppearance(this.parcoursMap[x][y]));
+							break;
+					    case '}':
+							createLine(x,y,LINE_CROSSING_T_ROT_UNCLOCKWISE,getAppearance(this.parcoursMap[x][y]));
+							break;
+					    case '{':
+							createLine(x,y,LINE_CROSSING_T_ROT_CLOCKWISE,getAppearance(this.parcoursMap[x][y]));
+							break;
 					}
 
 
Index: C:/botneu/ct-Sim/ctSim/model/Parcours.java
===================================================================
--- C:/botneu/ct-Sim/ctSim/model/Parcours.java	(revision 1451)
+++ C:/botneu/ct-Sim/ctSim/model/Parcours.java	(working copy)
@@ -516,7 +516,7 @@
     }
 
 	/**
-	 * @return Liefert einen stark verienfachten Parcours zurÃŒck.
+	 * @return Liefert einen stark vereinfachten Parcours zurÃŒck.
 	 * das Array enthaelt nur 0 (freies Feld) und 1 (blockiertes Feld)
 	 */
 	int[][] getFlatParcours() {
@@ -535,6 +535,11 @@
 				case '/':
 				case '\\':
 				case '+':
+				case '[':
+				case ']':
+				case '{':
+				case '}':
+				case 'T':
 				case '~':
 					parcoursMapSimple[x][y] = 0;
 					break;
Index: C:/botneu/ct-Sim/parcours/testline_crossings.xml
===================================================================
--- C:/botneu/ct-Sim/parcours/testline_crossings.xml	(revision 0)
+++ C:/botneu/ct-Sim/parcours/testline_crossings.xml	(revision 0)
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!DOCTYPE collection SYSTEM "parcours.dtd">
+
+<world>
+	<description>
+		Dieses ist ein Linien-Testparcours mit Kreuzungen und zyklenfrei
+	</description>
+		
+	<parcours>
+		
+		<line>============#</line>
+		<line>#*   L  L  *#</line>
+		<line>#    }T-{   #</line>
+		<line>#    L| L   #</line>
+		<line>#  /--[-\   #</line>
+		<line>#L-]-L| |   #</line>
+		<line>#     | |   #</line>
+		<line>#  /--[L[--Z#</line>
+		<line>#  |  L |   #</line>
+		<line>#* .    .  *#</line>
+		<line>===1====2===#</line>
+	</parcours>
+
+	<optics>
+		<appearance type="X">
+			<description>quadratische Wand</description>
+			<texture>textures/rock_wall.jpg</texture>
+			<color>#999999</color>
+		</appearance>
+		<appearance type="#">
+			<description>senkrechte Wand</description>
+			<clone>X</clone>
+		</appearance>
+		<appearance type="=">
+			<description>wagrechte Wand</description>
+			<clone>X</clone>
+		</appearance>
+
+		
+		<appearance type="."> 
+			<description>Fussboden im Eingangsbereich</description>
+			<color type="ambient">#FFFFFF</color>
+			<color type="diffuse">#CCFFFF</color>
+		</appearance>
+		
+		<appearance type=" "> 
+			<description>Fussboden im Labyrinth</description>
+			<color type="ambient">#606060</color>
+			<color type="diffuse">#CCFFFF</color>
+		</appearance>
+		
+		<appearance type="1"> 
+			<description>Fussboden des Startfeldes 1</description>
+			<color type="ambient">990000</color>
+			<color type="diffuse">#CCFFFF</color>
+		</appearance>
+		
+		<appearance type="2"> 
+			<description>Fussboden des Startfeldes 2</description>
+			<color type="ambient">#000099</color>
+			<color type="diffuse">#CCFFFF</color>
+		</appearance>
+
+		<appearance type="0"> 
+			<description>Fussboden des Default-Startfeldes</description>
+			<color type="ambient">#FFFFFF</color>
+			<color type="diffuse">#CCFFFF</color>
+		</appearance>
+		
+		<appearance type="Z"> 
+			<description>Fussboden des Zielfeldes 0</description>
+			<color type="ambient">#66FF00</color>
+			<color type="diffuse">#CCFFFF</color>
+		</appearance>
+	
+		<appearance type="*"> 
+			<description>Lichtkugel</description>
+			<color type="emmissive">#FFFF90</color>
+		</appearance>
+		
+		<appearance type="-"> 
+			<description>Linie</description>
+			<color type="ambient">#000000</color>
+			<color type="diffuse">#000000</color>
+			<color type="specular">#000000</color>
+			<color type="emmissive">#000000</color>
+		</appearance>
+
+		<appearance type="|"> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+
+		<appearance type="/"> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+
+		<appearance type="\"> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+
+		<appearance type="+"> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+		
+		<appearance type="["> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+		<appearance type="T"> 
+			<description>Linie</description>
+							<clone>-</clone>
+		</appearance>
+		<appearance type="]"> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+		<appearance type="}"> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+		<appearance type="{"> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+
+		<appearance type="~"> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+		
+		<appearance type="L">
+		        <description>Fussboden mit Loch</description>
+			<color type="ambient">#000000</color>
+			<color type="diffuse">#000000</color>
+		</appearance>
+		
+	</optics>
+
+
+</world>
\ No newline at end of file
Index: C:/botneu/ct-Sim/parcours/testline.xml
===================================================================
--- C:/botneu/ct-Sim/parcours/testline.xml	(revision 1451)
+++ C:/botneu/ct-Sim/parcours/testline.xml	(working copy)
@@ -108,6 +108,27 @@
 			<clone>-</clone>
 		</appearance>
 		
+		<appearance type="["> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+		<appearance type="T"> 
+			<description>Linie</description>
+							<clone>-</clone>
+		</appearance>
+		<appearance type="]"> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+		<appearance type="}"> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+		<appearance type="{"> 
+			<description>Linie</description>
+			<clone>-</clone>
+		</appearance>
+		
 	</optics>
 
 
Index: C:/botneu/ct-Sim/Changelog.txt
===================================================================
--- C:/botneu/ct-Sim/Changelog.txt	(revision 1451)
+++ C:/botneu/ct-Sim/Changelog.txt	(working copy)
@@ -1,5 +1,7 @@
 Changelog fuer c't-Sim
 ======================
+2008-06-30 Frank Menzel [menzelfr@xxxxxxx]: Neue Linienkreuzungen, X und T-Kreuzungen (alle 4 Richtungen), neuer Parcour testline_crossings, Beschreibung am Anfang von ParcoursLoader.java 
+
 2008-04-01 Timo Sandmann [mail@xxxxxxxxxxxxxxx]: LEDs vorne (links/rechts) vertauscht, so dass die linke LED links angezeigt wird und die Rechte rechts
 
 2008-03-29 Timo Sandmann [mail@xxxxxxxxxxxxxxx]: Sim-Applet geht nun wieder (hatte keinen Controller!)