+++ /dev/null
-/* \r
- * PROJECT: NyARToolkit(Extension)\r
- * --------------------------------------------------------------------------------\r
- * The NyARToolkit is Java edition ARToolKit class library.\r
- * Copyright (C)2008-2009 Ryo Iizuka\r
- *\r
- * This program is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- * \r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program. If not, see <http://www.gnu.org/licenses/>.\r
- * \r
- * For further information please contact.\r
- * http://nyatla.jp/nyatoolkit/\r
- * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
- * \r
- */\r
-package jp.nyatla.nyartoolkit.nyidmarker.data;\r
-\r
-import jp.nyatla.nyartoolkit.nyidmarker.*;\r
-\r
-\r
-public class NyIdMarkerDataEncoder_RawBit implements INyIdMarkerDataEncoder\r
-{ \r
- private final static int _DOMAIN_ID=0;\r
- private final static int[] _mod_data={7,31,127,511,2047,4095};\r
- public boolean encode(NyIdMarkerPattern i_data,INyIdMarkerData o_dest)\r
- {\r
- final NyIdMarkerData_RawBit dest=(NyIdMarkerData_RawBit)o_dest;\r
- if(i_data.ctrl_domain!=_DOMAIN_ID){\r
- return false;\r
- }\r
- //パケット数計算\r
- final int resolution_len=(i_data.model+1);\r
- final int packet_length=(resolution_len*resolution_len)/8+1;\r
- int sum=0;\r
- for(int i=0;i<packet_length;i++){\r
- dest.packet[i]=i_data.data[i];\r
- sum+=i_data.data[i];\r
- }\r
- //チェックドット値計算\r
- sum=sum%_mod_data[i_data.model-2];\r
- //チェックドット比較\r
- if(i_data.check!=sum){\r
- return false;\r
- }\r
- dest.length=packet_length;\r
- return true;\r
- }\r
- public INyIdMarkerData createDataInstance()\r
- {\r
- return new NyIdMarkerData_RawBit();\r
- }\r
-}\r