AddHorizontalPlane() public method

public AddHorizontalPlane ( double z, CheckPoint checkPoint = null ) : void
z double
checkPoint CheckPoint
return void
Example #1
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);
        }
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 CreatePipe()
        {
            var asb = new AutoStereogramBuilder(1024, 768, 3);

            asb.AddHorizontalPlane(2);

            List <Circle3D> circles = new List <Circle3D>();

            for (double x = -0.18; x < 0.55; x += 0.003)
            {
                circles.Add(new Circle3D {
                    Center = new Point3D {
                        X = x, Y = 0.1 + Math.Sin(x * 50) * 0.2, Z = 1.5 + Math.Cos(x * 50) * 0.2
                    }, Radius = 0.04 + x * 0.03
                });
            }

            CreatePipe(asb, circles);

            asb.GenerateBitmap().Save(GetPathAtAssemblyLocation("output\\pipe.gif"), ImageFormat.Gif);
        }
Example #4
0
        private static void CreateFigures()
        {
            var asb = new AutoStereogramBuilder(1024, 768, 3);

            asb.AddHorizontalPlane(2);

            Vector3D v1 = new Vector3D {
                X = 1, Y = 0, Z = 0
            };

            for (int n = 0; n < 4; n++)
            {
                Vector3D v2 = new Vector3D {
                    X = 0, Y = Math.Cos(n * Math.PI / 8), Z = -Math.Sin(n * Math.PI / 8)
                };
                Vector3D v3 = new Vector3D {
                    X = 0, Y = Math.Sin(n * Math.PI / 8), Z = Math.Cos(n * Math.PI / 8)
                };

                // hexagonal prism

                Point3D[] prismUpperPoints = new Point3D[6], prismLowerPoints = new Point3D[6];

                for (int m = 0; m < 6; m++)
                {
                    prismUpperPoints[m] = new Point3D {
                        X = -0.2 + n * 0.25, Y = -0.2, Z = 1.7
                    } +v1 *Math.Sin(m / 3.0 *Math.PI) * 0.1 + v2 * Math.Cos(m / 3.0 * Math.PI) * 0.1 - v3 * 0.05;

                    prismLowerPoints[m] = new Point3D {
                        X = -0.2 + n * 0.25, Y = -0.2, Z = 1.7
                    } +v1 *Math.Sin(m / 3.0 *Math.PI) * 0.1 + v2 * Math.Cos(m / 3.0 * Math.PI) * 0.1 + v3 * 0.05;
                }

                asb.AddPolygon(prismUpperPoints);
                asb.AddPolygon(prismLowerPoints);

                for (int m = 0; m < 6; m++)
                {
                    asb.AddPolygon(new Point3D[] { prismLowerPoints[m], prismUpperPoints[m], prismUpperPoints[(m + 1) % 6], prismLowerPoints[(m + 1) % 6] });
                }

                // cylinder

                asb.AddCylinder(new Point3D {
                    X = -0.2 + n * 0.25, Y = 0.1, Z = 1.7
                } -v3 * 0.1, new Point3D {
                    X = -0.2 + n * 0.25, Y = 0.1, Z = 1.7
                } +v3 * 0.1, 0.08);

                // octahedron

                Point3D octahedronCenter = new Point3D {
                    X = -0.2 + n * 0.25, Y = 0.4, Z = 1.7
                };
                Point3D   octahedronUpperPoint = octahedronCenter - v3 * 0.1 * Math.Sqrt(2), octahedronLowerPoint = octahedronCenter + v3 * 0.1 * Math.Sqrt(2);
                Point3D[] octahedronMiddlePoints = new Point3D[] { octahedronCenter + v1 * 0.1 + v2 * 0.1, octahedronCenter - v1 * 0.1 + v2 * 0.1,
                                                                   octahedronCenter - v1 * 0.1 - v2 * 0.1, octahedronCenter + v1 * 0.1 - v2 * 0.1 };

                for (int m = 0; m < 4; m++)
                {
                    asb.AddPolygon(new Point3D[] { octahedronUpperPoint, octahedronMiddlePoints[m], octahedronMiddlePoints[(m + 1) % 4] });
                    asb.AddPolygon(new Point3D[] { octahedronLowerPoint, octahedronMiddlePoints[m], octahedronMiddlePoints[(m + 1) % 4] });
                }
            }

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