Ejemplo n.º 1
0
        //method for bernard
        public PointCloud getSubRegion(double[] points)
        {
            //check subregion is actually a sub region
            if (points[0] < this.minx)
            {
                throw new SubRegionOutOfBoundsException("xmin");
            }
            if (points[1] < this.miny)
            {
                throw new SubRegionOutOfBoundsException("ymin");
            }
            if (points[2] < this.minz)
            {
                throw new SubRegionOutOfBoundsException("zmin");
            }
            if (points[3] > this.maxx)
            {
                throw new SubRegionOutOfBoundsException("xmax");
            }
            if (points[4] > this.maxy)
            {
                throw new SubRegionOutOfBoundsException("ymax");
            }
            if (points[5] > this.maxz)
            {
                throw new SubRegionOutOfBoundsException("zmax");
            }

            double[] pointMin = { points[0], points[1], points[2] };
            double[] pointMax = { points[3], points[4], points[5] };

            System.Diagnostics.Debug.WriteLine("Limb Min: " + points[0] + " " + points[1] + " " + points[2]);
            System.Diagnostics.Debug.WriteLine("PC Min: " + this.minx + " " + this.miny + " " + this.minz);
            System.Diagnostics.Debug.WriteLine("Limb Max: " + points[3] + " " + points[4] + " " + points[5]);
            System.Diagnostics.Debug.WriteLine("PC Max: " + this.maxx + " " + this.maxy + " " + this.maxz);

            Object[] temp = this.points.range(pointMin, pointMax);

            List <Point3D> output = new List <Point3D>();

            for (int i = 0; i < temp.Length; i++)
            {
                output.Add(((PointRGB)(temp[i])).point);
            }

            PointCloud pc = new PointCloud(output);

            System.Diagnostics.Debug.WriteLine(pc.getAllPoints().Length);

            return(pc);
        }
Ejemplo n.º 2
0
        public GroupVisualiser(PointCloud pc)
        {
            //Constructor 1: construct point cloud as a single entity.

            mesh = new MeshGeometry3D();

            textureCoordinates = new Point[depthFrameHeight * depthFrameWidth];

            //get all points from the point cloud
            prgbs = pc.getAllPoints();

            //resize the depthframe array (for efficiency)
            depthFramePoints = new Point3D[prgbs.Length];
        }
Ejemplo n.º 3
0
        public GroupVisualiser(PointCloud pc)
        {
            //Constructor 1: construct point cloud as a single entity.

            mesh = new MeshGeometry3D();

            textureCoordinates = new Point[depthFrameHeight * depthFrameWidth];

            //get all points from the point cloud
            prgbs = pc.getAllPoints();

            //resize the depthframe array (for efficiency)
            depthFramePoints = new Point3D[prgbs.Length];
        }
Ejemplo n.º 4
0
        //method for bernard
        public PointCloud getSubRegion(double[] points)
        {
            //check subregion is actually a sub region
            if (points[0] < this.minx)
            {
                throw new SubRegionOutOfBoundsException("xmin");
            }
            if (points[1] < this.miny)
            {
                throw new SubRegionOutOfBoundsException("ymin");
            }
            if (points[2] < this.minz)
            {
                throw new SubRegionOutOfBoundsException("zmin");
            }
            if (points[3] > this.maxx)
            {
                throw new SubRegionOutOfBoundsException("xmax");
            }
            if (points[4] > this.maxy)
            {
                throw new SubRegionOutOfBoundsException("ymax");
            }
            if (points[5] > this.maxz)
            {
                throw new SubRegionOutOfBoundsException("zmax");
            }

            double[] pointMin = { points[0], points[1], points[2] };
            double[] pointMax = { points[3], points[4], points[5] };

            System.Diagnostics.Debug.WriteLine("Limb Min: " + points[0] + " " + points[1] + " " + points[2]);
            System.Diagnostics.Debug.WriteLine("PC Min: " + this.minx + " " + this.miny + " " + this.minz);
            System.Diagnostics.Debug.WriteLine("Limb Max: " + points[3] + " " + points[4] + " " + points[5]);
            System.Diagnostics.Debug.WriteLine("PC Max: " + this.maxx + " " + this.maxy + " " + this.maxz);

            Object[] temp = this.points.range(pointMin, pointMax);

            List<Point3D> output = new List<Point3D>();
            for (int i = 0; i < temp.Length; i++) {
                output.Add(((PointRGB)(temp[i])).point);
            }

            PointCloud pc = new PointCloud(output);

            System.Diagnostics.Debug.WriteLine(pc.getAllPoints().Length);

            return pc;
        }
Ejemplo n.º 5
0
        private void OpenGLControl_OpenGLDraw(object sender, SharpGL.SceneGraph.OpenGLEventArgs args)
        {
            //  Get the OpenGL instance that's been passed to us.
            OpenGL gl = args.OpenGL;

            //  Clear the color and depth buffers.
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);

            //  Reset the modelview matrix.
            gl.LoadIdentity();

            //  Move the geometry into a fairly central position.
            gl.Translate(0.0f, 0.0f, -6.0f);

            //  Draw a pyramid. First, rotate the modelview matrix.
            gl.Rotate(rotatePyramid, 0.0f, 1.0f, 0.0f);

            //  Start drawing discrete points
            gl.Begin(OpenGL.GL_POINTS);

            ICP.PointRGB[] allPoints = pcdl.getAllPoints();

            for (int i = 0; i < pcdl.size(); i++)
            {
                gl.Vertex(allPoints[i].point.X, allPoints[i].point.Y, allPoints[i].point.Z);
                gl.Color(0.0f, 1.0f, 0.0f);
            }

            //Start looping over all points from the point cloud.

            /*gl.Color(1.0f, 0.0f, 0.0f);
             * gl.Vertex(0.0f, 1.0f, 0.0f);
             * gl.Color(0.0f, 1.0f, 0.0f);
             * gl.Vertex(-1.0f, -1.0f, 1.0f);
             * gl.Color(0.0f, 0.0f, 1.0f);
             * gl.Vertex(1.0f, -1.0f, 1.0f);*/

            if (pcdl != null)
            {
                System.Diagnostics.Debug.WriteLine("Size of pc: " + pcdl.size());
            }

            /*gl.Color(1.0f, 0.0f, 0.0f);
             * gl.Vertex(0.0f, 1.0f, 0.0f);
             * gl.Color(0.0f, 0.0f, 1.0f);
             * gl.Vertex(1.0f, -1.0f, 1.0f);
             * gl.Color(0.0f, 1.0f, 0.0f);
             * gl.Vertex(1.0f, -1.0f, -1.0f);
             *
             * gl.Color(1.0f, 0.0f, 0.0f);
             * gl.Vertex(0.0f, 1.0f, 0.0f);
             * gl.Color(0.0f, 1.0f, 0.0f);
             * gl.Vertex(1.0f, -1.0f, -1.0f);
             * gl.Color(0.0f, 0.0f, 1.0f);
             * gl.Vertex(-1.0f, -1.0f, -1.0f);
             *
             * gl.Color(1.0f, 0.0f, 0.0f);
             * gl.Vertex(0.0f, 1.0f, 0.0f);
             * gl.Color(0.0f, 0.0f, 1.0f);
             * gl.Vertex(-1.0f, -1.0f, -1.0f);
             * gl.Color(0.0f, 1.0f, 0.0f);
             * gl.Vertex(-1.0f, -1.0f, 1.0f);*/
            gl.PointSize(10.0f);
            gl.End();

            //  Flush OpenGL.
            gl.Flush();

            //  Rotate the geometry a bit.
            rotatePyramid += 3.0f;
        }