Welcome to the Table Lamp project, developed at Palestine Polytechnic University. This project provides a versatile rendering widget implemented in C++ using the Qt framework and is built using CMake. The widget is designed to facilitate the drawing of various geometric shapes, including lines, circles, ellipses, and arcs. Using these basic shapes I used them to draw a simple Lamp.
Whether you're a student exploring computer graphics or a developer seeking a lightweight graphics rendering tool, RenderWidget aims to meet your needs and goals. 🎯🔥
-
Drawing Lines 📈
The Render Widget supports two efficient functions for drawing lines - the Bresenham algorithm (draw Line) implementing in two ways , providing flexibility in line rendering. -
Drawing Circles ⚪️
Efficiently draw circles using the incremental method. -
Drawing Arcs 🌈
Specify the center, start angle, end angle, and radius to draw precise arcs using the drawArc method. -
Drawing Ellipses 🥚
Create ellipses by specifying the center and major and minor axes with the drawEllipse method. -
Clipping Lines 📏
Added functionality for clipping lines using the Cohen-Sutherland algorithm -
Filling Convex Polygons 🎨🖌
Filling convex and H-convex polygons using scanline filling technique.
The following picture show the table lamp that we draw using the simple functionality provided above.
![](https://private-user-images.githubusercontent.com/127017088/317653206-7da39e92-afcf-4da3-a87e-d39789a68c8f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2MDUyOTgsIm5iZiI6MTcyNDYwNDk5OCwicGF0aCI6Ii8xMjcwMTcwODgvMzE3NjUzMjA2LTdkYTM5ZTkyLWFmY2YtNGRhMy1hODdlLWQzOTc4OWE2OGM4Zi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyNVQxNjU2MzhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yNGNkNTI1NmE5Nzc1NzEzY2M0ZjNjMWNmMmNhNWE4ODZiNGY3MjlhMTU2MWU1NDNlZTJmOGZhMTJlNGRjZjM2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.8n80uKrWWpm1dSSmkshyrt2kJjg1jExQmhtLX2HLpSo)
The following picture show the car that we draw using the simple functionality provided above.
![](https://private-user-images.githubusercontent.com/127017088/317653278-40b5448a-5dea-4e94-a95e-ff7a7b838f61.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2MDUyOTgsIm5iZiI6MTcyNDYwNDk5OCwicGF0aCI6Ii8xMjcwMTcwODgvMzE3NjUzMjc4LTQwYjU0NDhhLTVkZWEtNGU5NC1hOTVlLWZmN2E3YjgzOGY2MS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyNVQxNjU2MzhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zNGVhMGZiN2Q2NWQ1YTFjNDkxNTUwMmUxOWM5NmYyZDdjOWViYjMyOWFlYWJlODM3N2UyMjNiNWY5MjE4YzE0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.lrM87e-K1UJCcwjaI8IU15kMrdKaIQn8KOApCcS417g)
Dimensions of the level in which the drawing is made are like this:
![](https://private-user-images.githubusercontent.com/127017088/317653389-6f8a4838-76ec-4501-b011-146ef2787188.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2MDUyOTgsIm5iZiI6MTcyNDYwNDk5OCwicGF0aCI6Ii8xMjcwMTcwODgvMzE3NjUzMzg5LTZmOGE0ODM4LTc2ZWMtNDUwMS1iMDExLTE0NmVmMjc4NzE4OC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyNVQxNjU2MzhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jNWY4ZTNkMDk2YWI0ZWQ2YmI4YmZkZjEzOTEwODgyMTVkYzY3YzliOGVhMDA0YTJjMmZiODg1ZDEzZTZiZDc5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.LLEwl1IIMIzIxBh04w2LAcPqj1cBmbInxEqk4lCKf-o)
But if you want to use this dimension ⬇️ you can call the functinn mapPoint(x,y) to map it to the original dimension
![](https://private-user-images.githubusercontent.com/127017088/317653557-e0e124c1-fd53-4450-a904-a0bc15906a5b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2MDUyOTgsIm5iZiI6MTcyNDYwNDk5OCwicGF0aCI6Ii8xMjcwMTcwODgvMzE3NjUzNTU3LWUwZTEyNGMxLWZkNTMtNDQ1MC1hOTA0LWEwYmMxNTkwNmE1Yi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyNVQxNjU2MzhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yZmUwNzQyOTBmZDE2OGYzZDA3MGM1N2M5MjI5ZmFjOTQ1Njg0NmI3ZGY5NzY0ZmNiYjg5MjU3YTI5NjJiNjU2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.fbT17EMAJvIWw4eyf0e0Nvo6WI565bEV7V8IJWwl3-c)