예제 #1
0
 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));
 }
예제 #2
0
        // 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);
        }
예제 #3
0
        // Factory method: lensFlatCenterLoc, sphereRadius, lensDiameter
        static public 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));
        }