#include "llrect.h" int main() { LLVector2 upperLeft(0, 0); LLVector2 bottomRight(10, 10); LLRect rect(upperLeft, bottomRight); return 0; }
#include "llrect.h" int main() { LLVector2 upperLeft(0, 0); LLVector2 bottomRight(10, 10); LLRect rect(upperLeft, bottomRight); LLVector2 point(5, 5); if (rect.containsPoint(point)) { std::cout << "Point is inside rectangle" << std::endl; } else { std::cout << "Point is outside rectangle" << std::endl; } return 0; }
#include "llrect.h" int main() { LLVector2 rect1UpperLeft(0, 0); LLVector2 rect1BottomRight(10, 10); LLRect rect1(rect1UpperLeft, rect1BottomRight); LLVector2 rect2UpperLeft(5, 5); LLVector2 rect2BottomRight(15, 15); LLRect rect2(rect2UpperLeft, rect2BottomRight); if (rect1.intersects(rect2)) { std::cout << "Rectangles intersect" << std::endl; } else { std::cout << "Rectangles do not intersect" << std::endl; } return 0; }The LLRect class is part of the Second Life Viewer library (libsecondlife) which is a C++ library used by the Second Life Viewer application.