| #!/usr/bin/env python3 | |
| """ | |
| SDF-Based Analytic Geometry Solver | |
| Main entry point for batch processing geometry problems. | |
| """ | |
| import argparse | |
| import sys | |
| from pathlib import Path | |
| # Add src directory to path for module imports | |
| sys.path.insert(0, str(Path(__file__).parent)) | |
| from sdf_geo import SDFBatchProcessor | |
| def main(): | |
| parser = argparse.ArgumentParser( | |
| description='SDF-Based Geometry Solver - Automatic geometry visualization using Signed Distance Fields' | |
| ) | |
| parser.add_argument( | |
| '--input', '-i', | |
| type=str, | |
| default='data/test_en.json', | |
| help='Path to input JSON file containing geometry problems' | |
| ) | |
| parser.add_argument( | |
| '--output', '-o', | |
| type=str, | |
| default='results', | |
| help='Output directory for generated visualizations' | |
| ) | |
| parser.add_argument( | |
| '--max', '-m', | |
| type=int, | |
| default=None, | |
| help='Maximum number of problems to process (default: all)' | |
| ) | |
| parser.add_argument( | |
| '--verbose', '-v', | |
| action='store_true', | |
| help='Enable verbose output during processing' | |
| ) | |
| args = parser.parse_args() | |
| # Resolve paths | |
| input_path = Path(args.input) | |
| output_path = Path(args.output) | |
| # Check input file exists | |
| if not input_path.exists(): | |
| print(f"Error: Input file not found: {input_path}") | |
| return 1 | |
| # Create processor and run | |
| processor = SDFBatchProcessor(str(output_path)) | |
| processor.process_batch( | |
| str(input_path), | |
| max_problems=args.max, | |
| verbose=args.verbose | |
| ) | |
| return 0 | |
| if __name__ == '__main__': | |
| exit(main()) | |