Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circle intersect #335

Open
wants to merge 21 commits into
base: usage-examples
Choose a base branch
from

Conversation

Jinx-means-jinx
Copy link

@Jinx-means-jinx Jinx-means-jinx commented Dec 8, 2024

Overview

New usage example to show how to detect if two circle A and B intersect or not.

Splashkit Function: circles_intersect
image
image
image

Files Included

  • Title and explanation (.txt)
  • C++ code
  • C# code (top-level statements)
  • C# code (Object-Oriented Programming)
  • Python code
  • Screenshot

Usage Example Checks

  • Simple, clear demonstration of the function
  • Code uses Splashkit functions
  • Tested in Chrome and Firefox

Copy link

netlify bot commented Dec 8, 2024

Deploy Preview for splashkit-usage-examples ready!

Name Link
🔨 Latest commit 8df8874
🔍 Latest deploy log https://app.netlify.com/sites/splashkit-usage-examples/deploys/67835e6f51aaf00008480096
😎 Deploy Preview https://deploy-preview-335--splashkit-usage-examples.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@SimonRhook SimonRhook left a comment

Choose a reason for hiding this comment

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

I've left some comments across the files requesting some small changes for code comments and just some wording updates for clarity. The comments I have left on the top level file for language update should be applied across all files.

Overall the program does a good job of demonstrating the circle_intersect function and I like that the users have to make their own circles.

Once you have made these changes I'm happy to approve this PR

else:
write_line("Circle Not Intersect")

#Create a window

Choose a reason for hiding this comment

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

Your code comments are inconsistent in the sense that some have a space at the start and some don't.
I recommend quickly going back across your code and adding the spaces at the start of each line for clarity

Choose a reason for hiding this comment

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

The window title in your screen shot does not match the code. Currently shows PointAt rather than Circle Intersect

@@ -0,0 +1,55 @@
using SplashKitSDK;

namespace CircleIntersect

Choose a reason for hiding this comment

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

add example to the end of the namespace "CircleIntersectExample"

R_A = convert_to_integer(read_line())

# Create circle A base on the data
A = circle_at(point_at(X_A, Y_A), R_A)

Choose a reason for hiding this comment

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

you could use circle_at_from_points here to match the overloaded functions used in the other files and not have to use point_at here.

WriteLine("Radient for circle A: ");
int R_A = ConvertToInteger(ReadLine());

//Create circle A base on the data

Choose a reason for hiding this comment

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

should say "Create circle A based on the user's data"

WriteLine("Radient for circle B: ");
int R_B = ConvertToInteger(ReadLine());

//Create circle B base on the data

Choose a reason for hiding this comment

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

// Create circle B based on the user's data

OpenWindow("Point At", 800, 600);
ClearScreen();

//Draw the circle base on the data give by user

Choose a reason for hiding this comment

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

// Draw the circles based on the data given by user

//Create circle B base on the data
Circle B = CircleAt(X_B, Y_B, R_B);

//Detect if the circle intersect or not

Choose a reason for hiding this comment

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

// Detect if the circles intersect

//Detect if the circle intersect or not
if (CirclesIntersect(A, B))
{
WriteLine("Circle Intersect!");

Choose a reason for hiding this comment

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

WriteLine("The circles intersect!")

}
else
{
WriteLine("Circle Not Intersect!");

Choose a reason for hiding this comment

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

WriteLine("The circles do not intersect!");

@Jinx-means-jinx
Copy link
Author

Fixed thanks

Copy link

@SimonRhook SimonRhook left a comment

Choose a reason for hiding this comment

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

Nice work, with the update per my recommendations I approve this PR.

  • All required files are present.
    • Title and explanation (.txt)
    • C++ code
    • C# code (top-level statements)
    • C# code (Object-Oriented Programming)
    • Python code
  • Code correctly uses Splashkit functions.
  • Code clearly demonstrates the function.
  • All versions maintain the same structure and comments.
  • C++ code ran correctly.
  • C# top level code ran correctly.
  • C# OOP code ran correctly.
  • Python code ran correctly.

Copy link

@ShaunR1991 ShaunR1991 left a comment

Choose a reason for hiding this comment

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

A great idea for a program. Functionally the code works as expected, however two things to update:

Change the spelling of "Radient" to "Radius"
Recommend changing the colour of one of the circles to a different colour, say one red and one blue. This will help to differentiate between the two objects on the screen, since you only get 4 seconds of window time to determine the overlap.
Lastly, I would recommend perhaps using a fill_circle method rather than draw_circle to really demonstrate the overlap.

Otherwise, good usage example!

@Jinx-means-jinx
Copy link
Author

All problem fixed, but I feel draw circle is better to show the two circles intersection.

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.

4 participants