linesegment_relationship

command
v0.0.0-...-d209436 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

Geom2D Demo: Line Segment Relationships

This demo showcases the capabilities of the Geom2D library by visualizing relationships between a mouse-controlled line segment and various geometric shapes (point, line segment, rectangle, circle, and polygon) in real-time.

Red line segment representing the mouse cursor moves around and over various geometries.

How to Use

  1. Mouse Cursor:

    • The mouse cursor is represented by a red line segment on the screen.
    • For visibility, the mouse's position is also displayed in the bottom-left corner.
  2. Real-Time Relationships:

    • The relationships between the mouse line segment and each geometric object are calculated in real time, at 60 ticks per second. This highlights the library's performance in dynamic scenarios.
  3. Real-Time Rendering:

    • The geometries are redrawn every frame, running at 60 frames per second. This highlights the efficiency of the library for real-time rendering.
  4. Resizable Window:

    • For high-resolution displays, you can resize the application window to make the pixels larger and improve visibility.

Key Features Demonstrated

  • Real-time calculation and visualization of geometric relationships.
  • Dynamic rendering of various geometric objects, including:
    • Single points.
    • Line segments using Bresenham's line algorithm.
    • Rectangles and their edges.
    • Circles using Bresenham's circle algorithm.
    • Polygons and holes using PolyTree.

System Requirements

  • Go version 1.23 or newer.
  • This demo uses Ebitengine, a fantastic game library for Go, check it out!
  • The window is set to an initial size of 700x500 but can be resized.

Running the Demo

You should be able to run the demo directly from GitHub with the command:

go run github.com/mikenye/geom2d/demos/linesegment_relationship@latest

If this doesn't work:

  1. Clone the repository:

    git clone https://github.com/mikenye/geom2d
    cd geom2d/demos/linesegment_relationship
    
  2. Install dependencies:

    go mod tidy
    
  3. Run the demo:

    go run .
    

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL