/*****************************************************************************/ /* */ /* Copyright (C) Martin Held 1999-2025 */ /* */ /* */ /* C O P Y R I G H T */ /* */ /* This code is provided at no charge to you for purely non-profit purposes */ /* and only for use internal to your institution. You may use this code for */ /* academic applications, following standard rules of academic conduct */ /* including crediting the author(s) and the copyright holder in any */ /* publication. This code is not in the public domain, and no parts of it */ /* may be duplicated, altered, sold, re-distributed (in either source-code */ /* or binary format), or used as a blueprint for somebody else's own */ /* implementation without obtaining the prior written consent of the */ /* copyright holder. All rights reserved! */ /* */ /* Free use of this code is restricted to purely non-profit purposes within */ /* academic research institutions. Absolutely all other forms of use require */ /* the signing of a non-disclosure agreement or of a commercial license. */ /* Please read the file STANDARD_REPLY.txt for a detailed explanation, and */ /* contact me, Martin Held (held@cs.sbg.ac.at), for commercial evaluation */ /* and licensing terms. */ /* */ /* D I S C L A I M E R */ /* */ /* In any case, this code is provided `as is', and you use it at your own */ /* risk. The author does not accept any responsibility, to the extent */ /* permitted by applicable law, for the consequences of using it or for its */ /* usefulness for any particular application. */ /* */ /* Please report any bugs to held@cs.sbg.ac.at. */ /* */ /*****************************************************************************/ /* */ /* Written by: Martin Held */ /* */ /* E-Mail: held@cs.sbg.ac.at */ /* Fax Mail: (+43 662) 8044-172 */ /* Voice Mail: (+43 662) 8044-6304 */ /* Snail Mail: Martin Held */ /* FB Informatik */ /* Universitaet Salzburg */ /* A-5020 Salzburg, Austria */ /* */ /*****************************************************************************/ /* */ /* Please read the README and README_data files before compiling or using */ /* this code! */ /* */ /*****************************************************************************/ #include "api_functions.h" /* */ /* maintain pre-existing API functions by using a static VRONI object */ /* */ static vroniObject static_vd; vroniObject& API_VD() { return static_vd; } void API_HandleError(void) { static_vd.apiHandleError(); exit(2); } void API_ParseCommandLineArgs(int argc, char *argv[], vr_bool *graphics, vr_bool *color_graphics, vr_bool *full_screen) { try { static_vd.ParseCommandLineArgs(argc, argv, graphics, color_graphics, full_screen); } catch ( ... ) { API_HandleError(); } return; } void API_InitializeProgram(void) { try { static_vd.apiInitializeProgram(); } catch ( ... ) { API_HandleError(); } return; } void API_GetInputData(vr_bool *input_received) { try { static_vd.GetInputData(input_received); } catch ( ... ) { API_HandleError(); } return; } void API_ProceedWithoutGraphics(vr_bool new_input) { try { static_vd.ProceedWithoutGraphics(new_input); } catch ( ... ) { API_HandleError(); } return; } void API_CheckThresholds(void) { try { API_InitializeProgram(); } catch ( ... ) { API_HandleError(); } return; } void API_HandleInput(char input_file[], vr_bool *new_input, vr_bool read_polygon, vr_bool read_poly, vr_bool read_sites, vr_bool read_xdr, vr_bool read_e00, vr_bool read_polylines, vr_bool read_usgs, vr_bool read_dxf, vr_bool read_pnts, vr_bool read_graphml) { try { static_vd.apiHandleInput(input_file, new_input, read_polygon, read_poly, read_sites, read_xdr, read_e00, read_polylines, read_usgs, read_dxf, read_pnts, read_graphml); } catch ( ... ) { API_HandleError(); } return; } void API_FileInput(char input_file[], vr_bool *new_input) { try { static_vd.apiFileInput(input_file, new_input); } catch ( ... ) { API_HandleError(); } return; } void API_ArrayInput(int number_of_points, in_pnts *point_data, int number_of_segments, in_segs *segment_data, int number_of_arcs, in_arcs *arc_data, vr_bool *new_input) { try { static_vd.apiArrayInput(number_of_points, point_data, number_of_segments, segment_data, number_of_arcs, arc_data, new_input); } catch ( ... ) { API_HandleError(); } return; } void API_ComputeVD(vr_bool save_data, vr_bool new_input, vr_bool time, int bound, int sample, int approx, char output_file[], vr_bool discard_dupl_s, vr_bool pnts_only, vr_bool write_vd, char vd_dt_file[], vr_bool clean_up) { try { static_vd.apiComputeVD(save_data, new_input, time, bound, sample, approx, output_file, discard_dupl_s, pnts_only, write_vd, vd_dt_file, clean_up); } catch ( ... ) { API_HandleError(); } return; } #ifdef WRITE_VD /* */ /* Please be warned that this function results in an approximation of all */ /* conic VD edges by straight-line segments and, thus, destroys the VD */ /* computed by VRONI. */ /* It is only to be used if an export of an (approximate) VD is sought, and */ /* if no further computations on the VD computed by VRONI are required! */ /* */ void API_Output_VD(char vd_file[], double vd_apx_dist, vr_bool left_vd, vr_bool right_vd) { try { static_vd.apiOutput_VD(vd_file, vd_apx_dist, left_vd, right_vd); } catch ( ... ) { API_HandleError(); } return; } #endif void API_TerminateProgram(void) { return static_vd.apiTerminateProgram(); } void API_ComputeOff(vr_bool time, char off_file[], vr_bool write_off, vr_bool dxf_format, double t_offset, double d_offset, vr_bool auto_offset, vr_bool left_offset, vr_bool right_offset) { try { static_vd.apiComputeOff(time, off_file, write_off, dxf_format, t_offset, d_offset, auto_offset, left_offset, right_offset); } catch ( ... ) { API_HandleError(); } return; } #ifdef MAT void API_ComputeWMAT(vr_bool auto_wmat, double wmat_angle, double wmat_dist, vr_bool time, vr_bool left_wmat, vr_bool right_wmat) { try { static_vd.apiComputeWMAT(auto_wmat, wmat_angle, wmat_dist, time, left_wmat, right_wmat); } catch ( ... ) { API_HandleError(); } return; } #endif /* */ /* this function outputs a description of the MA within a polygon. */ /* note that it will only work if the input represents one closed polygon, */ /* and if the MA construction was restricted to the interior of that */ /* polygon. starting at a root node chosen at VRONI's discretion, the MA */ /* tree is output as a list of numbered quintuples */ /* (node_id, pnt_coord, radius, parent_node_id, edge_classifier), */ /* where */ /* node_id ... the ID number (non-negative integer) of the node; */ /* it depends on VRONI's data structure and is */ /* assigned at VRONI's discretion; */ /* pnt_coord ... x,y coordinates of the MA node; */ /* radius ... radius of clearance disk at that node; */ /* parent_node_id ... the ID number of the parent node of the current */ /* node in the MA tree; set to -1 for the root; */ /* edge_classifier ... an enumeration type that describes the type of the */ /* MA edge between the current node and its parent; */ /* it is set to */ /* 1 if the MA edge is defined by two vertices, */ /* i.e., if it is part of a hyperbolic bisector, */ /* 2 if the MA edge is defined by two segments, */ /* i.e., if it is part of a straight-line bisector,*/ /* 3 if a vertex is on the left of the MA edge */ /* as one looks towards the parent of the node, */ /* i.e., if it is part of a parabolic bisector, */ /* 4 if a vertex is on the right of the MA edge */ /* as one looks towards the parent of the node, */ /* i.e., if it is part of a parabolic bisector; */ /* 9 for the root node. */ /* */ void API_OutputMA(char vdma_file[]) { #ifdef MAT try { static_vd.OutputMA(vdma_file); } catch ( ... ) { API_HandleError(); } #endif return; } void API_ComputeOutputMIC(vr_bool time, vr_bool left_mic, vr_bool right_mic, coord *center, double *radius) { try { static_vd.apiComputeOutputMIC(time, left_mic, right_mic, center, radius); } catch ( ... ) { API_HandleError(); } return; } void API_ResetAll(void) { static_vd.apiResetAll(); return; } void API_ResetOffsetData(void) { static_vd.apiResetOffsetData(); return; } const char* API_GetProgName() { return static_vd.apiGetProgName(); } const char* API_GetProgVersion() { return static_vd.apiGetProgVersion(); } const char* API_GetProgYear() { return static_vd.apiGetProgYear(); }