15,12;14,6;15,3;14,3;13,6;11,6;13,12;14,6;14,6;15,6;14,6;13,13;-1,6;15,3;15,3;17,3;17,3;18,3;18,3;18,6;15,3;15,3;14,3;14,3;13,12;13,3;13,3;14,6;15,3;15,3;15,3;15,3;14,3;14,3;13,3;13,3;11,12;15,12;14,6;15,3;14,3;13,6;11,6;13,6;13,6;14,6;14,6;13,6;14,6;15,18;-1,4
http://ototama.com/music/folksong/score.php?id=139
2014年3月3日月曜日
方角センサ
systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
// 周波数(Hz)
int frequency = 10;
// インスタンスの生成
manager = [[CMMotionManager alloc] init];
// CMDeviceMotionの開始
[self startCMDeviceMotion:frequency];
- (void)startCMDeviceMotion:(int)frequency
{
// センサーの有無を確認
if (manager.deviceMotionAvailable) {
// 更新間隔の指定
manager.deviceMotionUpdateInterval = 1 / frequency; // 秒
// ハンドラ
CMDeviceMotionHandler handler = ^(CMDeviceMotion *motion, NSError *error) {
/* magnetometer */
if (5.0 < systemVersion && manager.magnetometerAvailable) {
// "磁北"か"真北"からの角度。Y軸方向を起点にするため、(x, y)を渡す
double radian = atan2(motion.magneticField.field.x, motion.magneticField.field.y);
}
/* CMAttitude */
roll = motion.attitude.roll;
pitch = motion.attitude.pitch;
yaw = motion.attitude.yaw;
rotationMatrix = motion.attitude.rotationMatrix;
double tmp[3];
double PI = 3.14159283;
tmp[0] =0.0;
tmp[1] = 0.0;
tmp[2] = -1.0;
center[0] = rotationMatrix.m11 * tmp[0] + rotationMatrix.m21 * tmp[1] +rotationMatrix.m31 * tmp[2];
center[1] = rotationMatrix.m12 * tmp[0] + rotationMatrix.m22 * tmp[1] +rotationMatrix.m32 * tmp[2];
center[2] = rotationMatrix.m13 * tmp[0] + rotationMatrix.m23 * tmp[1] +rotationMatrix.m33 * tmp[2];
for (int i=0;i<3;i++){
center[i] = round(center[i]*100)/100.0;
}
NSLog(@"center=%lf,%lf,%lf",center[0],center[1],center[2]);
tmp[0] = 0.0;
tmp[1] = 1.0;
tmp[2] = 0.0;
up[0] = rotationMatrix.m11 * tmp[0] + rotationMatrix.m21 * tmp[1] +rotationMatrix.m31 * tmp[2];
up[1] = rotationMatrix.m12 * tmp[0] + rotationMatrix.m22 * tmp[1] +rotationMatrix.m32 * tmp[2];
up[2] = rotationMatrix.m13 * tmp[0] + rotationMatrix.m23 * tmp[1] +rotationMatrix.m33 * tmp[2];
for (int i=0;i<3;i++){
up[i] = round(up[i]*100)/100.0;
}
NSLog(@"up=%lf,%lf,%lf",up[0],up[1],up[2]);
};
// DeviceMotionの開始
if (5.0 < systemVersion) {
[manager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXTrueNorthZVertical toQueue:[NSOperationQueue currentQueue] withHandler:handler];
} else {
[manager startDeviceMotionUpdatesToQueue:[NSOperationQueue currentQueue] withHandler:handler];
}
}
}
ぞうさん
15,9;17,3;18,6;15,9;17,3;18,6;15,9;14,3;13,3;11,3;13,3;13,3;14,3;15,3;14,6;11,9;13,6;10,3;11,3;13,6;15,6;14,9;13,3;17,3;18,3;15,18
http://ototama.com/music/folksong/score.php?id=151
http://ototama.com/music/folksong/score.php?id=151
チューリップ
18,4;17,4;16,8;18,4;17,4;16,8;14,4;16,4;17,4;18,4;17,4;16,4;17,8;18,4;17,4;16,8;18,4;17,4;16,8;14,4;16,4;17,4;18,4;17,4;16,4;18,8;14,4;14,4;16,4;14,4;13,4;13,4;14,8;16,4;16,4;17,4;17,4;18,12;-1,4;-1,1
http://ototama.com/music/folksong/score.php?id=155
http://ototama.com/music/folksong/score.php?id=155
うれしいひなまつり
14,4;14,4;14,4;15,4;14,4;14,4;11,4;13,4;14,4;14,4;13,4;13,4;14,12;-1,4;16,4;16,4;16,4;17,4;16,4;16,4;14,4;16,4;17,4;17,4;16,4;17,4;18,12;-1,4;11,8;11,4;10,4;11,4;13,2;14,2;16,4;16,4;14,4;14,4;11,4;13,4;14,12;-1,4;16,8;17,4;18,4;17,4;16,4;14,4;11,4;13,4;14,4;16,4;17,4;18,12;-1,4
http://ototama.com/music/folksong/score.php?id=169
http://ototama.com/music/folksong/score.php?id=169
赤とんぼ
18,3;15,3;15,9;14,3;13,3;11,3;8,3;10,3;11,6;10,3;15,3;15,6;14,6;13,12;-1,6;13,3;10,3;11,9;10,3;8,3;10,3;11,3;10,3;11,3;13,3;11,3;13,3;15,3;13,3;14,3;15,3;15,12;-1,6
http://ototama.com/music/folksong/score.php?id=130
http://ototama.com/music/folksong/score.php?id=130
タッチ位置と画像の位置を合わせる
UITapGestureRecognizer* pan = (UITapGestureRecognizer*) sender;
CGPoint location = [pan locationInView:self.view];
NSLog(@"pan x=%f, y=%f", location.x, location.y);
started =true;
areaValue = [[AreaValue alloc] init];
areaValue->x = location.x/self.view.frame.size.width*480;
areaValue->y = location.y/self.view.frame.size.height*640;
登録:
投稿 (Atom)