public void writeX3DAngles(Scientrace.Object3dEnvironment env, StringBuilder retsb) { Scientrace.Location tloc; foreach (Scientrace.Angle angle in this.angles) { tloc = angle.getLocation(); Scientrace.X3DGridPoint x3dgp = new Scientrace.X3DGridPoint(env, tloc, tloc + angle.intersection.enter.flatshape.plane.u.toUnitVector().toLocation() * (env.radius / 100), tloc + angle.intersection.enter.flatshape.plane.v.toUnitVector().toLocation() * (env.radius / 100)); //Console.WriteLine("Writing spot "+angle.ToString()+" to X3D"); if (this.drawInteractionPlanes) { retsb.Append(x3dgp.exportX3DnosphereRGB("1 1 0")); } if (this.drawInteractionNormals) { retsb.Append(X3DGridPoint.get_RGBA_Line_XML(tloc, tloc + angle.intersection.enter.flatshape.plane.getNorm().negative() * 0.125, "1 0 1 0.4")); } retsb.Append(@" <Transform scale='" + (env.radius / 1250).ToString() + " " + (env.radius / 1250).ToString() + " " + (env.radius / 1250).ToString() + @"' translation='" + angle.getLocation().trico() + @"'> <Shape> <Sphere /> <Appearance> <Material emissiveColor='0 1 0' transparency='" + (1 - angle.fromTrace.intensity) + @"' /><!--angle--> </Appearance> </Shape> </Transform> "); } }
public void writeCasualties(Scientrace.Object3dEnvironment env, StringBuilder retsb) { //Console.WriteLine("iterating casualties"); foreach (Scientrace.Spot casualty in this.casualties) { retsb.Append("<!-- start of casualty-->" + X3DGridPoint.x3D_Sphere(casualty.loc, env.radius / 1250, "0.5 0 0", casualty.intensity) + "<!-- end of casualty-->"); } }
static public string drawLinePiecesXML(List <ObjectLinePiece> linePieces) { System.Text.StringBuilder retstr = new System.Text.StringBuilder(5000); foreach (ObjectLinePiece olp in linePieces) { // Writing some helpful comments. retstr.Append("<!-- Line From: \n" + olp.lp.startingpoint + " To: \n" + olp.lp.endingpoint + " -->"); retstr.Append(X3DGridPoint.get_RGBA_Line_XML(olp.lp, olp.col)); } return(retstr.ToString()); }
public static string getConnectAlleNodesXML(double sphereRadius, List<Scientrace.Location> nodeList) { //A list with two items produces a "line", not a figure that connects back to the first node. if (nodeList.Count == 2) { X3DGridPoint x3dGP = new X3DGridPoint(sphereRadius, nodeList[0], nodeList[1], null); return x3dGP.exportX3D(); } //Any other list string retstr = ""; for (int iNode = 0; iNode < nodeList.Count; iNode++) { X3DGridPoint x3dGP = new X3DGridPoint(sphereRadius, nodeList[iNode], nodeList[(iNode+1)%nodeList.Count], null); retstr += x3dGP.exportX3D(); } return retstr; }
public static string getConnectAlleNodesXML(double sphereRadius, List <Scientrace.Location> nodeList) { //A list with two items produces a "line", not a figure that connects back to the first node. if (nodeList.Count == 2) { X3DGridPoint x3dGP = new X3DGridPoint(sphereRadius, nodeList[0], nodeList[1], null); return(x3dGP.exportX3D()); } //Any other list string retstr = ""; for (int iNode = 0; iNode < nodeList.Count; iNode++) { X3DGridPoint x3dGP = new X3DGridPoint(sphereRadius, nodeList[iNode], nodeList[(iNode + 1) % nodeList.Count], null); retstr += x3dGP.exportX3D(); } return(retstr); }
public void writeX3DSpots(Scientrace.Object3dEnvironment env, StringBuilder retsb) { //Console.WriteLine("iterating spots"); foreach (Scientrace.Spot spot in this.spots) { //Console.WriteLine("Writing SPOT "+spot.ToString()+" to X3D"); //Scientrace.X3DGridPoint x3dgp = new Scientrace.X3DGridPoint(spot.loc, null, null); retsb.Append(X3DGridPoint.x3D_Transparant_Sphere(spot.loc, ((double)env.radius) / 1250, spot.intensity) + "<!--spot-->"); /* retsb.Append(@" <Shape> * <LineSet vertexCount='2'> * <Coordinate point=' * "+trace.traceline.startingpoint.tricon()+trace.endloc.tricon()+@" * '/> * <Color color='1 0 0 0 1 1' /> * </LineSet> * </Shape>"); */ } }
public static string getConnectAlleNodesXML(Object3dEnvironment env, List <Scientrace.Location> nodeList) { return(X3DGridPoint.getConnectAlleNodesXML(X3DGridPoint.CalcRadiusFromEnv(env), nodeList)); }
public static string x3D_Transparant_Sphere(Scientrace.Location aLoc, double radius, double intensity) { return(X3DGridPoint.x3D_Sphere(aLoc, radius, "0 0 1", intensity)); }
public string x3DSolidRGBALineTo(Scientrace.Location aLoc, string colorRGBstring) { return(X3DGridPoint.get_RGBA_Line_XML(aLoc, this.loc, colorRGBstring)); }
public static string get_RGBA_Line_XML(LinePiece anLP, string colorRGBAstring) { return(X3DGridPoint.get_RGBA_Line_XML(anLP.startingpoint, anLP.endingpoint, colorRGBAstring)); }
public X3DGridPoint(Scientrace.Object3dEnvironment env, Scientrace.Location loc, Scientrace.Location east, Scientrace.Location south) { this.init(X3DGridPoint.CalcRadiusFromEnv(env), loc, east, south); }
public string exportX3D() { return(this.x3DLineTo(this.e) + this.x3DLineTo(this.s) + X3DGridPoint.x3D_Transparant_Sphere(this.loc, this.sphere_radius, 0.5)); }
public string x3DSphere(double radius, string colour, double sphere_colour_intensity) { return(X3DGridPoint.x3D_Sphere(this.loc, radius, colour, sphere_colour_intensity)); }
public string x3DSphere(double radius) { return(X3DGridPoint.x3D_Sphere(this.loc, radius, this.sphere_colour, 0)); }