Skip to content

Add widest_points usage example#728

Open
ekam313 wants to merge 1 commit intothoth-tech:mainfrom
ekam313:doc/usage-example-widest-points
Open

Add widest_points usage example#728
ekam313 wants to merge 1 commit intothoth-tech:mainfrom
ekam313:doc/usage-example-widest-points

Conversation

@ekam313
Copy link
Copy Markdown

@ekam313 ekam313 commented Apr 11, 2026

Description

This pull request adds a new usage example for the SplashKit function widest_points. The example demonstrates how to calculate the two points on a circle that lie along a given vector. A circle is displayed in the window, and the mouse position is used to define a direction vector from the center of the circle. As the mouse moves, the two widest points are recalculated in real time and displayed visually on the circle. A GIF is included to clearly show how the function behaves interactively.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Documentation (update or new)

How Has This Been Tested?

The example was tested locally across all supported languages (C++, C# Top-Level, C# OOP, and Python). Each version was executed to confirm that the window opens correctly, the circle and vector are displayed, and the two widest points update dynamically as the mouse moves. The Python version was adjusted to match the local SplashKit binding requirements. The project was also built successfully using npm run build and previewed using npm run preview.

Testing Checklist

  • Tested in latest Chrome
  • Tested in latest Firefox
  • npm run build
  • npm run preview

Checklist

If involving code

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Folders and Files Added/Modified

  • Added:
    • public/usage-examples/geometry/widest_points-1-example.py
    • public/usage-examples/geometry/widest_points-1-example.cpp
    • public/usage-examples/geometry/widest_points-1-example-top-level.cs
    • public/usage-examples/geometry/widest_points-1-example-oop.cs
    • public/usage-examples/geometry/widest_points-1-example.gif
    • public/usage-examples/geometry/widest_points-1-example.txt

Additional Notes

All implementations are consistent across C++, C#, and Python, following the SplashKit usage example style guidelines. The example is designed to be simple, visual, and beginner-friendly. The included GIF demonstrates the vector direction changing and the widest points updating dynamically, clearly illustrating the purpose of the widest_points function.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 11, 2026

Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit 528d170
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/69da9d28d02fc400089a9463

Copy link
Copy Markdown

@Osaid2993 Osaid2993 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, happy to approve. The usage example is solid, files are in the right place, naming checks out, and the example does a nice job showing how widest_points works without overcomplicating it. The GIF is a helpful touch too.

One small thing for the Python version: worth swapping refresh_screen() for refresh_screen_with_target_fps(60) to keep it consistent with the others.

@jasveena15
Copy link
Copy Markdown

Second Peer Review

This is a well-designed and interactive usage example that clearly demonstrates the purpose and behaviour of the widest_points function. Using the mouse position to dynamically define the vector makes the concept intuitive and visually engaging for beginners.

What works well

The example effectively demonstrates a single function in a clear and focused way.
The use of a dynamic vector (mouse position) provides strong visual feedback and helps users understand how the widest points change in real time.
Code structure and logic are consistent across C++, C#, and Python implementations.
The visual elements (circle, vector line, and highlighted points) are well chosen and make the output easy to interpret.
The window title and on-screen text clearly communicate what the example is demonstrating.
The included GIF is particularly helpful in reinforcing the behaviour of the function.

Overall

This is a clean, interactive, and beginner-friendly example that aligns well with the SplashKit usage example guidelines and style expectations. The implementation is consistent and visually effective.

Approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants