Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CEquilateralTriangle::Tick()
- {
- mBoundingRect.left += RandRange(-5,5);
- mBoundingRect.top += RandRange(-5,5);
- mBoundingRect.right += RandRange(-5,5);
- mBoundingRect.bottom += RandRange(-5,5);
- CorrectRect(&mBoundingRect);
- int width = mBoundingRect.right - mBoundingRect.left;
- int height = mBoundingRect.bottom - mBoundingRect.top;
- if(width > height) {
- mBoundingRect.top = mBoundingRect.bottom - ((width * sqrt(3.0)) / 2);
- }
- if(height > width) {
- width = (2 * height) / sqrt(3.0);
- mBoundingRect.left = mBoundingRect.right - width;
- mBoundingRect.right = mBoundingRect.left + width;
- }
- updateVertices();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement