mirror of
https://github.com/ksherlock/TwoTerm.git
synced 2026-01-23 11:16:26 +00:00
moving things around
git-svn-id: svn://qnap.local/TwoTerm/trunk@1986 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
33
cpp/iGeometry.cpp
Normal file
33
cpp/iGeometry.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* iGeometry.cpp
|
||||
* 2Term
|
||||
*
|
||||
* Created by Kelvin Sherlock on 7/10/2010.
|
||||
* Copyright 2010 __MyCompanyName__. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "iGeometry.h"
|
||||
|
||||
|
||||
bool iRect::contains(const iPoint aPoint) const
|
||||
{
|
||||
return aPoint.x >= origin.x
|
||||
&& aPoint.y >= origin.y
|
||||
&& aPoint.x <= origin.x + size.width
|
||||
&& aPoint.y <= origin.y + size.height;
|
||||
}
|
||||
|
||||
bool iRect::contains(const iRect aRect) const
|
||||
{
|
||||
return aRect.origin.x >= origin.x
|
||||
&& aRect.origin.y >= origin.y
|
||||
&& aRect.origin.x + aRect.size.width <= origin.x + size.width
|
||||
&& aRect.origin.y + aRect.size.height <= origin.y + size.height;
|
||||
}
|
||||
|
||||
bool iRect::intersects(const iRect aRect) const
|
||||
{
|
||||
return aRect.contains(origin) || aRect.contains(origin.offset(size));
|
||||
}
|
||||
Reference in New Issue
Block a user