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.
- 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
- 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
- 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
- TailwindCSS 3.4.14 - Utility-first CSS framework
- PostCSS - CSS transformations
- ESLint - Code linting
- TypeScript ESLint - TypeScript-specific linting
- Vite Plugin React - React Fast Refresh support
- Installation
- Building the Application
- Application Architecture
- Tool Categories
- How to Use Tools
- Command Line Usage
- Development Guide
- Testing
- Node.js 18.x or higher
- npm 9.x or higher
# Clone the repository
git clone https://github.com/rayapatirai/RGebRa.git
# Navigate to project directory
cd RGebRa
# Install dependencies
npm install# Start development server with hot reload
npm run dev
# Application will be available at:
# http://localhost:5173# Run TypeScript compiler + build
npm run build
# Note: This may show TypeScript warnings from JSXGraph library
# These are cosmetic and don't affect functionality# Fast production build without type checking
npm run build:prod
# Build completes in ~3 seconds
# Output: ./dist directory with optimized filesdist/
βββ 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 locally
npm run preview
# Opens at http://localhost:4173
# Test the production build before deployment# 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# 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# 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# 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.htmlWhy 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 reloadnpm run build:prod- Production deployment (recommended)npm run build- Full build with type checking (CI/CD)npm run preview- Test production build locally
# Run ESLint to check code quality
npm run lintRGebRa/
βββ 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
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
App
βββ Toolbar (Tool Selection)
βββ Canvas (Drawing Area)
β βββ JSXGraph Board
βββ Sidebar (Object List)
βββ CommandLine (Text Input)
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
}- π±οΈ MOVE - Select and move objects
- β PAN - Pan the canvas view
- β POINT - Create points
- β LINE - Create lines
- πΊ POLYGON - Create polygons
- β¨ 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
- β 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
- β 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
- π DISTANCE - Distance between points
- π LENGTH - Length of segment
- π ANGLE_SIZE - Measure angle
- π AREA - Calculate area
- π PERIMETER - Calculate perimeter
- π SLOPE - Slope of line
- π 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
- π· REGULAR_POLYGON - Regular n-sided polygon
- π SLIDER - Interactive parameter slider
- πΌοΈ IMAGE - Insert image
- π TEXT - Add text labels
- βοΈ PEN - Freehand drawing
- ποΈ DELETE - Delete objects
- Select a Tool - Click tool button in toolbar
- Click on Canvas - Follow tool-specific instructions
- Complete Action - Tool resets after completion
- Move Objects - Switch to MOVE tool and drag
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 / 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
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
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
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
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
RGebRa supports text commands for quick object creation:
Point(2, 3) # Create point at (2, 3)
Midpoint(A, B) # Midpoint between A and B
Intersect(l1, l2) # Intersection of lines
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(C, r) # Circle with center C, radius r
Circle(A, B, C) # Circle through 3 points
Distance(A, B) # Distance between points
Area(polygon) # Calculate area
Angle(A, B, C) # Measure angle
- 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
- 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
- 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
- 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
- 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
- Click POLYGON β Click multiple points β Close β Verify filled polygon
- Click REGULAR_POLYGON β Select 2 points β Enter 6 β Verify hexagon
- 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
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
- β Chrome (recommended)
- β Firefox
- β Safari
- β Edge
- Grouped by function (Point, Line, Circle, etc.)
- Dropdown menus for related tools
- Visual icons for quick recognition
- Active tool highlighting
- 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)
- Lists all created objects
- Shows object properties
- Toggle visibility
- Delete objects
- Rename objects
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
This project is licensed under the MIT License - see LICENSE file for details.
Rayapati Rai
- GitHub: @rayapatiranjithai
- 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