public UniformTraceModifier(DistributionPattern distributionpattern, SpatialDistribution spatialdistribution,
                             NonzeroVector meanvector)
 {
     this.distrPattern        = distributionpattern;
     this.spatialDistribution = spatialdistribution;
     this.meanVec             = meanvector;
     meanvector.fillOrtogonalVectors(ref this.baseVec1, ref this.baseVec2);
 }
示例#2
0
        public UniformTraceModifier(DistributionPattern distributionpattern, SpatialDistribution spatialdistribution,
				NonzeroVector meanvector)
        {
            this.distrPattern = distributionpattern;
            this.spatialDistribution = spatialdistribution;
            this.meanVec = meanvector;
            meanvector.fillOrtogonalVectors(ref this.baseVec1, ref this.baseVec2);
        }
示例#3
0
        public override string exportX3D(Scientrace.Object3dEnvironment env)
        {
            Scientrace.Location h1 = this.planoCenterLoc();
            double r           = this.sphereRadius;
            double x           = this.getLensRadius();
            double lensRadians = Math.Asin(x / r);

            NonzeroVector baseVecZ = this.lensPlane.getNormal();
            NonzeroVector baseVec1 = null;
            NonzeroVector baseVec2 = null;

            baseVecZ.fillOrtogonalVectors(ref baseVec1, ref baseVec2);

            double lat_circles = 3;
            double meridians   = 12;

            System.Text.StringBuilder retx3d = new System.Text.StringBuilder("<!-- PLANOCONVEXLENS GRID start -->", 1024);
            retx3d.Append("\t<!-- Plano part -->");


            Scientrace.Location     tNodeLoc;
            Scientrace.Location     tMerConnectLoc;
            Scientrace.Location     tLatConnectLoc;
            Scientrace.X3DGridPoint tGridPoint;
            double pi2 = Math.PI * 2;

            for (double iPlaneCircle = lat_circles; iPlaneCircle > 0; iPlaneCircle--)
            {
                for (double iPlaneMerid = 0; iPlaneMerid < meridians; iPlaneMerid++)
                {
                    tNodeLoc = this.constructPlaneNodeLoc(h1,
                                                          x * iPlaneCircle / lat_circles, pi2 * iPlaneMerid / meridians,
                                                          baseVec1, baseVec2);
                    tMerConnectLoc = this.constructPlaneNodeLoc(h1,
                                                                x * iPlaneCircle / lat_circles, pi2 * (iPlaneMerid + 1) / meridians,
                                                                baseVec1, baseVec2);
                    tLatConnectLoc = this.constructPlaneNodeLoc(h1,
                                                                x * (iPlaneCircle - 1) / lat_circles, pi2 * iPlaneMerid / meridians,
                                                                baseVec1, baseVec2);
                    tGridPoint = new Scientrace.X3DGridPoint(env, tNodeLoc, tMerConnectLoc, tLatConnectLoc);
                    retx3d.AppendLine(tGridPoint.exportX3DnosphereRGBA("0.4 0 0.2 1"));
                }
            }                      //end for iPlaneCircles / iPlaneMerid

            retx3d.Append("\t<!-- End of plano part -->");
            retx3d.Append("\t<!-- Convex part -->");

            for (double iSphereCircle = 2 * lat_circles; iSphereCircle > 0; iSphereCircle--)
            {
                for (double iSphereMerid = 0.5; iSphereMerid < 2 * meridians; iSphereMerid++)
                {
                    //double lat_angle = lensRadians * (iSphereCircle / lat_circles); // theta
                    //double mer_angle = pi2 * (iSphereMerid/meridians); // mer_angle = phi
                    tNodeLoc = this.constructSphereNodeLoc(
                        lensRadians * (iSphereCircle / (2 * lat_circles)),          // lat_angle = theta
                        pi2 * (iSphereMerid / (2 * meridians)),                     // mer_angle = phi
                        baseVec1, baseVec2, baseVecZ);
                    tMerConnectLoc = this.constructSphereNodeLoc(
                        lensRadians * (iSphereCircle / (2 * lat_circles)),              // lat_angle = theta
                        pi2 * ((iSphereMerid + 1) / (2 * meridians)),                   // mer_angle = phi
                        baseVec1, baseVec2, baseVecZ);
                    tLatConnectLoc = this.constructSphereNodeLoc(
                        lensRadians * ((iSphereCircle - 1) / (2 * lat_circles)),    // lat_angle = theta
                        pi2 * (iSphereMerid / (2 * meridians)),                     // mer_angle = phi
                        baseVec1, baseVec2, baseVecZ);
                    tGridPoint = new Scientrace.X3DGridPoint(env, tNodeLoc, tMerConnectLoc, tLatConnectLoc);
                    retx3d.AppendLine(tGridPoint.exportX3DnosphereRGBA("0.2 0 0.4 1"));
                }
            }                      // end for iSphereCircle / iSphereMerid

            retx3d.Append("\t<!-- Convex part -->");
            retx3d.Append("\t<!-- End of Convex part -->");
            retx3d.Append("<!-- End of PLANOCONVEXLENS GRID -->");
            return(retx3d.ToString());
        }         //end string exportX3D(env)