/*
* PointArray.cpp
* iphone-gl-app
*
* Created by John Ryland on 16/06/09.
* Copyright 2009 InvertedLogic. All rights reserved.
*
*/
#include "Debug.h"
#include <math.h>
#include "PointArray.h"
PointArray::PointArray() : List<PointF>()
{
}
PointArray::PointArray(int size)
{
for (int i = 0; i < size; i++)
(*this) += PointF(0,0);
}
PointArray::~PointArray()
{
}
void PointArray::translate(float x, float y)
{
foreach (PointF &item, (*this))
item.translate(x, y);
}
void PointArray::rotate(float r)
{
float s = ::sin(r);
float c = ::cos(r);
foreach (PointF &item, (*this))
// A nieve implementation of "item.rotate(r);" would recalculate sin and cos every point
item = PointF(item.x * c - item.y * s, item.x * s + item.y * c);
}
void PointArray::scale(float x, float y)
{
foreach (PointF &item, (*this))
item.scale(x, y);
}