• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Scientrace类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Scientrace的典型用法代码示例。如果您正苦于以下问题:C# Scientrace类的具体用法?C# Scientrace怎么用?C# Scientrace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Scientrace类属于命名空间,在下文中一共展示了Scientrace类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: containsExclude

 public bool containsExclude(Scientrace.Location aLocation, double excludedMargin)
 {
     if (aLocation == null) { return false; }
     Scientrace.Location sLoc = (aLocation-this.loc); //shifted location based on plane origin
     Scientrace.Location tLoc = this.trf.transform(sLoc); //transformed location based on the plane basevectors and its normal
     return (tLoc.z >= excludedMargin);
 }
开发者ID:JoepBC,项目名称:scientrace,代码行数:7,代码来源:PlaneBorder.cs


示例2: TriangularPrism

        //length inherited from Prism
        public TriangularPrism(Scientrace.Object3dCollection parent, Scientrace.MaterialProperties mprops, 
			Scientrace.Location loc, Scientrace.NonzeroVector width, Scientrace.NonzeroVector height, 
			Scientrace.NonzeroVector length)
            : base(parent, mprops)
        {
            this.paramInit(loc, width, height, length);
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:8,代码来源:TriangularPrism.cs


示例3: constructPlaneNodeLoc

        public Scientrace.Location constructPlaneNodeLoc(Scientrace.Location planeCenter, double radius,
						double angle, Scientrace.NonzeroVector baseVec1, Scientrace.NonzeroVector baseVec2)
        {
            Scientrace.Vector ix = baseVec1.toVector()*radius*Math.Sin(angle);
            Scientrace.Vector iy = baseVec2.toVector()*radius*Math.Cos(angle);
            return planeCenter+ix+iy;
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:7,代码来源:PlanoConvexLens.cs


示例4: initCreatedRefractTrace

        public void initCreatedRefractTrace(Trace refractTrace, UnitVector surfaceNormal, Scientrace.Object3d fromObject3d, Scientrace.Object3d toObject3d)
        {
            double oldrefindex = fromObject3d.materialproperties.refractiveindex(this);
            double newrefindex = toObject3d.materialproperties.refractiveindex(this);
            //for definitions on the parameters below, check fullInternalReflects function.

            UnitVector incoming_trace_direction = this.traceline.direction;
            if (incoming_trace_direction.dotProduct(surfaceNormal) > 0) {
            surfaceNormal = surfaceNormal.negative();
            }

            Scientrace.UnitVector nnorm = surfaceNormal.negative();
            Scientrace.Vector incoming_normal_projection = nnorm*(incoming_trace_direction.dotProduct(nnorm));
            Vector L1 = incoming_trace_direction-incoming_normal_projection;
            double L2 = (oldrefindex/newrefindex)*L1.length;

            if (incoming_trace_direction == incoming_normal_projection) {
            //in case of normal incident light: do not refract.
            refractTrace.traceline.direction = incoming_trace_direction;
            return;
            }

            try {
            refractTrace.traceline.direction = ((nnorm*Math.Sqrt(1 - Math.Pow(L2,2)))
                    +(L1.tryToUnitVector()*L2)).tryToUnitVector();
            } catch (ZeroNonzeroVectorException) {
                Console.WriteLine("WARNING: cannot define direction for refraction trace. Using surface normal instead. (L1: "+incoming_trace_direction.trico()+", L2:"+incoming_normal_projection.trico()+").");
                refractTrace.traceline.direction = nnorm;
            } //end try/catch
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:30,代码来源:Trace-Obsolete_No_Polarisation_Support.cs


示例5: PhysicalObject3d

 public PhysicalObject3d(Object3dCollection parent, Scientrace.MaterialProperties materialproperties)
     : base(parent, materialproperties)
 {
     this.surface_sides = new HashSet<SurfaceSide>() {Scientrace.SurfaceSide.Both};
     //this.surface_sides.Add(Scientrace.SurfaceSide.Both);
     //this.materialproperties = materialproperties;
 }
开发者ID:JoepBC,项目名称:scientrace,代码行数:7,代码来源:PhysicalObject3d.cs


示例6: RandomCircleLightSource

        public RandomCircleLightSource(Scientrace.Object3dEnvironment env, Scientrace.Location center, Scientrace.UnitVector direction, 
									Scientrace.Plane plane, double radius, int linecount, LightSpectrum spectrum)
            : base(env)
        {
            //this.direction = direction;
            Random randNum = new Random();
            Scientrace.UnitVector urange, vrange;
            double r1, r2;
            urange = plane.u.toUnitVector();
            vrange = plane.v.toUnitVector();
            Scientrace.Line line;
            for (int iline = 0; iline < linecount; iline++) {
            //Scientrace.Line line = new Scientrace.Line(loc+(urange*randNum.NextDouble()+(vrange*randNum.NextDouble())).toLocation(), direction);
            r1 = 1-randNum.NextDouble()*2;
            r2 = 1-randNum.NextDouble()*2;
            if (Math.Pow(r1,2)+Math.Pow(r2,2)<1) {
                line = new Scientrace.Line(center+((urange*r1*radius)+(vrange*r2*radius)).toLocation(),direction);
                } else {
                iline--;
                continue;
                }
            //this.traces.Add(new Scientrace.Trace(wavelength*0.6, this, line, env));
            //this.traces.Add(new Scientrace.Trace(wavelength*0.8, this, line, env));
            //double wavelength = wlmin+(randNum.NextDouble()*(wlmax-wlmin));
            double wavelength = spectrum.wl(iline);
            double intensity = spectrum.it(iline);
            Console.WriteLine("Warning: ParallelRandomCylindricalLightSource does not use modulo yet");
            this.addTrace(new Scientrace.Trace(wavelength, this, line, env, intensity, intensity));
            //this.traces.Add(new Scientrace.Trace(wavelength*1.2, this, line, env));
            //this.traces.Add(new Scientrace.Trace(wavelength*1.4, this, line, env));
            }
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:32,代码来源:RandomCircleLightSource.cs


示例7: exportX3D

        public override string exportX3D(Scientrace.Object3dEnvironment env)
        {
            System.Text.StringBuilder retx3d = new System.Text.StringBuilder("<!-- SPHERE GRID start -->", 10000);

            Scientrace.Location tNodeLoc;
            Scientrace.Location tMerConnectLoc;
            Scientrace.Location tLatConnectLoc;
            Scientrace.X3DGridPoint tGridPoint;

            for (int ic = 0; ic <= this.x3d_circles_of_latitude; ic++) { //0-pi
            for (int im = 0; im < this.x3d_meridians; im++) { //0-2pi

                tNodeLoc = this.getNodeLoc(ic, im);
                tMerConnectLoc =
                    (ic > 0 && ic < this.x3d_meridians) ? // do not connect "points" located at north and south pole
                        this.getNodeLoc(ic, (im+1)%this.x3d_meridians)
                        : null;
                tLatConnectLoc = this.getNodeLoc(ic+1, im);

                // a gridpoint has a location and two neighbour location to which to connect to
                tGridPoint = new Scientrace.X3DGridPoint(env, tNodeLoc,
                    tMerConnectLoc, tLatConnectLoc);
                retx3d.AppendLine(tGridPoint.exportX3DnosphereRGBA("0.4 0.8 0 1"));
                }}
            retx3d.Append("<!-- Sphere grid end -->");
            return retx3d.ToString();
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:27,代码来源:Sphere.cs


示例8: Intersection

        public Intersection(bool intersects, Scientrace.Object3d object3d)
        {
            this.intersects = intersects;
            this.object3d = object3d;

            this.checkObject();//<- DEBUGGING:
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:7,代码来源:Intersection.cs


示例9: constructLightSource

        /* TO IMPLEMENT: Class="RandomToSurface"
        <LightSource BeamCount="N" Class="RandomToSurface" Seed="1">
        <Surface Class="circle" Radius="r" />
        <Center xyz="LENSXYZ" />
        <Normal xyz="DIRXYZ" />
        </Surface>
        </LightSource>

        */
        public Scientrace.LightSource constructLightSource(XElement xel, Scientrace.Object3dEnvironment env)
        {
            /* //Special property removed at 20151021
            XElement xspec = xel.Element("Spectrum");
            Scientrace.LightSpectrum aSpectrum = null;
            if (xspec == null) {
            //throw new XMLException("No Spectrum element found for: "+xel.ToString());
            } else {
            XMLSpectrumParser xsp = new XMLSpectrumParser();
            aSpectrum = xsp.parseLightSpectrum(xspec);
            }
            */

            //modified at 20150707
            //ShadowScientrace.ShadowLightSource shadowLS =
            //		new ShadowScientrace.ShadowLightSource(typeof(Scientrace.SpiralLightSource), env, aSpectrum);
            ShadowScientrace.ShadowLightSource shadowLS =
                new ShadowScientrace.ShadowLightSource(null, env);

            this.setClassInfo(xel, shadowLS);

            this.setLightSourceConstructorParams(shadowLS, xel);
            this.setLightSourceSettings(shadowLS, xel);

            return shadowLS.factory("no id");
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:35,代码来源:ShadowLightSourceConstruct.cs


示例10: exportX3D

        public string exportX3D(Scientrace.Object3dEnvironment env)
        {
            Scientrace.Vector a, b, c, d;
            //square
            a = Vector.ZeroVector();
            b = this.plane.u;
            c = this.plane.u+this.plane.v;
            d = this.plane.v;

            string colstr = "0.5 0.5 0.5 0.2";
            return @"<!-- Start Parallelogram instance -->\n <Transform translation='"+this.plane.loc.trico()[email protected]"'>
            <Shape>
            <!-- Coordinate prism sequence (matches coordIndex actually) 0 1 2 3 0 -->
            <LineSet vertexCount='5'>
            <Coordinate point='
            "+a.tricon()+b.tricon()+c.tricon()+d.tricon()+a.tricon()+"'/>" +

            /*@"<ColorRGBA color='0 1 0 1 0 1 0 1
            0 1 0 1 0 1 0 1
            0 1 0 1 0 1 0 1
            0 1 0 1 0 1 0 1' />
            </LineSet>" + */
            @"<ColorRGBA color='"+colstr +" "+colstr +" "+colstr +" "+colstr +" "+colstr +" "+colstr +" "+colstr +" "+colstr [email protected]"' />
            </LineSet>" +
            @"      </Shape>" +
            @"    </Transform>\n<!-- End Parallelogram instance -->";
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:27,代码来源:Parallelogram.cs


示例11: getCustomTracesListFromXData

        public List<Scientrace.Trace> getCustomTracesListFromXData(XElement xlight,
												Scientrace.Object3dEnvironment env)
        {
            string traces_filename = (this.X.getXStringByName(xlight, "Filename", null));
            if (traces_filename != null)
                if (System.IO.File.Exists(traces_filename)) {
                    XDocument xd = XDocument.Load(traces_filename);
                    return this.getCustomTracesListFromXData(xd.Element("LightSource"), env);
                    } else throw new System.IO.FileNotFoundException("CustomTraces filename ("+traces_filename+") does not exist.");
            // If there aren't any Trace sub-Elements, you might as well stop here (return null)
            if (!xlight.Elements("Trace").Any())
                        return null;
            List <Scientrace.Trace> customtraces = new List<Scientrace.Trace>();
            foreach (XElement xtrace in xlight.Elements("Trace")) {
                double wavelength = this.X.getXDouble(xtrace, "Wavelength",
                                        (this.X.getXDouble(xtrace, "m",
                                            ((this.X.getXDouble(xtrace, "nm", -1))*1E-9))
                                            )
                                        );
                if (wavelength <= 0) {
                    throw new XMLException("Error parsing wavelength from CustomTraces Lightsource. XML Source: \n"+
                        xtrace.ToString());
                    }
                double intensity = this.X.getXDouble(xtrace, "Intensity", 1);
                Scientrace.Location loc = this.X.getXLocation(xtrace, "Location");
                Scientrace.UnitVector dir = this.X.getXNzVectorByName(xtrace, "Direction").toUnitVector();
                customtraces.Add(
                                 new Scientrace.Trace(wavelength, null, new Scientrace.Line(loc, dir),
                                                      env, intensity, intensity)
                                 );
                }
            return customtraces;
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:33,代码来源:ShadowLightSourceConstruct.cs


示例12: orientedAgainst

 public new UnitVector orientedAgainst(Scientrace.Vector aVector)
 {
     if (aVector.dotProduct(this) > 0) {
     return this.negative();
     }
     return this;
 }
开发者ID:JoepBC,项目名称:scientrace,代码行数:7,代码来源:UnitVector.cs


示例13: formulaVector

 public Scientrace.Vector formulaVector(Scientrace.Vector aVector, XElement xformula)
 {
     string f_x = "x";
     string f_y = "y";
     string f_z = "z";
     if (xformula.Attribute("xyz") != null) {
     try {
         string xyz = xformula.Attribute("xyz").Value;
         char[] delimiterChars = { ';', '\t' };
         string[] elements = xyz.Split(delimiterChars);
         if (elements.Length !=3) {
             throw new XMLException("Element "+xformula.ToString()+" has \""+elements.Length+ "\" != 3 valid vector elements. ");
             }
         f_x=elements[0];
         f_y=elements[1];
         f_z=elements[2];
         } catch { throw new XMLException("Formula "+xformula.ToString()+" does not have proper parameters for {xyz} attribute (can't parse {"+xformula.Attribute("xyz").Value.ToString()+"}. Perhaps incorrect use of PreProcess variables or decimal separators?)."); }
     } // attribute "xyz"
     f_x = this.getXStringByName(xformula, "x", f_x);
     f_y = this.getXStringByName(xformula, "y", f_y);
     f_z = this.getXStringByName(xformula, "z", f_z);
     Dictionary<string, object> replace_vectors = new Dictionary<string, object>(){{"x", (decimal)aVector.x}, {"y", (decimal)aVector.y}, {"z", (decimal)aVector.z} };
     return new Scientrace.Vector(
     Scientrace.MathStrings.solveString(f_x, replace_vectors),
     Scientrace.MathStrings.solveString(f_y, replace_vectors),
     Scientrace.MathStrings.solveString(f_z, replace_vectors)
     );
 }
开发者ID:JoepBC,项目名称:scientrace,代码行数:28,代码来源:CustomXMLDocumentOperations.cs


示例14: getColorFromHTML

 public Scientrace.RGBColor getColorFromHTML(string varname, Scientrace.RGBColor defval)
 {
     Scientrace.RGBColor retval;
     retval = Scientrace.RGBColor.FromHTML(this.getString(varname));
     if (retval == null) return defval;
     return retval;
 }
开发者ID:JoepBC,项目名称:scientrace,代码行数:7,代码来源:ShadowClasses.cs


示例15: angleToRGB

        public string angleToRGB(Scientrace.Spot aCasualty, PhysicalObject3d physObj)
        {
            UnitVector inAngle = aCasualty.trace.traceline.direction;
            Scientrace.Parallelogram pg = physObj.getDistributionSurface();
            Scientrace.NonzeroVector norm = physObj.getSurfaceNormal();

            UnitVector y = pg.plane.v.toUnitVector();
            UnitVector x = null;
            try {
            x = norm.crossProduct(y).tryToUnitVector();
            } catch { throw new ZeroNonzeroVectorException("The vertical vector (plane.v) is parallel to the unit normal.");
            }
            double dx = x.dotProduct(inAngle);
            double dy = y.dotProduct(inAngle);

            double lengthFraction = Math.Sqrt((dx*dx)+(dy*dy));
            //Console.WriteLine("Length: "+lengthFraction+ " vs: "+((x*dx)+(y*dy)).length);

            double angle = Math.Atan2(dy, dx);

            return this.angleToHTML(angle, 2*Math.Asin(lengthFraction)/Math.PI);

            //physObj.getSurfaceNormal()
            //aCasualty.object3d.
            //		throw new Exception("Not yet implemented");
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:26,代码来源:TraceJournal-Image_Data_Export.cs


示例16: Angle

 public Angle(Scientrace.Trace fromTrace, Scientrace.Trace toTrace, Scientrace.Intersection intersection)
 {
     this.fromTrace = fromTrace;
     this.toTrace = toTrace;
     this.radians = fromTrace.traceline.direction.angleWith(toTrace.traceline.direction);
     this.intersection = intersection;
 }
开发者ID:JoepBC,项目名称:scientrace,代码行数:7,代码来源:Angle.cs


示例17: exportX3D

        public override string exportX3D(Scientrace.Object3dEnvironment env)
        {
            // prev after Transform      <Viewpoint description='	LineSet cube close up' position='0 0 5'/>
            //TODO: try to transform to indexedlineset
            Scientrace.Vector a, b, c, d, e, f, g, h;

            a = Vector.ZeroVector();
            //front square
            b = this.width;
            c = this.height+this.width;
            d = this.height;
            e = this.length;
            //back square
            f = this.length+this.width;
            g = this.length+this.width+this.height;
            h = this.length+this.height;

            //front square

            //back square

            //connecting squares

            return "<!-- Start RectangularPrism instance -->\n<Transform translation='"+this.loc.trico()+
                "'>\r\n      <Shape>\r\n        <!-- Coordinate rectangprism sequence (matches coordIndex actually) 0 1 2 3 0, 4 5 6 7 4, 0 4, 1 5, 2 6, 3 7 -->\r\n"+
                "        <LineSet vertexCount='5 5 2 2 2 2'>\r\n          <Coordinate point='\r\n"+
                a.tricon()+b.tricon()+c.tricon()+d.tricon()+a.tricon()+e.tricon()+f.tricon()+g.tricon()+h.tricon()+e.tricon()+a.tricon()+e.tricon()+b.tricon()+f.tricon()+c.tricon()+g.tricon()+d.tricon()+h.tricon()+
                "'/>\r\n"+
                "<ColorRGBA color='"+string.Concat(Enumerable.Repeat("0.5 0.5 0.5 1 ", 18))+"' />"+ // 18 due to 12 lines in 6 blocks produces 12+6=18, anyway this works?
                "        </LineSet>\r\n      </Shape>\r\n    </Transform>\n<!-- End RectangularPrism instance -->";
            //          <Color color='1 0 0 1 0.5 0 1 1 0 0 1 0 1 0 0 0 0 1 0.8 0 0.8 0.3 0 0.3 1 1 1 0 0 1 1 0 0 0 0 1 1 0.5 0 0.8 0 0.8 1 1 0 0.3 0 0.3 0 1 0 1 1 1'/>
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:32,代码来源:RectangularPrism.cs


示例18: addLightSourceTag

 public void addLightSourceTag(Scientrace.LightSource anObject, XElement xel)
 {
     XAttribute tag = xel.Attribute("Tag");
     if (tag != null) {
         anObject.tag = tag.Value;
         }
 }
开发者ID:JoepBC,项目名称:scientrace,代码行数:7,代码来源:XMLLightSourceParser.cs


示例19: SingleRaySource

 public SingleRaySource(Scientrace.Line rayline, int raycount, LightSpectrum spectrum, Scientrace.Object3dEnvironment env)
     : base(env)
 {
     this.weighted_intensity = spectrum.total_intensity;
     this.spectrum = spectrum;
     this.linecount = raycount;
     this.ray = rayline;
 }
开发者ID:JoepBC,项目名称:scientrace,代码行数:8,代码来源:SingleRaySource.cs


示例20: InfiniteCylinderBorder

        public InfiniteCylinderBorder(Scientrace.Object3dCollection parent, Scientrace.MaterialProperties mprops,
									Scientrace.Location loc, Scientrace.UnitVector direction, double radius)
            : base(parent, mprops)
        {
            this.direction = direction;
            this.radius = radius;
            this.loc = loc;
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:8,代码来源:InfiniteCylinderBorder.cs



注:本文中的Scientrace类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ScintillaNet类代码示例发布时间:2022-05-24
下一篇:
C# ScienceData类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap