summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/private/CGPoint_Util.m
blob: 6e607d34329ce1654ac26a42cebbb31873481d66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//
//  CGPoint_Util.c
//  SmartDeviceLink-iOS
//
//  Created by Muller, Alexander (A.) on 6/14/16.
//  Copyright © 2016 smartdevicelink. All rights reserved.
//

#include "CGPoint_Util.h"
#include <math.h>

CGPoint CGPointCenterOfPoints(CGPoint point1, CGPoint point2) {
    CGFloat xCenter = (point1.x + point2.x) / 2.0f;
    CGFloat yCenter = (point1.y + point2.y) / 2.0f;
    return CGPointMake(xCenter, yCenter);
}

CGFloat CGPointDistanceBetweenPoints(CGPoint point1, CGPoint point2) {
    return hypot(point1.x - point2.x, point1.y - point2.y);
}