AddSphere() public method

public AddSphere ( double xCenter, double yCenter, double zCenter, double radius ) : void
xCenter double
yCenter double
zCenter double
radius double
return void
Example #1
0
        private static void CreateWavesWithImage()
        {
            var asb = new AutoStereogramBuilder(1024, 768, 3);

            asb.AddSphere(-0.2, -0.2, 1.6, 0.025);
            asb.AddSphere(-0.2, -0.2, 1.4, 0.025);
            asb.AddSurface(WavesSurfaceFunc, 2.3, 1.7);

            Bitmap bitmap = (Bitmap)Image.FromFile(GetPathAtAssemblyLocation("input\\hi.png"));

            asb.AddModelByDepthMap(bitmap, new Point3D {
                X = 0.1, Y = -0.3, Z = 1.8
            }, new Vector3D {
                X = 1, Y = 0.5, Z = -1
            },
                                   new Vector3D {
                X = -0.5, Y = 1, Z = -1
            }, new Vector3D {
                X = 1, Y = 1, Z = 1
            }, 0.8, 0.8, 0.05);

            Bitmap backgroundImage = (Bitmap)Image.FromFile(GetPathAtAssemblyLocation("input\\background.jpg"));

            asb.GenerateBitmap(backgroundImage).Save(GetPathAtAssemblyLocation("output\\hello.jpg"), ImageFormat.Jpeg);
        }
Example #2
0
        private static void CreateSpheres(int subpixelsCount)
        {
            var asb = new AutoStereogramBuilder(1024, 768, subpixelsCount);

            asb.AddHorizontalPlane(2);
            asb.AddSphere(asb.Width / 2, asb.Height / 2, 1.7, 0.25);
            asb.AddSphere(asb.Width / 2 - 0.25, asb.Height / 2 - 0.25, 1.85, 0.15);
            asb.AddSphere(asb.Width / 2 + 0.4, asb.Height / 2, 1.7, 0.1);
            asb.AddSphere(asb.Width / 2 + 0.1, asb.Height / 2 - 0.05, 1.3, 0.05);

            asb.GenerateBitmap().Save(GetPathAtAssemblyLocation(string.Format("output\\spheres{0}.gif", subpixelsCount)), ImageFormat.Gif);
        }
Example #3
0
        private static void CreateObjectsAtTwoSides()
        {
            var asb = new AutoStereogramBuilder(1680, 1050, 3);

            asb.AddHorizontalPlane(2);
            asb.AddHorizontalPlane(1.8, (x, y, z) => (x - asb.Width / 2) * (x - asb.Width / 2) / 0.8 + (y - asb.Height / 2) * (y - asb.Height / 2) / 0.4 <= 1);
            asb.AddHorizontalPlane(asb.Width * 0.35, asb.Width * 0.65, asb.Height * 0.35, asb.Height * 0.65, -0.2);
            asb.AddSphere(asb.Width / 2, asb.Height / 2, -0.25, 0.03);

            asb.GenerateBitmap().Save(GetPathAtAssemblyLocation("output\\twosides.gif"), ImageFormat.Gif);
        }