project_files/HedgewarsMobile/Classes/CGPointUtils.h
author antonc27 <antonc27@mail.ru>
Sat, 17 Mar 2018 22:37:13 +0100
branchios-develop
changeset 13241 fc98ea64e0ef
parent 10108 c68cf030eded
permissions -rw-r--r--
- Migrate AppIcons to xcassets - Use universal launch screen instead of bunch of images
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     1
/*
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4476
diff changeset
     2
 * Hedgewars-iOS, a Hedgewars port for iOS devices
6700
e04da46ee43c the most important commit of the year
koda
parents: 6666
diff changeset
     3
 * Copyright (c) 2009-2012 Vittorio Giovara <vittorio.giovara@gmail.com>
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4476
diff changeset
     4
 *
088d40d8aba2 Happy 2011 :)
koda
parents: 4476
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
088d40d8aba2 Happy 2011 :)
koda
parents: 4476
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
088d40d8aba2 Happy 2011 :)
koda
parents: 4476
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     8
 *
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4476
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
088d40d8aba2 Happy 2011 :)
koda
parents: 4476
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
088d40d8aba2 Happy 2011 :)
koda
parents: 4476
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
088d40d8aba2 Happy 2011 :)
koda
parents: 4476
diff changeset
    12
 * GNU General Public License for more details.
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    13
 *
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4476
diff changeset
    14
 * You should have received a copy of the GNU General Public License
088d40d8aba2 Happy 2011 :)
koda
parents: 4476
diff changeset
    15
 * along with this program; if not, write to the Free Software
10108
c68cf030eded update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents: 6908
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    17
 */
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    18
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4476
diff changeset
    19
6908
896ed2afcfb8 ios: turn on more warning messages and start correcting them
koda
parents: 6832
diff changeset
    20
#include <CoreGraphics/CoreGraphics.h>
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    21
6832
fae8fd118da9 dates are no more!
koda
parents: 6700
diff changeset
    22
3680
aaf832c6fbd7 fix panning when zoomed (finally)
koda
parents: 3551
diff changeset
    23
#define degreesToRadians(x) ( M_PI * x / 180.0)
aaf832c6fbd7 fix panning when zoomed (finally)
koda
parents: 3551
diff changeset
    24
#define radiansToDegrees(x) (180.0 * x / M_PI )
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    25
6666
0e2f5b81cbf2 fix coordinate system on ios overlay
koda
parents: 4976
diff changeset
    26
#define HWX(x) (int)(x-screen.size.width/2)/HW_zoomFactor()
0e2f5b81cbf2 fix coordinate system on ios overlay
koda
parents: 4976
diff changeset
    27
#define HWY(x) (int)(screen.size.height-x)/HW_zoomFactor()+(IS_IPAD()?40:17.5)*HW_zoomLevel()/HW_zoomFactor()
3680
aaf832c6fbd7 fix panning when zoomed (finally)
koda
parents: 3551
diff changeset
    28
6666
0e2f5b81cbf2 fix coordinate system on ios overlay
koda
parents: 4976
diff changeset
    29
#define HWXZ(x) (int)(x-screen.size.width/2)
0e2f5b81cbf2 fix coordinate system on ios overlay
koda
parents: 4976
diff changeset
    30
#define HWYZ(x) (int)(screen.size.height-x)
3551
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3547
diff changeset
    31
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    32
CGFloat distanceBetweenPoints (CGPoint first, CGPoint second);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    33
CGFloat angleBetweenPoints(CGPoint first, CGPoint second);
3680
aaf832c6fbd7 fix panning when zoomed (finally)
koda
parents: 3551
diff changeset
    34
CGFloat angleBetweenLines(CGPoint line1Start, CGPoint line1End, CGPoint line2Start, CGPoint line2End);
4476
4bf74e158f44 team selection completely refactored, now has animation and more performance
koda
parents: 3996
diff changeset
    35
4bf74e158f44 team selection completely refactored, now has animation and more performance
koda
parents: 3996
diff changeset
    36
CGFloat CGPointDot(CGPoint a, CGPoint b);
4bf74e158f44 team selection completely refactored, now has animation and more performance
koda
parents: 3996
diff changeset
    37
CGFloat CGPointLen(CGPoint a);
4bf74e158f44 team selection completely refactored, now has animation and more performance
koda
parents: 3996
diff changeset
    38
CGPoint CGPointSub(CGPoint a, CGPoint b);
4bf74e158f44 team selection completely refactored, now has animation and more performance
koda
parents: 3996
diff changeset
    39
CGFloat CGPointDist(CGPoint a, CGPoint b);
4bf74e158f44 team selection completely refactored, now has animation and more performance
koda
parents: 3996
diff changeset
    40
CGPoint CGPointNorm(CGPoint a);