当前位置: 首页>>代码示例>>C#>>正文


C# Scientrace.normalizedVector方法代码示例

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


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

示例1: CreateWithLensDiameter

        // Factory method: lensFlatCenterLoc, sphereRadius, lensDiameter
        public static Scientrace.PlanoConvexLens CreateWithLensDiameter(Scientrace.Object3dCollection parent, 
					Scientrace.MaterialProperties mprops,
					Scientrace.Location lensFlatCenterLoc, double lensDiameter,
					Scientrace.NonzeroVector sphereRadiusVec)
        {
            Scientrace.PlaneBorder aPlane = new PlaneBorder(lensFlatCenterLoc, sphereRadiusVec);
            double r /*sphere radius*/ = sphereRadiusVec.length;
            double x /*lens radius*/ = lensDiameter/2;
            double y /*distance lens center to sphere center*/ = Math.Sqrt((r*r)-(x*x));
            double t /*thickness*/ = r-y;

            //Console.WriteLine("sphereradius: "+r+" lens thickness: "+t+" y:"+y+" x:"+x);

            if (t<=0) {
                throw new Exception("This PlanoConvexLens cannot be created: "+sphereRadiusVec.trico()+"/"+lensDiameter);
                }
            Scientrace.Location sphereLoc = lensFlatCenterLoc - (sphereRadiusVec.normalizedVector()*y);
            //Console.WriteLine("sphereLoc: "+sphereLoc.trico()+" lensFlatCenterLoc: "+t+" lensFlatCenterLoc:"+lensFlatCenterLoc.trico());
            return new PlanoConvexLens(parent, mprops, aPlane, sphereLoc, r);
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:21,代码来源:PlanoConvexLens.cs

示例2: initWithLensDiameter

        // Factory method: lensFlatCenterLoc, sphereRadius, lensDiameter
        public void initWithLensDiameter(Scientrace.Location lensPlaneCenterLoc, Scientrace.NonzeroVector lensPlaneNormal,
					double lensDiameter, double sphere1Radius, double sphere2Radius)
        {
            //Console.WriteLine("New lens: Loc: "+lensPlaneCenterLoc.trico()+" normal: "+lensPlaneNormal.trico()+" diameter:"+lensDiameter+" r1:"+sphere1Radius+" r2:"+sphere2Radius);
            //Scientrace.PlaneBorder aPlane = new PlaneBorder(lensPlaneCenterLoc, lensPlaneNormal);
            double r1 /*sphere radius*/ = sphere1Radius;
            double r2 /*sphere radius*/ = sphere2Radius;
            double x /*lens radius*/ = lensDiameter/2;
            if ((x > r1) || (x > r2)) {
                throw new Exception("DoubleConvexLens cannot be created, on of sphere radii is larger than lens radius: "+r1+"|"+r2+" > "+x);
                }
            /* y => distance lens center to sphere center*/
            double y1  = Math.Sqrt((r1*r1)-(x*x));
            double y2  = Math.Sqrt((r2*r2)-(x*x));

            Scientrace.Location sphere1Loc = lensPlaneCenterLoc - (lensPlaneNormal.normalizedVector()*y1);
            Scientrace.Location sphere2Loc = lensPlaneCenterLoc + (lensPlaneNormal.normalizedVector()*y2);
            //Console.WriteLine("sphereLoc: "+sphere1Loc.trico()+"/"+sphere2Loc.trico());
            //+	" lensFlatCenterLoc: "+t+" lensFlatCenterLoc:"+lensFlatCenterLoc.trico());

            this.paramInit(sphere1Loc, r1, sphere2Loc, r2);
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:23,代码来源:DoubleConvexLens.cs

示例3: getSphericalLoc

        public Location getSphericalLoc(Scientrace.NonzeroVector xvec, Scientrace.NonzeroVector yvec, 
									Scientrace.NonzeroVector zvec,
									Scientrace.Vector sphereCenter, double sphereRadius,
									double theta, double phi)
        {
            return this.getEllipsoidLoc(
                xvec.normalizedVector()*sphereRadius,
                yvec.normalizedVector()*sphereRadius,
                zvec.normalizedVector()*sphereRadius,
                sphereCenter, theta, phi);
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:11,代码来源:Sphere.cs


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