Correa 1
C++ library with Python bindings to analyse the shape of simple closed curves in R^2
Loading...
Searching...
No Matches
2DShape.cpp File Reference

extract infromation about a polygon More...

#include "2DShape.h"
#include "InOut.h"
#include "PolygonBuilder.h"
#include "Polygon.h"
#include "Ellipse.h"
#include "PH0.h"
#include "Curvature.h"
#include "Component.h"

Functions

int main (int argc, char **argv)
 Main function for analyzing a single 2D shape.
 
bool parse_args (int argc, char **argv, std::string *infile, bool *verbose)
 Parse command-line arguments for 2DShape.
 

Detailed Description

extract infromation about a polygon

Given a polygon stored in a file, calculate the following information about the polygon: length, area, sphericity, maximum volume inscribed ellipse, minimum volume inscribing ellipse, least square ellipse, Willmore energy, and the dimension 0 persistence diagram with essential pairing of the essential 0-cycle and essential 1-cycle.

Author
Patrice Koehl
Yossi Bokor Bleile
Date
April 2023
Version
1

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Main function for analyzing a single 2D shape.

This program analyzes a single 2D polygon and computes various geometric and topological properties. The polygon is centered and scaled to a normalized range before analysis.

Computed properties include:

  • Basic metrics: number of points, length, area, sphericity ($4\ppi A/L^2$)
  • Ellipse fits: maximum inscribed, minimum inscribing, and least-squares ellipses with aspect ratios
  • Willmore energy: measures the bending energy of the curve
  • Persistence diagram: topological shape descriptor from persistent homology
Parameters
argcNumber of command-line arguments
argvArray of command-line argument strings
Returns
0 on success, 1 on failure
See also
parse_args() for command-line argument details

◆ parse_args()

bool parse_args ( int argc,
char ** argv,
std::string * infile,
bool * verbose )

Parse command-line arguments for 2DShape.

Parses command-line arguments for the 2DShape program, extracting the input file path and verbose flag. This is the simplest version that analyzes a single polygon.

Parameters
argcArgument count from main()
argvArgument vector from main()
[out]infilePath to input polygon file (set by -i flag)
[out]verboseEnable verbose output (set by -v or –verbose flag, default: false)
Returns
true if arguments were parsed successfully, false otherwise