Skip to content
rayapatiranjithaiPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

RGebRa - Advanced Dynamic Geometry Software

A powerful, web-based dynamic geometry application inspired by GeoGebra, built with modern web technologies. RGebRa provides 68+ interactive geometric tools for creating, manipulating, and exploring mathematical constructions.

Version License React TypeScript


🎯 Features

  • 68+ Interactive Tools - Complete geometric construction toolkit
  • Dynamic Geometry - Objects update in real-time as you drag them
  • Professional UI - GeoGebra-style toolbar with organized dropdown menus
  • Advanced Mathematics - Triangle centers, conics, transformations, measurements
  • Command Line Interface - Type commands for quick object creation
  • Export/Import - Save and load your constructions
  • Responsive Canvas - Smooth pan and zoom capabilities

πŸ—οΈ Technology Stack

Frontend Framework

  • React 18.3.1 - Component-based UI architecture
  • TypeScript 5.6.2 - Type-safe development
  • Vite 5.4.10 - Fast build tool and dev server

Core Libraries

  • JSXGraph 1.10.1 - Geometric rendering engine
  • Zustand 5.0.1 - Lightweight state management
  • Nerdamer 1.1.7 - Symbolic mathematics engine
  • Lucide React - Modern icon library

Styling

  • TailwindCSS 3.4.14 - Utility-first CSS framework
  • PostCSS - CSS transformations

Development Tools

  • ESLint - Code linting
  • TypeScript ESLint - TypeScript-specific linting
  • Vite Plugin React - React Fast Refresh support

πŸ“‹ Table of Contents

  1. Installation
  2. Building the Application
  3. Application Architecture
  4. Tool Categories
  5. How to Use Tools
  6. Command Line Usage
  7. Development Guide
  8. Testing

πŸš€ Installation

Prerequisites

  • Node.js 18.x or higher
  • npm 9.x or higher

Steps

# Clone the repository
git clone https://github.com/rayapatirai/RGebRa.git

# Navigate to project directory
cd RGebRa

# Install dependencies
npm install

πŸ”¨ Building the Application

Development Mode

# Start development server with hot reload
npm run dev

# Application will be available at:
# http://localhost:5173

Production Build

Option 1: Full Build (with TypeScript checking)

# Run TypeScript compiler + build
npm run build

# Note: This may show TypeScript warnings from JSXGraph library
# These are cosmetic and don't affect functionality

Option 2: Production Build (skip TypeScript checking) - RECOMMENDED

# Fast production build without type checking
npm run build:prod

# Build completes in ~3 seconds
# Output: ./dist directory with optimized files

Build Output

dist/
β”œβ”€β”€ index.html           # Entry HTML file
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ index-[hash].js  # Minified JavaScript bundle
β”‚   β”œβ”€β”€ index-[hash].css # Optimized CSS
β”‚   └── [images/fonts]   # Static assets
└── favicon.ico          # Favicon

Preview Production Build

# Preview production build locally
npm run preview

# Opens at http://localhost:4173
# Test the production build before deployment

Deployment

Deploy to Vercel

# Install Vercel CLI (one time)
npm i -g vercel

# Deploy to production
vercel --prod

# Or use Vercel's web interface:
# 1. Push to GitHub
# 2. Import project on vercel.com
# 3. Deploy automatically

Deploy to Netlify

# Option 1: Drag & Drop
# 1. Build: npm run build:prod
# 2. Drag dist/ folder to netlify.com

# Option 2: Netlify CLI
npm i -g netlify-cli
netlify deploy --prod --dir=dist

Deploy to GitHub Pages

# Build first
npm run build:prod

# Deploy to gh-pages branch
git subtree push --prefix dist origin gh-pages

# Or use gh-pages package:
npm i -g gh-pages
gh-pages -d dist

Deploy to Any Web Server

# 1. Build
npm run build:prod

