Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using SplashKitSDK;

namespace DistantPointOnCircleExample
{
public class Program
{
public static void Main()
{
// Create the circle and window used to demonstrate the distant point
Circle demoCircle = SplashKit.CircleAt(400, 300, 120);
Window demoWindow = SplashKit.OpenWindow("Opposite Point to Mouse on Circle", 800, 600);

while (!SplashKit.QuitRequested())
{
SplashKit.ProcessEvents();

// Use the mouse position as the point being tested
Point2D testPoint = SplashKit.MousePosition();

// Find the point on the circle furthest from the mouse
Point2D distantPoint = SplashKit.DistantPointOnCircle(testPoint, demoCircle);

SplashKit.ClearScreen(Color.White);

// Draw the circle and helper lines to show the relationship clearly
SplashKit.DrawCircle(Color.Black, demoCircle);
SplashKit.DrawLine(Color.Gray, SplashKit.CenterPoint(demoCircle), testPoint);
SplashKit.DrawLine(Color.Green, SplashKit.CenterPoint(demoCircle), distantPoint);

// Highlight the mouse point and the distant point
SplashKit.FillCircle(Color.Red, testPoint.X, testPoint.Y, 6);
SplashKit.FillCircle(Color.Green, distantPoint.X, distantPoint.Y, 8);
SplashKit.FillCircle(Color.Blue, SplashKit.CenterPoint(demoCircle).X, SplashKit.CenterPoint(demoCircle).Y, 5);

// Display instructions and labels on the window
SplashKit.DrawText("Move the mouse to test from a new point", Color.Black, 20, 20);
SplashKit.DrawText("Red = test point", Color.Red, 20, 50);
SplashKit.DrawText("Green = distant point on circle", Color.Green, 20, 80);
SplashKit.DrawText("Blue = circle center", Color.Blue, 20, 110);

SplashKit.RefreshScreen(60);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using SplashKitSDK;
using static SplashKitSDK.SplashKit;

// Create the circle and window used to demonstrate the distant point
Circle demoCircle = CircleAt(400, 300, 120);
Window demoWindow = OpenWindow("Opposite Point to Mouse on Circle", 800, 600);

while (!QuitRequested())
{
ProcessEvents();

// Use the mouse position as the point being tested
Point2D testPoint = MousePosition();

// Find the point on the circle furthest from the mouse
Point2D distantPoint = DistantPointOnCircle(testPoint, demoCircle);

ClearScreen(ColorWhite());

// Draw the circle and helper lines to show the relationship clearly
DrawCircle(ColorBlack(), demoCircle);
DrawLine(ColorGray(), CenterPoint(demoCircle), testPoint);
DrawLine(ColorGreen(), CenterPoint(demoCircle), distantPoint);

// Highlight the mouse point and the distant point
FillCircle(ColorRed(), testPoint.X, testPoint.Y, 6);
FillCircle(ColorGreen(), distantPoint.X, distantPoint.Y, 8);
FillCircle(ColorBlue(), CenterPoint(demoCircle).X, CenterPoint(demoCircle).Y, 5);

// Display instructions and labels on the window
DrawText("Move the mouse to test from a new point", ColorBlack(), 20, 20);
DrawText("Red = test point", ColorRed(), 20, 50);
DrawText("Green = distant point on circle", ColorGreen(), 20, 80);
DrawText("Blue = circle center", ColorBlue(), 20, 110);

RefreshScreen(60);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "splashkit.h"

int main()
{
// Create the circle and window used to demonstrate the distant point
circle demo_circle = circle_at(400, 300, 120);
window demo_window = open_window("Opposite Point to Mouse on Circle", 800, 600);

while (!quit_requested())
{
process_events();
// Use the mouse position as the point being tested
point_2d test_point = mouse_position();

// Find the point on the circle furthest from the mouse
point_2d distant_point = distant_point_on_circle(test_point, demo_circle);

// Centre point of the circle
point_2d circle_center = center_point(demo_circle);

clear_screen(COLOR_WHITE);

// Draw the circle and helper lines to show the relationship clearly
draw_circle(COLOR_BLACK, demo_circle);
draw_line(COLOR_GRAY, circle_center, test_point);
draw_line(COLOR_GREEN, circle_center, distant_point);

// Highlight the important points in the example
fill_circle(COLOR_RED, test_point.x, test_point.y, 6);
fill_circle(COLOR_GREEN, distant_point.x, distant_point.y, 8);
fill_circle(COLOR_BLUE, circle_center.x, circle_center.y, 5);

// Display labels on the window for beginner-friendly guidance
draw_text("Move the mouse to change the test point", COLOR_BLACK, 20, 20);
draw_text("Red = test point", COLOR_RED, 20, 50);
draw_text("Green = distant point on circle", COLOR_GREEN, 20, 80);
draw_text("Blue = circle center", COLOR_BLUE, 20, 110);

refresh_screen(60);
}

return 0;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from splashkit import *

open_window("Opposite Point to Mouse on Circle", 800, 600)

# Circle setup
circle_centre = point_at(400, 300)
radius = 120
demo_circle = circle_at(circle_centre, radius)

while not quit_requested():
process_events()

# Mouse as test point
test_point = mouse_position()

# Calculate distant point
distant_point = distant_point_on_circle(test_point, demo_circle)

clear_screen(color_white())

# Draw main circle
draw_circle(color_black(), circle_centre.x, circle_centre.y, radius)

# Draw lines (FIXED)
draw_line(color_gray(),
circle_centre.x, circle_centre.y,
test_point.x, test_point.y)

draw_line(color_green(),
circle_centre.x, circle_centre.y,
distant_point.x, distant_point.y)

# Draw points
fill_circle(color_red(), test_point.x, test_point.y, 6)
fill_circle(color_green(), distant_point.x, distant_point.y, 8)
fill_circle(color_blue(), circle_centre.x, circle_centre.y, 5)

# Labels
draw_text_no_font_no_size("Move the mouse to change the test point", color_black(), 20, 20)
draw_text_no_font_no_size("Red = test point", color_red(), 20, 50)
draw_text_no_font_no_size("Green = distant point on circle", color_green(), 20, 80)
draw_text_no_font_no_size("Blue = circle centre", color_blue(), 20, 110)

refresh_screen()

close_all_windows()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Opposite Point to Mouse on Circle