Untitled
By: a guest | Mar 19th, 2010 | Syntax:
C++ | Size: 0.78 KB | Hits: 52 | Expires: Never
/*
* dim2f.cpp
*
* Created on: Mar 11, 2010
* Author: dbaranov
*/
#include "square.h"
Dim2F::Dim2F() {
init(0, 0);
}
Dim2F::Dim2F(float _x, float _y) {
init(_x, _y);
}
void Dim2F::init(float _x, float _y) {
x = _x;
y = _y;
}
Dim2F *Dim2F::sum(float _x, float _y) {
x += _x;
y += _y;
return this;
}
Dim2F *Dim2F::sum(Dim2F *arg) {
return sum(arg->x, arg->y);
}
Dim2F *Dim2F::set(float _x, float _y) {
x = _x;
y = _y;
return this;
}
Dim2F *Dim2F::set(Dim2F *arg) {
return set(arg->x, arg->y);
}
bool Dim2F::isPointInside(float w, float h, float _x, float _y){
return _x>x && _y>y && _x<x+w && _y<y+h;
}
bool Dim2F::isPointInside(Dim2F* area, Dim2F* coord){
return isPointInside(area->x, area->y, coord->x, coord->y);
}