# 2. Upload dist/ folder to your server
# Example with SCP:
scp -r dist/* user@server:/var/www/html/

# 3. Configure server to serve index.html
# Make sure server redirects all routes to index.html

Build Configuration

Why build:prod?

  • Skips TypeScript type checking for faster builds
  • TypeScript warnings are from JSXGraph's dynamic typing
  • All code is syntactically correct and fully functional
  • Reduces build time from ~30s to ~3s

When to use each command:

  • npm run dev - Development with hot reload
  • npm run build:prod - Production deployment (recommended)
  • npm run build - Full build with type checking (CI/CD)
  • npm run preview - Test production build locally

Linting

# Run ESLint to check code quality
npm run lint

πŸ›οΈ Application Architecture

Directory Structure

RGebRa/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/        # React components
β”‚   β”‚   β”œβ”€β”€ Canvas.tsx     # Main drawing canvas (JSXGraph integration)
β”‚   β”‚   β”œβ”€β”€ Toolbar.tsx    # Tool selection interface
β”‚   β”‚   β”œβ”€β”€ Sidebar.tsx    # Object list and properties
β”‚   β”‚   └── CommandLine.tsx# Command input interface
β”‚   β”œβ”€β”€ store/             # State management
β”‚   β”‚   └── useStore.ts    # Zustand store
β”‚   β”œβ”€β”€ types/             # TypeScript definitions
β”‚   β”‚   └── index.ts       # Tool types and interfaces
β”‚   β”œβ”€β”€ App.tsx            # Root component
β”‚   β”œβ”€β”€ main.tsx          # Application entry point
β”‚   └── index.css         # Global styles
β”œβ”€β”€ public/               # Static assets
β”œβ”€β”€ dist/                 # Production build output
└── package.json          # Project configuration

Data Flow

graph TD
    A[User Interaction] --> B{Toolbar Click}
    B --> C[Zustand Store]
    C --> D[Canvas Component]
    D --> E[JSXGraph Board]
    E --> F[Event Handlers]
    F --> G[Object Creation]
    G --> C
    C --> H[Sidebar Update]
    
    I[Command Line] --> J[Parser]
    J --> C
Loading

Component Hierarchy

App
β”œβ”€β”€ Toolbar (Tool Selection)
β”œβ”€β”€ Canvas (Drawing Area)
β”‚   └── JSXGraph Board
β”œβ”€β”€ Sidebar (Object List)
└── CommandLine (Text Input)

State Management

Zustand Store Structure:

{
  tool: ToolType,              // Currently selected tool
  objects: GeometricObject[],  // All created objects
  selection: string[],         // Selected object IDs
  setTool: (tool) => void,     // Update active tool
  addObject: (obj) => void,    // Add new object
  updateObject: (id, data) => void,
  deleteObject: (id) => void
}

πŸ› οΈ Tool Categories

1. Basic Tools (5 tools)

  • πŸ–±οΈ MOVE - Select and move objects
  • βœ‹ PAN - Pan the canvas view
  • β­• POINT - Create points
  • βž– LINE - Create lines
  • πŸ”Ί POLYGON - Create polygons

2. Point Construction (14 tools)

  • ✨ MIDPOINT - Midpoint between two points
  • πŸ’Ž GLIDER - Point constrained to object
  • ❌ INTERSECT - Find intersection points
  • πŸ”€ OTHER_INTERSECTION - All intersection points
  • 🎯 POINT_ON_OBJECT - Point on line/circle/curve
  • β­• CIRCUMCENTER - Triangle circumcenter
  • ❀️ INCENTER - Triangle incenter
  • βž• ORTHOCENTER - Triangle orthocenter
  • 🎯 CENTROID - Triangle centroid

3. Line Construction (10 tools)

  • βž– SEGMENT - Line segment
  • ↗️ RAY - Ray (half-line)
  • ➑️ VECTOR - Directed line segment
  • βœ‚οΈ PERPENDICULAR_BISECTOR - Perpendicular bisector
  • 🌿 ANGLE_BISECTOR - Angle bisector
  • βŠ₯ PERPENDICULAR_LINE - Perpendicular through point
  • βŠ₯ PERPENDICULAR_POINT - Foot of perpendicular
  • βˆ₯ PARALLEL_LINE - Parallel through point
  • βˆ₯ PARALLEL_POINT - Point on parallel line
  • πŸ“ TANGENT - Tangent to circle

4. Circle & Conic Tools (12 tools)

  • β­• CIRCLE - Circle by center and radius
  • β­• CIRCLE_3_POINTS - Circle through 3 points
  • 🧭 COMPASS - Circle by radius
  • πŸŒ™ SEMICIRCLE - Semicircle
  • πŸŒ€ ARC - Circular arc
  • πŸŒ€ ARC_3_POINTS - Arc through 3 points
  • πŸŒ€ CIRCUMCIRCLE_ARC - Arc of circumcircle
  • πŸ“Š SECTOR - Circular sector
  • πŸ“Š CIRCUMCIRCLE_SECTOR - Sector of circumcircle
  • ⬑ CONIC - Conic section (5 points)
  • 🌴 POLAR_LINE - Polar line w.r.t. conic
  • 🌴 POLE_POINT - Pole of line w.r.t. conic

5. Measurement Tools (6 tools)

  • πŸ“ DISTANCE - Distance between points
  • πŸ“ LENGTH - Length of segment
  • πŸ“ ANGLE_SIZE - Measure angle
  • πŸ“Š AREA - Calculate area
  • πŸ“ PERIMETER - Calculate perimeter
  • πŸ“ˆ SLOPE - Slope of line

6. Transformation Tools (5 tools)

  • πŸ”„ REFLECT_LINE - Reflect across line
  • πŸ”„ ROTATE_ANGLE - Rotate by angle
  • ➑️ TRANSLATE_VECTOR - Translate by vector
  • πŸ” DILATE_POINT - Dilate from center
  • πŸ“¦ RADICAL_AXIS - Radical axis of circles

7. Advanced Construction (6 tools)

  • πŸ”· REGULAR_POLYGON - Regular n-sided polygon
  • πŸ“Š SLIDER - Interactive parameter slider
  • πŸ–ΌοΈ IMAGE - Insert image
  • πŸ“ TEXT - Add text labels
  • ✏️ PEN - Freehand drawing
  • πŸ—‘οΈ DELETE - Delete objects

πŸ“– How to Use Tools

Basic Workflow

  1. Select a Tool - Click tool button in toolbar
  2. Click on Canvas - Follow tool-specific instructions
  3. Complete Action - Tool resets after completion
  4. Move Objects - Switch to MOVE tool and drag

Tool-by-Tool Guide

Point Creation Tools

POINT

1. Click POINT tool
2. Click anywhere on canvas
3. Point created at click location

MIDPOINT

1. Click MIDPOINT tool
2. Click first point (or click canvas to create new)
3. Click second point
4. Purple midpoint appears between them

GLIDER

1. Click GLIDER tool
2. Click on a line, circle, or curve
3. Green diamond point appears, constrained to object
4. Drag glider - it stays on the object

CIRCUMCENTER / INCENTER / ORTHOCENTER / CENTROID

1. Click desired triangle center tool
2. Click three points (or click canvas to create new)
3. Colored center point appears:
   - CIRCUMCENTER: Red (center of circumcircle)
   - INCENTER: Orange (center of incircle)
   - ORTHOCENTER: Brown (altitude intersection)
   - CENTROID: Teal (average of vertices)

INTERSECT

1. Click INTERSECT tool
2. Click first object (line/circle/curve)
3. Click second object
4. Intersection point(s) appear

Line & Circle Tools

LINE / SEGMENT

1. Click LINE or SEGMENT tool
2. Click two points (or click canvas twice)
3. Line/segment connects the points

CIRCLE

1. Click CIRCLE tool
2. Click for center point
3. Click for radius point
4. Circle appears

CIRCLE_3_POINTS

1. Click CIRCLE_3_POINTS tool
2. Click three points
3. Blue circle passing through all 3 points appears

PERPENDICULAR_BISECTOR

1. Click PERPENDICULAR_BISECTOR tool
2. Click two points
3. Green perpendicular bisector line appears

ANGLE_BISECTOR

1. Click ANGLE_BISECTOR tool
2. Click 3 points (middle point is vertex)
3. Orange angle bisector appears

PERPENDICULAR_LINE

1. Click PERPENDICULAR_LINE tool
2. Click an existing line
3. Click a point
4. Purple perpendicular line through point appears

PARALLEL_LINE

1. Click PARALLEL_LINE tool
2. Click an existing line
3. Click a point
4. Green parallel line through point appears

TANGENT

1. Click TANGENT tool
2. Click a circle
3. Click an external point
4. Orange tangent line(s) appear

Polygon & Shape Tools

POLYGON

1. Click POLYGON tool
2. Click points for vertices
3. Double-click or press Enter to close polygon
4. Filled polygon appears

REGULAR_POLYGON

1. Click REGULAR_POLYGON tool
2. Click two points (defines first edge)
3. Enter number of sides in prompt (e.g., 6 for hexagon)
4. Light blue regular polygon appears

Measurement Tools

AREA

1. Click AREA tool (in Distance dropdown)
2. Click a polygon or circle
3. Blue text label shows area value

PERIMETER

1. Click PERIMETER tool (in Distance dropdown)
2. Click a polygon or circle
3. Green text label shows perimeter value

DISTANCE

1. Click DISTANCE tool
2. Click two points
3. Distance measurement displays

ANGLE_SIZE

1. Click ANGLE_SIZE tool
2. Click three points (middle is vertex)
3. Angle measure displays

Transformation Tools

REFLECT_LINE

1. Click REFLECT_LINE tool
2. Click object to reflect (point/polygon/line)
3. Click line to reflect across
4. Reflected object appears

ROTATE_ANGLE

1. Click ROTATE_ANGLE tool
2. Click object to rotate
3. Click center point
4. Enter rotation angle in prompt (e.g., 90)
5. Red rotated object appears

TRANSLATE_VECTOR

1. Click TRANSLATE_VECTOR tool
2. Click object to translate
3. Click two points (defines translation vector)
4. Green translated object appears

DILATE_POINT

1. Click DILATE_POINT tool
2. Click object to dilate
3. Click center point
4. Enter scale factor in prompt (e.g., 2 for double size)
5. Purple dilated object appears

Advanced Tools

CONIC (5-Point Conic Section)

1. Click CONIC tool (in Circle dropdown)
2. Click 5 points
3. Purple conic section appears
   (can be ellipse, parabola, or hyperbola)

SLIDER

1. Click SLIDER tool
2. Click on canvas where slider should appear
3. Horizontal slider created (range: -5 to 5, step: 0.1)
4. Drag slider knob to change value
5. Use slider value in functions

TEXT

1. Click TEXT tool
2. Click where text should appear
3. Enter text in prompt
4. Text label appears on canvas

IMAGE

1. Click IMAGE tool
2. Click where image should be placed
3. Select image file
4. Image appears on canvas

πŸ’» Command Line Usage

RGebRa supports text commands for quick object creation:

Point Commands

Point(2, 3)              # Create point at (2, 3)
Midpoint(A, B)           # Midpoint between A and B
Intersect(l1, l2)        # Intersection of lines

Line Commands

Line(A, B)               # Line through points A and B
Segment(A, B)            # Segment from A to B
PerpendicularBisector(A, B)
ParallelLine(l, P)       # Parallel to line l through P

Circle Commands

Circle(C, r)             # Circle with center C, radius r
Circle(A, B, C)          # Circle through 3 points

Calculation Commands

Distance(A, B)           # Distance between points
Area(polygon)            # Calculate area
Angle(A, B, C)          # Measure angle

πŸ§ͺ Testing

Manual Testing Checklist

Point Tools

  • Click POINT β†’ Create point on canvas
  • Click MIDPOINT β†’ Select 2 points β†’ Verify purple midpoint
  • Click GLIDER β†’ Click on circle β†’ Verify constrained green point
  • Click CIRCUMCENTER β†’ Select 3 points β†’ Verify red center
  • Click INCENTER β†’ Select 3 points β†’ Verify orange center
  • Click ORTHOCENTER β†’ Select 3 points β†’ Verify brown center
  • Click CENTROID β†’ Select 3 points β†’ Verify teal center

Line Tools

  • Click LINE β†’ Select 2 points β†’ Verify line
  • Click SEGMENT β†’ Select 2 points β†’ Verify segment
  • Click PERPENDICULAR_BISECTOR β†’ Select 2 points β†’ Verify green bisector
  • Click ANGLE_BISECTOR β†’ Select 3 points β†’ Verify orange bisector
  • Click PERPENDICULAR_LINE β†’ Select line & point β†’ Verify purple line
  • Click PARALLEL_LINE β†’ Select line & point β†’ Verify green line
  • Click TANGENT β†’ Select circle & point β†’ Verify orange tangents

Circle Tools

  • Click CIRCLE β†’ Select center & radius point β†’ Verify circle
  • Click CIRCLE_3_POINTS β†’ Select 3 points β†’ Verify blue circle
  • Click CONIC β†’ Select 5 points β†’ Verify purple conic

Measurement Tools

  • Create polygon β†’ Click AREA β†’ Verify blue area label
  • Create polygon β†’ Click PERIMETER β†’ Verify green perimeter label
  • Click DISTANCE β†’ Select 2 points β†’ Verify distance
  • Click ANGLE_SIZE β†’ Select 3 points β†’ Verify angle

Transformation Tools

  • Create object β†’ Click REFLECT_LINE β†’ Select object & line β†’ Verify reflection
  • Create object β†’ Click ROTATE_ANGLE β†’ Enter 90Β° β†’ Verify 90Β° rotation
  • Create object β†’ Click TRANSLATE_VECTOR β†’ Define vector β†’ Verify translation
  • Create point β†’ Click DILATE_POINT β†’ Enter scale 2 β†’ Verify dilation

Polygon Tools

  • Click POLYGON β†’ Click multiple points β†’ Close β†’ Verify filled polygon
  • Click REGULAR_POLYGON β†’ Select 2 points β†’ Enter 6 β†’ Verify hexagon

Interactive Tools

  • Click SLIDER β†’ Verify slider appears at click location
  • Drag slider β†’ Verify value changes
  • Click TEXT β†’ Enter text β†’ Verify text label
  • Click MOVE β†’ Drag objects β†’ Verify movement
  • Click PAN β†’ Drag canvas β†’ Verify pan

Dynamic Update Testing

1. Create LINE with two points A and B
2. Switch to MOVE tool
3. Drag point A
4. Verify: Line updates position automatically
5. Create MIDPOINT of A and B
6. Drag point A
7. Verify: Midpoint updates automatically

Browser Testing

  • βœ… Chrome (recommended)
  • βœ… Firefox
  • βœ… Safari
  • βœ… Edge

🎨 UI/UX Features

Toolbar Organization

  • Grouped by function (Point, Line, Circle, etc.)
  • Dropdown menus for related tools
  • Visual icons for quick recognition
  • Active tool highlighting

Canvas Features

  • Pan: Hold and drag with PAN tool
  • Zoom: Mouse wheel (future feature)
  • Grid: Toggle for alignment (future feature)
  • Snap to Grid: Precision placement (future feature)

Sidebar

  • Lists all created objects
  • Shows object properties
  • Toggle visibility
  • Delete objects
  • Rename objects

πŸ› Troubleshooting

Common Issues

Tool not working:

1. Ensure correct tool is selected (check toolbar highlight)
2. Follow exact click sequence for multi-step tools
3. Check console for error messages

Objects not appearing:

1. Check if object is visible in sidebar
2. Verify click locations are on canvas
3. Ensure parent objects exist for dependent tools

Performance issues:

1. Reduce number of objects
2. Clear canvas and start fresh
3. Check browser console for warnings

πŸ“„ License

This project is licensed under the MIT License - see LICENSE file for details.


πŸ‘¨β€πŸ’» Author

Rayapati Rai


πŸ™ Acknowledgments

  • JSXGraph - Powerful geometric rendering
  • GeoGebra - Inspiration for features and UI
  • React Team - Amazing framework
  • Zustand - Simple state management

Made with ❀️ using React, TypeScript, and JSXGraph

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages