Example #1
0
        // Constructor: plane, sphereCenterLoc, sphereRadius
        protected PlanoConvexLens(Scientrace.Object3dCollection parent, Scientrace.MaterialProperties mprops,
			Scientrace.PlaneBorder lensPlane, Scientrace.Location sphereCenterLoc, double sphereRadius)
            : base(parent, mprops)
        {
            this.lensPlane = lensPlane;
            this.sphereCenterLoc = sphereCenterLoc;
            this.sphereRadius = sphereRadius;
            this.dummySphere = new Scientrace.Sphere(null, null, sphereCenterLoc, sphereRadius);
        }
Example #2
0
 // Constructor: plane, sphereCenterLoc, sphereRadius
 protected PlanoConvexLens(Scientrace.Object3dCollection parent, Scientrace.MaterialProperties mprops,
                           Scientrace.PlaneBorder lensPlane, Scientrace.Location sphereCenterLoc, double sphereRadius)
     : base(parent, mprops)
 {
     this.lensPlane       = lensPlane;
     this.sphereCenterLoc = sphereCenterLoc;
     this.sphereRadius    = sphereRadius;
     this.dummySphere     = new Scientrace.Sphere(null, null, sphereCenterLoc, sphereRadius);
 }
Example #3
0
 protected void paramInit(Scientrace.Location sphere1CenterLoc, double sphere1Radius,
                          Scientrace.Location sphere2CenterLoc, double sphere2Radius)
 {
     //this.lensPlane = lensPlane;
     this.sphere1CenterLoc = sphere1CenterLoc;
     this.sphere2CenterLoc = sphere2CenterLoc;
     this.sphere2Radius    = sphere2Radius;
     this.sphere1Radius    = sphere1Radius;
     this.dummySphere1     = new Scientrace.Sphere(null, null, sphere1CenterLoc, sphere1Radius);
     this.dummySphere2     = new Scientrace.Sphere(null, null, sphere2CenterLoc, sphere2Radius);
 }
Example #4
0
        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);
        }
Example #5
0
        protected void paramInit(Scientrace.Location sphere1CenterLoc, double sphere1Radius,
		Scientrace.Location sphere2CenterLoc, double sphere2Radius)
        {
            //this.lensPlane = lensPlane;
            this.sphere1CenterLoc = sphere1CenterLoc;
            this.sphere2CenterLoc = sphere2CenterLoc;
            this.sphere2Radius = sphere2Radius;
            this.sphere1Radius = sphere1Radius;
            this.dummySphere1 = new Scientrace.Sphere(null, null, sphere1CenterLoc, sphere1Radius);
            this.dummySphere2 = new Scientrace.Sphere(null, null, sphere2CenterLoc, sphere2Radius);
        }