1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
--- contrib/libs/qhull/libqhull_r/user_r.c (index)
+++ contrib/libs/qhull/libqhull_r/user_r.c (working tree)
@@ -123,6 +123,12 @@
*/
int qh_new_qhull(qhT *qh, int dim, int numpoints, coordT *points, boolT ismalloc,
char *qhull_cmd, FILE *outfile, FILE *errfile) {
+ return qh_new_qhull_feaspoint(qh, dim, numpoints, points, ismalloc,
+ qhull_cmd, outfile, errfile, NULL);
+}
+
+int qh_new_qhull_feaspoint(qhT *qh, int dim, int numpoints, coordT *points, boolT ismalloc,
+ char *qhull_cmd, FILE *outfile, FILE *errfile, coordT* feaspoint) {
/* gcc may issue a "might be clobbered" warning for dim, points, and ismalloc [-Wclobbered].
These parameters are not referenced after a longjmp() and hence not clobbered.
See http://stackoverflow.com/questions/7721854/what-sense-do-these-clobbered-variable-warnings-make */
@@ -158,7 +164,24 @@ int qh_new_qhull(qhT *qh, int dim, int numpoints, coordT *points, boolT ismalloc
/* points is an array of halfspaces,
the last coordinate of each halfspace is its offset */
hulldim= dim-1;
- qh_setfeasible(qh, hulldim);
+ if(feaspoint)
+ {
+ if (!(qh->feasible_point= (pointT*)qh_malloc(hulldim * sizeof(coordT)))) {
+ qh_fprintf(qh, qh->ferr, 6079, "qhull error: insufficient memory for 'Hn,n,n'\n");
+ qh_errexit(qh, qh_ERRmem, NULL, NULL);
+ }
+ coordT* coords = qh->feasible_point;
+ coordT* value = feaspoint;
+ int i;
+ for(i = 0; i < hulldim; ++i)
+ {
+ *(coords++) = *(value++);
+ }
+ }
+ else
+ {
+ qh_setfeasible(qh, hulldim);
+ }
new_points= qh_sethalfspace_all(qh, dim, numpoints, points, qh->feasible_point);
new_ismalloc= True;
if (ismalloc)
--- contrib/libs/qhull/libqhull_r/libqhull_r.h (index)
+++ contrib/libs/qhull/libqhull_r/libqhull_r.h (working tree)
@@ -1029,6 +1029,8 @@ void qh_errexit(qhT *qh, int exitcode, facetT *facet, ridgeT *ridge);
void qh_errprint(qhT *qh, const char* string, facetT *atfacet, facetT *otherfacet, ridgeT *atridge, vertexT *atvertex);
int qh_new_qhull(qhT *qh, int dim, int numpoints, coordT *points, boolT ismalloc,
char *qhull_cmd, FILE *outfile, FILE *errfile);
+int qh_new_qhull_feaspoint(qhT *qh, int dim, int numpoints, coordT *points, boolT ismalloc,
+ char *qhull_cmd, FILE *outfile, FILE *errfile, coordT* feaspoint);
void qh_printfacetlist(qhT *qh, facetT *facetlist, setT *facets, boolT printall);
void qh_printhelp_degenerate(qhT *qh, FILE *fp);
void qh_printhelp_internal(qhT *qh, FILE *fp);
|