Easiest the Qhull library in your code.

Source: Internet
Author: User

The Qhull Library has a central point with a few samples-to-start from when you want to use it in your code. Most interestingly, the developers invite-to-call the Qconvex program as a external application in case you want to C Alculate the convex hull of a point set. This is the easy-to-be-few-a-calls but would-be-lead-to-resource wasting in-case-you-want-do many calls. Of course, the developers tell you to use the C + + interface instead of the C interface. But on the same page, they tell is careful with the C + + bindings, as they is new and experimental. As confused as I am, here is the shortest-I know of the area and volume of a convex hull.

12345678910111213141516171819202122 #include <iostream>extern "C" {    #include <qhull/qhull_a.h>}using namespace std;int main(void) {    int numpoints = 4;    coordT points[] = {0,0,0, 1,0,0, 0,1,0, 0,0,1};    int dim = 3;    char flags[25];    sprintf (flags, "qhull s FA");    qh_new_qhull(dim, numpoints, points, 0, flags, NULL, NULL);    qh_getarea(qh facet_list);    cout << qh totvol << endl;    cout << qh totarea << endl;    qh_freeqhull(!qh_ALL);    return 0;}

Original article url:http://guido.vonrudorff.de/qhull-minimal-example/

Easiest the Qhull library in your code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.