本文整理汇总了C#中Scientrace.directedTowardsObjectside方法的典型用法代码示例。如果您正苦于以下问题:C# Scientrace.directedTowardsObjectside方法的具体用法?C# Scientrace.directedTowardsObjectside怎么用?C# Scientrace.directedTowardsObjectside使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scientrace
的用法示例。
在下文中一共展示了Scientrace.directedTowardsObjectside方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: exportSVG
public string exportSVG(Scientrace.PhysicalObject3d anObject, Scientrace.SurfaceSide side, Scientrace.PDPSource pdpSource)
{
//Scientrace.Parallelogram surface = anObject.getDistributionSurface();
//this.spotsize = Math.Sqrt(Math.Pow(surface.u.length,2)+Math.Pow(surface.v.length,2))*this.spotdiagonalfraction;
this.spotsize = Math.Sqrt(Math.Pow(anObject.svgxsize,2)+Math.Pow(anObject.svgysize,2))*this.spotdiagonalfraction;
StringBuilder retstr = new StringBuilder(10000000); // this string may become very big, allocating this amount of memory may help.
retstr.Append(this.exportSVGOpening(anObject));
Scientrace.Location loc2d;
StringBuilder pol_lines = new StringBuilder("<!-- START OF POLARISATION LINES -->",300000);
StringBuilder centerSpots = new StringBuilder("<!-- START OF SPOTS CENTERS -->",300000);
//Console.WriteLine("Now writing "+this.spots.Count+" spots");
//int icount = 0;
foreach(Scientrace.Spot casualty in this.spots) {
if ((casualty.object3d == anObject)
&& (anObject.directedTowardsObjectside(side, casualty.trace))) {
loc2d = anObject.getSVG2DLoc(casualty.loc);
// double pol_fac_1 = Math.Pow(casualty.pol_vec_1.length,2)*1.0;//*casualty.pol_vec_1.length * casualty.intensity*3;
// double pol_fac_2 = Math.Pow(casualty.pol_vec_2.length,2)*1.0;//*casualty.pol_vec_2.length * casualty.intensity*3;
double pol_fac_1 = Math.Pow(casualty.pol_vec_1.length,1)*1.00*Math.Sqrt(casualty.intensity);//*casualty.pol_vec_1.length * casualty.intensity*3;
double pol_fac_2 = Math.Pow(casualty.pol_vec_2.length,1)*1.00*Math.Sqrt(casualty.intensity);//*casualty.pol_vec_2.length * casualty.intensity*3;
Scientrace.Vector pol_vec_1_2d = (anObject.get2DLoc(
casualty.pol_vec_1.projectOnPlaneWithNormal(anObject.getSurfaceNormal()).toLocation()
)-anObject.get2DLoc(Location.ZeroLoc())).normaliseIfNotZero() * pol_fac_1;
Scientrace.Vector pol_vec_2_2d = (anObject.get2DLoc(
casualty.pol_vec_2.projectOnPlaneWithNormal(anObject.getSurfaceNormal()).toLocation()
)-anObject.get2DLoc(Location.ZeroLoc())).normaliseIfNotZero() * pol_fac_2;
if (this.svg_export_photoncloud) {
retstr.Append(@"<g>
<circle cx='"+loc2d.x+"' cy='"+(anObject.svgysize-loc2d.y)+"' r='"+(casualty.intensity*this.spotsize)+"' style='"+
"fill:"+this.getPhotonColourForPDPSource(casualty, pdpSource, anObject)
[email protected]";fill-opacity:0.3;stroke:none'>
<title><!-- Tooltip -->"+this.spotDescriptor(casualty, anObject,true)[email protected]"</title>
</circle>
</g>");
} // end if draw photoncloud (to create the frogg-egg kinda image)
centerSpots.Append(@"<g>
<circle cx='"+loc2d.x+"' cy='"+(anObject.svgysize-loc2d.y)+"' r='"+(casualty.intensity*this.spotsize/(this.svg_export_photoncloud?4:1))+"' style='"+
"fill:"+this.getPhotonColourForPDPSource(casualty, pdpSource, anObject)
[email protected]";fill-opacity:8;stroke:none'>
<title><!-- Tooltip -->"+this.spotDescriptor(casualty, anObject,false)[email protected]"</title>
</circle>
</g>");
pol_lines.Append(@"
<line x1='"+(loc2d.x-(pol_vec_1_2d.x*this.spotsize))+"' y1='"+(anObject.svgysize-(loc2d.y-(pol_vec_1_2d.y*this.spotsize)))+"' x2='"+(loc2d.x+(pol_vec_1_2d.x*this.spotsize))+"' y2='"+(anObject.svgysize-(loc2d.y+(pol_vec_1_2d.y*this.spotsize)))+"' style='stroke:rgb(0,96,192);stroke-width:"+(casualty.intensity*this.spotsize/5)[email protected]"' />
<line x1='"+(loc2d.x-(pol_vec_2_2d.x*this.spotsize))+"' y1='"+(anObject.svgysize-(loc2d.y-(pol_vec_2_2d.y*this.spotsize)))+"' x2='"+(loc2d.x+(pol_vec_2_2d.x*this.spotsize))+"' y2='"+(anObject.svgysize-(loc2d.y+(pol_vec_2_2d.y*this.spotsize)))+"' style='stroke:rgb(192,96,0);stroke-width:"+(casualty.intensity*this.spotsize/5)[email protected]"' />
<line x1='"+(loc2d.x-(pol_vec_1_2d.x*this.spotsize))+"' y1='"+(anObject.svgysize-(loc2d.y-(pol_vec_1_2d.y*this.spotsize)))+"' x2='"+(loc2d.x+(pol_vec_1_2d.x*this.spotsize))+"' y2='"+(anObject.svgysize-(loc2d.y+(pol_vec_1_2d.y*this.spotsize)))+"' style='stroke:rgb(256,256,256);stroke-width:"+(casualty.intensity*this.spotsize/8)[email protected]"' />
<line x1='"+(loc2d.x-(pol_vec_2_2d.x*this.spotsize))+"' y1='"+(anObject.svgysize-(loc2d.y-(pol_vec_2_2d.y*this.spotsize)))+"' x2='"+(loc2d.x+(pol_vec_2_2d.x*this.spotsize))+"' y2='"+(anObject.svgysize-(loc2d.y+(pol_vec_2_2d.y*this.spotsize)))+"' style='stroke:rgb(256,256,256);stroke-width:"+(casualty.intensity*this.spotsize/8)[email protected]"' />
");
} // end condition for spot to be on the correct object and from the proper direction
}
centerSpots.Append("<!-- END OF CENTERSPOTS -->");
pol_lines.Append("<!-- END OF POLARISATION LINES -->");
retstr.Append(centerSpots);
retstr.Append(pol_lines);
foreach(Scientrace.SurfaceMarker marker in anObject.markers) {
retstr.Append(marker.exportSVG());
}
if (this.inline_legend) {
retstr.Append("<!-- Start Legend for "+pdpSource.ToString()+" -->");
retstr.Append(this.colourLegend(pdpSource));
retstr.Append("<!-- End Legend for "+pdpSource.ToString()+" -->");
}
retstr.Append("</svg> ");
return retstr.ToString();
}