/* end of interface IBorder3D implementation */ public override string exportX3D(Object3dEnvironment env) { StringBuilder retsb = new StringBuilder(1024); X3DShapeDrawer x3dsd = new X3DShapeDrawer(); for (double angle = this.radiansMin; angle <= this.radiansMax; angle += (this.radiansMax - this.radiansMin) / this.x3dCurvedSegments) { double red = (((angle - this.radiansMin) / (this.radiansMax - this.radiansMin)) / 2) + 0.3; x3dsd.primaryRGB = red.ToString() + " 0.2 0.2"; //Console.WriteLine("radmin: "+this.radiansMin+ "radmax:"+this.radiansMax+ " iangle:"+angle); //if (angle > 0) { retsb.AppendLine( x3dsd.drawCircle(this.getCenterAtAngleLoc(angle), this.getRadiusAtAngle(angle), this.orientation)); if (this.doubleConvexRing) { retsb.AppendLine( x3dsd.drawCircle(this.getOppositeCenterAtAngleLoc(angle), this.getRadiusAtAngle(angle), this.orientation)); } // } } if (this.radiansMin > 0 && this.x3dCurvedSegments > 0) { retsb.AppendLine(x3dsd.drawCircle(this.getCenterAtAngleLoc(this.radiansMax), this.getRadiusAtAngle(this.radiansMin), this.orientation)); } return(retsb.ToString()); }
public void setObjectEnvironment(Object3dEnvironment env) { this.tag = this.defaultTag(); //a lightsource works on an environment this.env = env; //but is also part of that environment (possibly amongst other lightsources) this.env.addLightSource(this); }
public void parseConfiguration() { Console.WriteLine(">>> loading configuration file: " + this.configfilename); Scientrace.TraceJournal tj = Scientrace.TraceJournal.Instance; tj.source_filename = this.configfilename; string xmlsource = this.preProcess(this.configfilename); tj.xml_export_preprocessed_string = xmlsource; this.sctxp = new ScientraceXMLParser(XDocument.Parse(xmlsource)); this.env = this.sctxp.parseEnvironment(); this.sctxp.parseOutput(); }
public override string exportX3D(Object3dEnvironment env) { // Step 1: Collect base linepieces that would draw the basic structure List<ObjectLinePiece> baseLinePieces = new List<ObjectLinePiece>(); foreach (PlaneBorderEnclosedVolume aSubVolume in this.subVolumes) { baseLinePieces.AddRange(aSubVolume.getOLPBorderEdges()); } // Step 2: Slice all linepieces that are intersected by other subVolumes List<ObjectLinePiece> slicedLinePieces = new List<ObjectLinePiece>(); foreach (ObjectLinePiece anOLP in baseLinePieces) { // Distances/linepieces smaller than "significance" are considered insignificant ignored. if(anOLP.lp.getLength() < MainClass.SIGNIFICANTLY_SMALL) continue; List<ObjectLinePiece> olpChunks = new List<ObjectLinePiece>(); List<ObjectLinePiece> newOLPChunks = new List<ObjectLinePiece>(); olpChunks.Add(anOLP); foreach (PlaneBorderEnclosedVolume aSubVolume in this.subVolumes) { newOLPChunks = new List<ObjectLinePiece>(); //create empty new list foreach (ObjectLinePiece anOLPChunk in olpChunks) { newOLPChunks.AddRange(aSubVolume.sliceObjectLinePiece(anOLPChunk)); } // end oldChunks olpChunks = newOLPChunks; } // end subVolumes slicedLinePieces.AddRange(newOLPChunks); } // end anOLP loop List<ObjectLinePiece> markedSlices = this.markInsideOutsideOLPs(this.cleanupLinePieceList(slicedLinePieces)); Console.WriteLine("ComplexBorder gridline count: "+markedSlices.Count+" out of "+slicedLinePieces.Count); double foo = 0; foreach (ObjectLinePiece anOLP in markedSlices) { //foo += env.radius/2000; anOLP.lp.startingpoint.x= anOLP.lp.startingpoint.x + foo; anOLP.lp.endingpoint.x= anOLP.lp.endingpoint.x + foo; anOLP.lp.startingpoint.y= anOLP.lp.startingpoint.y + foo; anOLP.lp.endingpoint.y= anOLP.lp.endingpoint.y + foo; } // draw the linepieces after having checked and marked what's inside and outside //return LinePiece.drawLinePiecesXML(this.markInsideOutsideOLPs(baseLinePieces)); // <-- show non-sliced pieces only. string line_pieces_xml = LinePiece.drawLinePiecesXML(markedSlices); if (line_pieces_xml.Length < 1) Console.WriteLine("WARNING: the volume {"+this.tag+"} cannot be drawn."); return "<!-- ComplexVolume: "+this.tag+" -->"+line_pieces_xml+"<!-- END OF ComplexVolume: "+this.tag+" -->"; }
public override string exportX3D(Object3dEnvironment env) { //throw new System.NotImplementedException("exportX3D not implemented for InfiniteCylinderBorder class"); Console.WriteLine("WARNING! exportX3D method not implemented for InfiniteCylinderBorder class"); return "<!-- the InfiniteCylinderBorder has no X3D code (at this time) -->"; }
public LightSource(Object3dEnvironment env) { this.setObjectEnvironment(env); }
public override string exportX3D(Object3dEnvironment env) { List <ObjectLinePiece> olps = this.getOLPBorderEdges(); return(LinePiece.drawLinePiecesXML(olps)); }
public override string exportX3D(Object3dEnvironment env) { List<ObjectLinePiece> olps = this.getOLPBorderEdges(); return LinePiece.drawLinePiecesXML(olps); }
public void addTracesLoc(double lambda, Location loc, UniformTraceModifier utm, Object3dEnvironment env, int node, int total) { Scientrace.Line ray = new Line(loc*0.001, utm.modify(node,total).toUnitVector()); //start at node 1 -> ++i ! this.addTrace(new Scientrace.Trace(lambda, this, ray, env, 1 ,1)); }
public string oldexportX3D(Object3dEnvironment env) { //throw new System.NotImplementedException(); return this.dummySphere1.exportX3D(env)+this.dummySphere2.exportX3D(env); }
/* end of interface IBorder3D implementation */ public override string exportX3D(Object3dEnvironment env) { StringBuilder retsb = new StringBuilder(1024); X3DShapeDrawer x3dsd = new X3DShapeDrawer(); for (double angle = this.radiansMin; angle <= this.radiansMax; angle += (this.radiansMax-this.radiansMin)/this.x3dCurvedSegments) { double red = (((angle-this.radiansMin)/(this.radiansMax-this.radiansMin))/2)+0.3; x3dsd.primaryRGB = red.ToString()+" 0.2 0.2"; //Console.WriteLine("radmin: "+this.radiansMin+ "radmax:"+this.radiansMax+ " iangle:"+angle); //if (angle > 0) { retsb.AppendLine( x3dsd.drawCircle(this.getCenterAtAngleLoc(angle), this.getRadiusAtAngle(angle), this.orientation)); if (this.doubleConvexRing) retsb.AppendLine( x3dsd.drawCircle(this.getOppositeCenterAtAngleLoc(angle), this.getRadiusAtAngle(angle), this.orientation)); // } } if (this.radiansMin > 0 && this.x3dCurvedSegments > 0) retsb.AppendLine(x3dsd.drawCircle(this.getCenterAtAngleLoc(this.radiansMax), this.getRadiusAtAngle(this.radiansMin), this.orientation)); return retsb.ToString(); }
public static string getConnectAlleNodesXML(Object3dEnvironment env, List<Scientrace.Location> nodeList) { return X3DGridPoint.getConnectAlleNodesXML(X3DGridPoint.CalcRadiusFromEnv(env), nodeList); }
public override string exportX3D(Object3dEnvironment env) { //throw new System.NotImplementedException("exportX3D not implemented for InfiniteCylinderBorder class"); Console.WriteLine("WARNING! exportX3D method not implemented for InfiniteCylinderBorder class"); return("<!-- the InfiniteCylinderBorder has no X3D code (at this time) -->"); }
public static string getConnectAlleNodesXML(Object3dEnvironment env, List <Scientrace.Location> nodeList) { return(X3DGridPoint.getConnectAlleNodesXML(X3DGridPoint.CalcRadiusFromEnv(env), nodeList)); }
public void addTracesLoc(double lambda, Location loc, UniformTraceModifier utm, Object3dEnvironment env, int node, int total) { Scientrace.Line ray = new Line(loc * 0.001, utm.modify(node, total).toUnitVector()); //start at node 1 -> ++i ! this.addTrace(new Scientrace.Trace(lambda, this, ray, env, 1, 1)); }
public string oldexportX3D(Object3dEnvironment env) { //throw new System.NotImplementedException(); return(this.dummySphere1.exportX3D(env) + this.dummySphere2.exportX3D(env)); }