project_files/HedgewarsMobile/Classes/CGPointUtils.h
author nemo
Wed, 22 Dec 2010 14:01:43 -0500
changeset 4630 7e65cdaea255
parent 4476 4bf74e158f44
child 4976 088d40d8aba2
permissions -rw-r--r--
Another snow variant

/*
 *  CGPointUtils.h
 *  PinchMe
 *
 *  Created by Jeff LaMarche on 8/2/08.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */

#import <CoreGraphics/CoreGraphics.h>

#define degreesToRadians(x) ( M_PI * x / 180.0)
#define radiansToDegrees(x) (180.0 * x / M_PI )

#define HWX(x) (int)(x-screen.size.height/2)/HW_zoomFactor()
#define HWY(x) (int)(screen.size.width-x)/HW_zoomFactor() + (IS_IPAD()?40:17.5)*HW_zoomLevel()/HW_zoomFactor()

#define HWXZ(x) (int)(x-screen.size.height/2)
#define HWYZ(x) (int)(screen.size.width-x)

CGFloat distanceBetweenPoints (CGPoint first, CGPoint second);
CGFloat angleBetweenPoints(CGPoint first, CGPoint second);
CGFloat angleBetweenLines(CGPoint line1Start, CGPoint line1End, CGPoint line2Start, CGPoint line2End);

CGFloat CGPointDot(CGPoint a, CGPoint b);
CGFloat CGPointLen(CGPoint a);
CGPoint CGPointSub(CGPoint a, CGPoint b);
CGFloat CGPointDist(CGPoint a, CGPoint b);
CGPoint CGPointNorm(CGPoint a);