Page 19 - 2020학년도 MDP과제발표회 자료집 (통신과) (3)
P. 19

void  clrvoxel(int  x,  int  y,  int  z)
            {
                    if  (inrange(x,y,z))

                            cube[z][y]  &=  ~(1  <<  x);
            }


            unsigned  char  getvoxel(int  x,  int  y,  int  z)
            {

                    if  (inrange(x,y,z))
                    {
                            if  (cube[z][y]  &  (1  <<  x))
                            {
                                    return  0x01;

                            }  else
                            {
                                    return  0x00;
                            }
                    }  else

                    {
                            return  0x00;
                    }
            }



            void  altervoxel(int  x,  int  y,  int  z,  int  state)
            {
                    if  (state  ==  1)
                    {
                            setvoxel(x,y,z);

                    }  else
                    {
                            clrvoxel(x,y,z);
                    }
            }



            void  flpvoxel(int  x,  int  y,  int  z)
            {
                    if  (inrange(x,  y,  z))
                            cube[z][y]  ^=  (1  <<  x);

            }




                                                         -  18  -
   14   15   16   17   18   19   20   21   22   23   24