-
Notifications
You must be signed in to change notification settings - Fork 33
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
base: usage-examples
Are you sure you want to change the base?
Circle intersect #335
Conversation
…-jinx/splashkit.io-starlight into draw-circle-on-window
✅ Deploy Preview for splashkit-usage-examples ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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!"); |
There was a problem hiding this comment.
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!"); |
There was a problem hiding this comment.
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!");
Fixed thanks |
There was a problem hiding this 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.
There was a problem hiding this 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!
All problem fixed, but I feel draw circle is better to show the two circles intersection. |
Overview
New usage example to show how to detect if two circle A and B intersect or not.
Splashkit Function:
circles_intersect
Files Included
Usage Example Checks