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


C# Scientrace.getSphericalLoc方法代码示例

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


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

示例1: drawSphereSlice

        public StringBuilder drawSphereSlice(Scientrace.Object3d drawnObject3d, double lateral_circles, double meridians,
										Scientrace.Sphere sphere, double from_radians, double to_radians, 
										Scientrace.UnitVector sliceAlongDirection)
        {
            System.Text.StringBuilder retx3d = new System.Text.StringBuilder(1024);//"<!-- DOUBLECONVEXLENS GRID start -->");
            double pi2 = Math.PI*2;
            NonzeroVector orthoBaseVec1 = null;
            NonzeroVector orthoBaseVec2 = null;
            sliceAlongDirection.fillOrtogonalVectors(ref orthoBaseVec1, ref orthoBaseVec2);

            for (double iSphereCircle = 2*lateral_circles; iSphereCircle > 0; iSphereCircle--) { // the rings/parallels along the sliceAlongDirection axis
            double lateral_radians = (to_radians * (iSphereCircle / (2*lateral_circles)));
            double circle2DRadius = sphere.radius*Math.Sin(lateral_radians);
            double circle2DDistance = sphere.radius*Math.Cos(lateral_radians);
            retx3d.Append(this.drawCircle(sphere.loc+(sliceAlongDirection*circle2DDistance).toLocation(), circle2DRadius, sliceAlongDirection));

            for (double iSphereMerid = 0.5; iSphereMerid < 2*meridians; iSphereMerid++) { // meridians connect the rings/circles on the spherical surface

                Scientrace.Location tNodeLoc = sphere.getSphericalLoc(
                            orthoBaseVec1, orthoBaseVec2,
                            sliceAlongDirection,
                            to_radians * (iSphereCircle / (2*lateral_circles)), // lat_angle = theta
                            pi2 * (iSphereMerid/(2*meridians)) // mer_angle = phi
                            );
                if (!tNodeLoc.isValid())
                    throw new NullReferenceException("Cannot calculate base gridpoint at @ "+drawnObject3d.tag);
                Scientrace.Location tLatConnectLoc = sphere.getSphericalLoc(
                            orthoBaseVec1, orthoBaseVec2,
                            sliceAlongDirection,
                            to_radians * ((iSphereCircle-1) / (2*lateral_circles)), // lat_angle = theta
                            pi2 * ((iSphereMerid)/(2*meridians)) // mer_angle = phi
                            );
                if (!tLatConnectLoc.isValid())
                    throw new NullReferenceException("Cannot calculate lateral gridpoint at @ "+drawnObject3d.tag);

                Scientrace.X3DGridPoint tGridPoint = new Scientrace.X3DGridPoint(0, tNodeLoc, null, tLatConnectLoc);
                retx3d.AppendLine(tGridPoint.exportX3DnosphereRGB(this.primaryRGB));
                }} // end for iSphereCircle / iSphereMerid
            return retx3d;
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:40,代码来源:X3DShapeDrawer.cs


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