Newer
Older
Import / applications / RocketMan / Source Code / PointF.cpp
@John John on 29 Dec 2020 689 bytes bulk import from macbookpro checkouts
/*
 *  PointF.cpp
 *  iphone-gl-app
 *
 *  Created by John Ryland on 16/06/09.
 *  Copyright 2009 InvertedLogic. All rights reserved.
 *
 */

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


PointF::PointF()
{
	x = 0.0;
	y = 0.0;
}


PointF::PointF(float _x, float _y)
{
	x = _x;
	y = _y;
}


void PointF::translate(float _x, float _y)
{
	x += _x;
	y += _y;
}


void PointF::translate(PointF t)
{
	x += t.x;
	y += t.y;
}


void PointF::rotate(float r)
{
	float s = ::sin(r);
	float c = ::cos(r);
	float ax = x;
	float ay = y;
	x = (ax * c) - (ay * s);
	y = (ax * s) + (ay * c);
}


void PointF::scale(float s)
{
	x *= s;
	y *= s;
}


void PointF::scale(float _x, float _y)
{
	x *= _x;
	y *= _y;
}