Skip to content

A graphics simulation built in Turbo C++ using BGI, demonstrating the Cohen-Sutherland Line Clipping Algorithm with a horizontally moving bar. A ball bounces within a window and deflects upon hitting the clipped bar, visualizing basic 2D collision and clipping in real-time. Ideal for academic graphics projects and retro demos. Best run in Turbo C++

Notifications You must be signed in to change notification settings

Sumdiboii/cohen-sutherland-line-clipping-cpp-mini-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Typing SVG

Ball Logo


🏓 Infinite Ball Bounce Simulation 🏓

A never-ending, auto-animated bouncing ball with dynamic obstacle collision and line clipping logic.


🌐 View Portfolio




🚀 Project Overview

⚠️ Note: This project must be run on Turbo C++ using Borland Graphics Interface (BGI). Use Turbo C++ or an emulator like DOSBox for accurate execution.

This C++ graphics project features a ball endlessly bouncing within a rectangular window. A horizontally moving bar (obstacle) traverses the screen, and whenever the ball collides with it, it gets deflected.

What makes this simulation unique is that the bar is clipped using the Cohen-Sutherland Line Clipping Algorithm — a graphics classic — ensuring it’s only visible when inside the boundary box.

It’s a clean, continuous visual simulation — ideal for understanding clipping, bouncing logic, and retro animation techniques.



Gameplay Demo




🛠️ Tech Stack and Tools


Technology Purpose
C++ Game and animation logic
BGI (Borland Graphics Interface) Rendering graphics inside Turbo C++
Turbo C++ / DOSBox Environment required to run graphics code



🔍 Core Highlights

  • 🔁 Ball bounces infinitely within a rectangular window
  • 📏 Cohen-Sutherland Line Clipping algorithm applied to the obstacle (bar)
  • 🧱 Bar moves horizontally across the screen and is clipped at the window bounds
  • 💥 When ball and bar collide, the ball deflects dynamically
  • 🕹️ No game logic or scoring — pure animated simulation for visual learning



📚 Key Learning Outcomes

  • Understood and applied the Cohen-Sutherland algorithm in a live environment
  • Learned basic animation with graphics in Turbo C++
  • Implemented real-time collision detection
  • Practiced drawing and clipping graphical elements using legacy tools
  • Gained confidence in creating interactive 2D simulations in C++



👨‍💻 About the Creator

Sumdiboii – Retro Coder, Animation Wizard & Algorithm Addict 💻✨

LinkedIn – Sumedh Pimplikar


Sometimes, the best way to learn is to build something endless. This project isn't just code — it's a motion experiment in logic and legacy tech. 🚀

About

A graphics simulation built in Turbo C++ using BGI, demonstrating the Cohen-Sutherland Line Clipping Algorithm with a horizontally moving bar. A ball bounces within a window and deflects upon hitting the clipped bar, visualizing basic 2D collision and clipping in real-time. Ideal for academic graphics projects and retro demos. Best run in Turbo C++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages