Added qhull library to xs/src and cmake

This commit is contained in:
Lukas Matena 2018-08-07 11:15:47 +02:00 committed by Enrico Turri
parent 168d38df2b
commit 211790f8c3
237 changed files with 104145 additions and 1 deletions

View File

@ -459,7 +459,7 @@ if(APPLE)
# Ignore undefined symbols of the perl interpreter, they will be found in the caller image.
target_link_libraries(XS "-undefined dynamic_lookup")
endif()
target_link_libraries(XS libslic3r libslic3r_gui admesh miniz clipper nowide polypartition poly2tri semver avrdude)
target_link_libraries(XS libslic3r libslic3r_gui admesh miniz clipper nowide polypartition poly2tri semver avrdude qhull)
if(SLIC3R_PROFILE)
target_link_libraries(XS Shiny)
endif()
@ -540,6 +540,10 @@ endif()
add_subdirectory(src/avrdude)
add_subdirectory(src/qhull)
include_directories(${LIBDIR}/qhull/src)
message(STATUS ${LIBDIR}/qhull/src)
## REQUIRED packages
# Find and configure boost

47
xs/src/qhull/Announce.txt Normal file
View File

@ -0,0 +1,47 @@
Qhull 2015.2 2016/01/18
http://www.qhull.org
git@github.com:qhull/qhull.git
http://www.geomview.org
Qhull computes convex hulls, Delaunay triangulations, Voronoi diagrams,
furthest-site Voronoi diagrams, and halfspace intersections about a point.
It runs in 2-d, 3-d, 4-d, or higher. It implements the Quickhull algorithm
for computing convex hulls. Qhull handles round-off errors from floating
point arithmetic. It can approximate a convex hull.
The program includes options for hull volume, facet area, partial hulls,
input transformations, randomization, tracing, multiple output formats, and
execution statistics. The program can be called from within your application.
You can view the results in 2-d, 3-d and 4-d with Geomview.
To download Qhull:
http://www.qhull.org/download
git@github.com:qhull/qhull.git
Download qhull-96.ps for:
Barber, C. B., D.P. Dobkin, and H.T. Huhdanpaa, "The
Quickhull Algorithm for Convex Hulls," ACM Trans. on
Mathematical Software, 22(4):469-483, Dec. 1996.
http://www.acm.org/pubs/citations/journals/toms/1996-22-4/p469-barber/
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.117.405
Abstract:
The convex hull of a set of points is the smallest convex set that contains
the points. This article presents a practical convex hull algorithm that
combines the two-dimensional Quickhull Algorithm with the general dimension
Beneath-Beyond Algorithm. It is similar to the randomized, incremental
algorithms for convex hull and Delaunay triangulation. We provide empirical
evidence that the algorithm runs faster when the input contains non-extreme
points, and that it uses less memory.
Computational geometry algorithms have traditionally assumed that input sets
are well behaved. When an algorithm is implemented with floating point
arithmetic, this assumption can lead to serious errors. We briefly describe
a solution to this problem when computing the convex hull in two, three, or
four dimensions. The output is a set of "thick" facets that contain all
possible exact convex hulls of the input. A variation is effective in five
or more dimensions.

128
xs/src/qhull/CMakeLists.txt Normal file
View File

@ -0,0 +1,128 @@
# This CMake file is written specifically to integrate qhull library with Slic3rPE
# (see https://github.com/prusa3d/Slic3r for more information about the project)
#
# Only original libraries qhullstatic_r and qhullcpp are included.
# They are built as a single statically linked library.
#
# Created by modification of the original qhull CMakeLists.
# Lukas Matena (25.7.2018), lukasmatena@seznam.cz
project(qhull)
cmake_minimum_required(VERSION 2.6)
# Define qhull_VERSION in CMakeLists.txt, Makefile, qhull-exports.def, qhull_p-exports.def, qhull_r-exports.def, qhull-warn.pri
set(qhull_VERSION2 "2015.2 2016/01/18") # not used, See global.c, global_r.c, rbox.c, rbox_r.c
set(qhull_VERSION "7.2.0") # Advance every release
#include(CMakeModules/CheckLFS.cmake)
#option(WITH_LFS "Enable Large File Support" ON)
#check_lfs(WITH_LFS)
message(STATUS "qhull Version: ${qhull_VERSION} (static linking)")
set(libqhull_HEADERS
# reentrant qhull HEADERS:
src/libqhull_r/libqhull_r.h
src/libqhull_r/geom_r.h
src/libqhull_r/io_r.h
src/libqhull_r/mem_r.h
src/libqhull_r/merge_r.h
src/libqhull_r/poly_r.h
src/libqhull_r/qhull_ra.h
src/libqhull_r/qset_r.h
src/libqhull_r/random_r.h
src/libqhull_r/stat_r.h
src/libqhull_r/user_r.h
# C++ interface to reentrant Qhull HEADERS:
src/libqhullcpp/Coordinates.h
src/libqhullcpp/functionObjects.h
src/libqhullcpp/PointCoordinates.h
src/libqhullcpp/Qhull.h
src/libqhullcpp/QhullError.h
src/libqhullcpp/QhullFacet.h
src/libqhullcpp/QhullFacetList.h
src/libqhullcpp/QhullFacetSet.h
src/libqhullcpp/QhullHyperplane.h
src/libqhullcpp/QhullIterator.h
src/libqhullcpp/QhullLinkedList.h
src/libqhullcpp/QhullPoint.h
src/libqhullcpp/QhullPoints.h
src/libqhullcpp/QhullPointSet.h
src/libqhullcpp/QhullQh.h
src/libqhullcpp/QhullRidge.h
src/libqhullcpp/QhullSet.h
src/libqhullcpp/QhullSets.h
src/libqhullcpp/QhullStat.h
src/libqhullcpp/QhullVertex.h
src/libqhullcpp/QhullVertexSet.h
src/libqhullcpp/RboxPoints.h
src/libqhullcpp/RoadError.h
src/libqhullcpp/RoadLogEvent.h
src/qhulltest/RoadTest.h
)
set(libqhull_SOURCES
# reentrant qhull SOURCES:
src/libqhull_r/global_r.c
src/libqhull_r/stat_r.c
src/libqhull_r/geom2_r.c
src/libqhull_r/poly2_r.c
src/libqhull_r/merge_r.c
src/libqhull_r/libqhull_r.c
src/libqhull_r/geom_r.c
src/libqhull_r/poly_r.c
src/libqhull_r/qset_r.c
src/libqhull_r/mem_r.c
src/libqhull_r/random_r.c
src/libqhull_r/usermem_r.c
src/libqhull_r/userprintf_r.c
src/libqhull_r/io_r.c
src/libqhull_r/user_r.c
src/libqhull_r/rboxlib_r.c
src/libqhull_r/userprintf_rbox_r.c
# C++ interface to reentrant Qhull SOURCES:
src/libqhullcpp/Coordinates.cpp
src/libqhullcpp/PointCoordinates.cpp
src/libqhullcpp/Qhull.cpp
src/libqhullcpp/QhullFacet.cpp
src/libqhullcpp/QhullFacetList.cpp
src/libqhullcpp/QhullFacetSet.cpp
src/libqhullcpp/QhullHyperplane.cpp
src/libqhullcpp/QhullPoint.cpp
src/libqhullcpp/QhullPointSet.cpp
src/libqhullcpp/QhullPoints.cpp
src/libqhullcpp/QhullQh.cpp
src/libqhullcpp/QhullRidge.cpp
src/libqhullcpp/QhullSet.cpp
src/libqhullcpp/QhullStat.cpp
src/libqhullcpp/QhullVertex.cpp
src/libqhullcpp/QhullVertexSet.cpp
src/libqhullcpp/RboxPoints.cpp
src/libqhullcpp/RoadError.cpp
src/libqhullcpp/RoadLogEvent.cpp
# headers for both (libqhullr and libqhullcpp:
${libqhull_HEADERS}
)
##################################################
# combined library (reentrant qhull and qhullcpp) for Slic3r:
set(qhull_STATIC qhull)
add_library(${qhull_STATIC} STATIC ${libqhull_SOURCES})
set_target_properties(${qhull_STATIC} PROPERTIES
VERSION ${qhull_VERSION})
if(UNIX)
target_link_libraries(${qhull_STATIC} m)
endif(UNIX)
##################################################
# LIBDIR is defined in the main xs CMake file:
target_include_directories(${qhull_STATIC} PRIVATE ${LIBDIR}/qhull/src)

38
xs/src/qhull/COPYING.txt Normal file
View File

@ -0,0 +1,38 @@
Qhull, Copyright (c) 1993-2015
C.B. Barber
Arlington, MA
and
The National Science and Technology Research Center for
Computation and Visualization of Geometric Structures
(The Geometry Center)
University of Minnesota
email: qhull@qhull.org
This software includes Qhull from C.B. Barber and The Geometry Center.
Qhull is copyrighted as noted above. Qhull is free software and may
be obtained via http from www.qhull.org. It may be freely copied, modified,
and redistributed under the following conditions:
1. All copyright notices must remain intact in all files.
2. A copy of this text file must be distributed along with any copies
of Qhull that you redistribute; this includes copies that you have
modified, or copies of programs or other software products that
include Qhull.
3. If you modify Qhull, you must include a notice giving the
name of the person performing the modification, the date of
modification, and the reason for such modification.
4. When distributing modified versions of Qhull, or other software
products that include Qhull, you must provide notice that the original
source code may be obtained as noted above.
5. There is no warranty or other guarantee of fitness for Qhull, it is
provided solely "as is". Bug reports or fixes may be sent to
qhull_bug@qhull.org; the authors may or may not act on them as
they desire.

623
xs/src/qhull/README.txt Normal file
View File

@ -0,0 +1,623 @@
This distribution of qhull library is only meant for interfacing qhull with Slic3rPE
(https://github.com/prusa3d/Slic3r).
The qhull source file was acquired from https://github.com/qhull/qhull at revision
f0bd8ceeb84b554d7cdde9bbfae7d3351270478c.
No changes to the qhull library were made, except for
- setting REALfloat=1 in user_r.h to enforce calculations in floats
- modifying CMakeLists.txt (the original was renamed to origCMakeLists.txt)
Many thanks to C. Bradford Barber and all contributors.
Lukas Matena (lukasmatena@seznam.cz)
25.7.2018
See original contents of the README file below.
======================================================================================
======================================================================================
======================================================================================
Name
qhull, rbox 2015.2 2016/01/18
Convex hull, Delaunay triangulation, Voronoi diagrams, Halfspace intersection
Documentation:
html/index.htm
<http://www.qhull.org/html>
Available from:
<http://www.qhull.org>
<http://www.qhull.org/download>
<http://github.com/qhull/qhull> (git@github.com:qhull/qhull.git)
News and a paper:
<http://www.qhull.org/news>
<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.117.405>
Version 1 (simplicial only):
<http://www.qhull.org/download/qhull-1.0.tar.gz>
Purpose
Qhull is a general dimension convex hull program that reads a set
of points from stdin, and outputs the smallest convex set that contains
the points to stdout. It also generates Delaunay triangulations, Voronoi
diagrams, furthest-site Voronoi diagrams, and halfspace intersections
about a point.
Rbox is a useful tool in generating input for Qhull; it generates
hypercubes, diamonds, cones, circles, simplices, spirals,
lattices, and random points.
Qhull produces graphical output for Geomview. This helps with
understanding the output. <http://www.geomview.org>
Environment requirements
Qhull and rbox should run on all 32-bit and 64-bit computers. Use
an ANSI C or C++ compiler to compile the program. The software is
self-contained. It comes with examples and test scripts.
Qhull's C++ interface uses the STL. The C++ test program uses QTestLib
from the Qt Framework. Qhull's C++ interface may change without
notice. Eventually, it will move into the qhull shared library.
Qhull is copyrighted software. Please read COPYING.txt and REGISTER.txt
before using or distributing Qhull.
To cite Qhull, please use
Barber, C.B., Dobkin, D.P., and Huhdanpaa, H.T., "The Quickhull
algorithm for convex hulls," ACM Trans. on Mathematical Software,
22(4):469-483, Dec 1996, http://www.qhull.org.
To modify Qhull, particularly the C++ interface
Qhull is on GitHub
(http://github.com/qhull/qhull, git@github.com:qhull/qhull.git)
For internal documentation, see html/qh-code.htm
To install Qhull
Qhull is precompiled for Windows 32-bit, otherwise it needs compilation.
Qhull includes Makefiles for gcc and other targets, CMakeLists.txt for CMake,
.sln/.vcproj/.vcxproj files for Microsoft Visual Studio, and .pro files
for Qt Creator. It compiles under Windows with mingw.
Install and build instructions follow.
See the end of this document for a list of distributed files.
-----------------
Installing Qhull on Windows 10, 8, 7 (32- or 64-bit), Windows XP, and Windows NT
The zip file contains rbox.exe, qhull.exe, qconvex.exe, qdelaunay.exe,
qhalf.exe, qvoronoi.exe, testqset.exe, user_eg*.exe, documentation files,
and source files. Qhull.exe and user-eg3.exe are compiled with the reentrant
library while the other executables use the non-reentrant library.
To install Qhull:
- Unzip the files into a directory (e.g., named 'qhull')
- Click on QHULL-GO or open a command window into Qhull's bin directory.
- Test with 'rbox D4 | qhull'
To uninstall Qhull
- Delete the qhull directory
To learn about Qhull:
- Execute 'qconvex' for a synopsis and examples.
- Execute 'rbox 10 | qconvex' to compute the convex hull of 10 random points.
- Execute 'rbox 10 | qconvex i TO file' to write results to 'file'.
- Browse the documentation: qhull\html\index.htm
- If an error occurs, Windows sends the error to stdout instead of stderr.
Use 'TO xxx' to send normal output to xxx
To improve the command window
- Double-click the window bar to increase the size of the window
- Right-click the window bar
- Select Properties
- Check QuickEdit Mode
Select text with right-click or Enter
Paste text with right-click
- Change Font to Lucinda Console
- Change Layout to Screen Buffer Height 999, Window Size Height 55
- Change Colors to Screen Background White, Screen Text Black
- Click OK
- Select 'Modify shortcut that started this window', then OK
If you use qhull a lot, install a bash shell such as
MSYS (www.mingw.org/wiki/msys), Road Bash (www.qhull.org/bash),
or Cygwin (www.cygwin.com).
-----------------
Installing Qhull on Unix with gcc
To build Qhull, static libraries, shared library, and C++ interface
- Download and extract Qhull (either GitHub, .tgz file, or .zip file)
- make
- export LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH
The Makefiles may be edited for other compilers.
If 'testqset' exits with an error, qhull is broken
A simple Makefile for Qhull is in src/libqhull and src/libqhull_r.
To build the Qhull executables and libqhullstatic
- Extract Qhull from qhull...tgz or qhull...zip
- cd src/libqhull_r # cd src/libqhull
- make
-----------------
Installing Qhull with CMake 2.6 or later
See CMakeLists.txt for examples and further build instructions
To build Qhull, static libraries, shared library, and C++ interface
- Download and extract Qhull (either GitHub, .tgz file, or .zip file)
- cd build
- cmake --help # List build generators
- make -G "<generator>" .. && cmake ..
- cmake ..
- make
- make install
The ".." is important. It refers to the parent directory (i.e., qhull/)
On Windows, CMake installs to C:/Program Files/qhull. 64-bit generators
have a "Win64" tag.
If creating a qhull package, please include a pkg-config file based on build/qhull*.pc.in
If cmake fails with "No CMAKE_C_COMPILER could be found"
- cmake was not able to find the build environment specified by -G "..."
-----------------
Installing Qhull with Qt
To build Qhull, including its C++ test (qhulltest)
- Download and extract Qhull (either GitHub, .tgz file, or .zip file)
- Load src/qhull-all.pro into QtCreator
- Build
-------------------
Working with Qhull's C++ interface
See html/qh-code.htm#cpp for calling Qhull from C++ programs
See html/qh-code.htm#reentrant for converting from Qhull-2012
Examples of using the C++ interface
user_eg3_r.cpp
qhulltest/*_test.cpp
Qhull's C++ interface is likely to change. Stay current with GitHub.
To clone Qhull's next branch from http://github.com/qhull/qhull
git init
git clone git@github.com:qhull/qhull.git
cd qhull
git checkout next
...
git pull origin next
Compile qhullcpp and libqhullstatic_r with the same compiler. Both libraries
use the C routines setjmp() and longjmp() for error handling. They must
be compiled with the same compiler.
-------------------
Calling Qhull from C programs
See html/qh-code.htm#library for calling Qhull from C programs
See html/qh-code.htm#reentrant for converting from Qhull-2012
Warning: You will need to understand Qhull's data structures and read the
code. Most users will find it easier to call Qhull as an external command.
The new, reentrant 'C' code (src/libqhull_r), passes a pointer to qhT
to most Qhull routines. This allows multiple instances of Qhull to run
at the same time. It simplifies the C++ interface.
The non-reentrant 'C' code (src/libqhull) looks unusual. It refers to
Qhull's global data structure, qhT, through a 'qh' macro (e.g., 'qh ferr').
This allows the same code to use static memory or heap memory.
If qh_QHpointer is defined, qh_qh is a pointer to an allocated qhT;
otherwise qh_qh is a global static data structure of type qhT.
------------------
Compiling Qhull with Microsoft Visual C++
To compile 32-bit Qhull with Microsoft Visual C++ 2010 and later
- Download and extract Qhull (either GitHub, .tgz file, or .zip file)
- Load solution build/qhull-32.sln
- Build target 'Win32'
- Project qhulltest requires Qt for DevStudio (http://www.qt.io)
Set the QTDIR environment variable to your Qt directory (e.g., c:/qt/5.2.0/5.2.0/msvc2012)
If QTDIR is incorrect, precompile will fail with 'Can not locate the file specified'
To compile 64-bit Qhull with Microsoft Visual C++ 2010 and later
- 64-bit Qhull has larger data structures due to 64-bit pointers
- Download and extract Qhull (either GitHub, .tgz file, or .zip file)
- Load solution build/qhull-64.sln
- Build target 'Win32'
- Project qhulltest requires Qt for DevStudio (http://www.qt.io)
Set the QTDIR environment variable to your Qt directory (e.g., c:/qt/5.2.0/5.2.0/msvc2012_64)
If QTDIR is incorrect, precompile will fail with 'Can not locate the file specified'
To compile Qhull with Microsoft Visual C++ 2005 (vcproj files)
- Download and extract Qhull (either GitHub, .tgz file, or .zip file)
- Load solution build/qhull.sln
- Build target 'win32' (not 'x64')
- Project qhulltest requires Qt for DevStudio (http://www.qt.io)
Set the QTDIR environment variable to your Qt directory (e.g., c:/qt/4.7.4)
If QTDIR is incorrect, precompile will fail with 'Can not locate the file specified'
-----------------
Compiling Qhull with Qt Creator
Qt (http://www.qt.io) is a C++ framework for Windows, Linux, and Macintosh
Qhull uses QTestLib to test qhull's C++ interface (see src/qhulltest/)
To compile Qhull with Qt Creator
- Download and extract Qhull (either GitHub, .tgz file, or .zip file)
- Download the Qt SDK
- Start Qt Creator
- Load src/qhull-all.pro
- Build
-----------------
Compiling Qhull with mingw on Windows
To compile Qhull with MINGW
- Download and extract Qhull (either GitHub, .tgz file, or .zip file)
- Install Road Bash (http://www.qhull.org/bash)
or install MSYS (http://www.mingw.org/wiki/msys)
- Install MINGW-w64 (http://sourceforge.net/projects/mingw-w64).
Mingw is included with Qt SDK.
- make
-----------------
Compiling Qhull with cygwin on Windows
To compile Qhull with cygwin
- Download and extract Qhull (either GitHub, .tgz file, or .zip file)
- Install cygwin (http://www.cygwin.com)
- Include packages for gcc, make, ar, and ln
- make
-----------------
Compiling from Makfile without gcc
The file, qhull-src.tgz, contains documentation and source files for
qhull and rbox.
To unpack the tgz file
- tar zxf qhull-src.tgz
- cd qhull
- Use qhull/Makefile
Simpler Makefiles are qhull/src/libqhull/Makefile and qhull/src/libqhull_r/Makefile
Compiling qhull and rbox with Makefile
- in Makefile, check the CC, CCOPTS1, PRINTMAN, and PRINTC defines
- the defaults are gcc and enscript
- CCOPTS1 should include the ANSI flag. It defines __STDC__
- in user.h, check the definitions of qh_SECticks and qh_CPUclock.
- use '#define qh_CLOCKtype 2' for timing runs longer than 1 hour
- type: make
- this builds: qhull qconvex qdelaunay qhalf qvoronoi rbox libqhull.a libqhull_r.a
- type: make doc
- this prints the man page
- See also qhull/html/index.htm
- if your compiler reports many errors, it is probably not a ANSI C compiler
- you will need to set the -ansi switch or find another compiler
- if your compiler warns about missing prototypes for fprintf() etc.
- this is ok, your compiler should have these in stdio.h
- if your compiler warns about missing prototypes for memset() etc.
- include memory.h in qhull_a.h
- if your compiler reports "global.c: storage size of 'qh_qh' isn't known"
- delete the initializer "={0}" in global.c, stat.c and mem.c
- if your compiler warns about "stat.c: improper initializer"
- this is ok, the initializer is not used
- if you have trouble building libqhull.a with 'ar'
- try 'make -f Makefile.txt qhullx'
- if the code compiles, the qhull test case will automatically execute
- if an error occurs, there's an incompatibility between machines
- If you can, try a different compiler
- You can turn off the Qhull memory manager with qh_NOmem in mem.h
- You can turn off compiler optimization (-O2 in Makefile)
- If you find the source of the problem, please let us know
- to install the programs and their man pages:
- define MANDIR and BINDIR
- type 'make install'
- if you have Geomview (www.geomview.org)
- try 'rbox 100 | qconvex G >a' and load 'a' into Geomview
- run 'q_eg' for Geomview examples of Qhull output (see qh-eg.htm)
------------------
Compiling on other machines and compilers
Qhull may compile with Borland C++ 5.0 bcc32. A Makefile is included.
Execute 'cd src/libqhull; make -f Mborland'. If you use the Borland IDE, set
the ANSI option in Options:Project:Compiler:Source:Language-compliance.
Qhull may compile with Borland C++ 4.02 for Win32 and DOS Power Pack.
Use 'cd src/libqhull; make -f Mborland -D_DPMI'. Qhull 1.0 compiles with
Borland C++ 4.02. For rbox 1.0, use "bcc32 -WX -w- -O2-e -erbox -lc rbox.c".
Use the same options for Qhull 1.0. [D. Zwick]
If you have troubles with the memory manager, you can turn it off by
defining qh_NOmem in mem.h.
-----------------
Distributed files
README.txt // Instructions for installing Qhull
REGISTER.txt // Qhull registration
COPYING.txt // Copyright notice
QHULL-GO.lnk // Windows icon for eg/qhull-go.bat
Announce.txt // Announcement
CMakeLists.txt // CMake build file (2.6 or later)
CMakeModules/CheckLFS.cmake // enables Large File Support in cmake
File_id.diz // Package descriptor
index.htm // Home page
Makefile // Makefile for gcc and other compilers
qhull*.md5sum // md5sum for all files
bin/* // Qhull executables and dll (.zip only)
build/qhull*.pc.in // pkg-config templates for qhull_r, qhull, and qhull_p
build/qhull-32.sln // 32-bit DevStudio solution and project files (2010 and later)
build/*-32.vcxproj
build/qhull-64.sln // 64-bit DevStudio solution and project files (2010 and later)
build/*-64.vcxproj
build/qhull.sln // DevStudio solution and project files (2005 and 2009)
build/*.vcproj
eg/* // Test scripts and geomview files from q_eg
html/index.htm // Manual
html/qh-faq.htm // Frequently asked questions
html/qh-get.htm // Download page
html/qhull-cpp.xml // C++ style notes as a Road FAQ (www.qhull.org/road)
src/Changes.txt // Change history for Qhull and rbox
src/qhull-all.pro // Qt project
eg/
q_eg // shell script for Geomview examples (eg.01.cube)
q_egtest // shell script for Geomview test examples
q_test // shell script to test qhull
q_test-ok.txt // output from q_test
qhulltest-ok.txt // output from qhulltest (Qt only)
make-vcproj.sh // bash shell script to create vcproj and vcxprog files
qhull-zip.sh // bash shell script for distribution files
rbox consists of (bin, html):
rbox.exe // Win32 executable (.zip only)
rbox.htm // html manual
rbox.man // Unix man page
rbox.txt
qhull consists of (bin, html):
qconvex.exe // Win32 executables and dlls (.zip download only)
qhull.exe // Built with the reentrant library (about 2% slower)
qdelaunay.exe
qhalf.exe
qvoronoi.exe
qhull_r.dll
qhull-go.bat // command window
qconvex.htm // html manual
qdelaun.htm
qdelau_f.htm
qhalf.htm
qvoronoi.htm
qvoron_f.htm
qh-eg.htm
qh-code.htm
qh-impre.htm
index.htm
qh-opt*.htm
qh-quick.htm
qh--*.gif // images for manual
normal_voronoi_knauss_oesterle.jpg
qhull.man // Unix man page
qhull.txt
bin/
msvcr80.dll // Visual C++ redistributable file (.zip download only)
src/
qhull/unix.c // Qhull and rbox applications using non-reentrant libqhullstatic.a
rbox/rbox.c
qconvex/qconvex.c
qhalf/qhalf.c
qdelaunay/qdelaunay.c
qvoronoi/qvoronoi.c
qhull/unix_r.c // Qhull and rbox applications using reentrant libqhullstatic_r.a
rbox/rbox_r.c
qconvex/qconvex_r.c // Qhull applications built with reentrant libqhull_r/Makefile
qhalf/qhalf_r.c
qdelaunay/qdelaun_r.c
qvoronoi/qvoronoi_r.c
user_eg/user_eg_r.c // example of using qhull_r.dll from a user program
user_eg2/user_eg2_r.c // example of using libqhullstatic_r.a from a user program
user_eg3/user_eg3_r.cpp // example of Qhull's C++ interface libqhullcpp with libqhullstatic_r.a
qhulltest/qhulltest.cpp // Test of Qhull's C++ interface using Qt's QTestLib
qhull-*.pri // Include files for Qt projects
testqset_r/testqset_r.c // Test of reentrant qset_r.c and mem_r.c
testqset/testqset.c // Test of non-rentrant qset.c and mem.c
src/libqhull
libqhull.pro // Qt project for non-rentrant, shared library (qhull.dll)
index.htm // design documentation for libqhull
qh-*.htm
qhull-exports.def // Export Definition file for Visual C++
Makefile // Simple gcc Makefile for qhull and libqhullstatic.a
Mborland // Makefile for Borland C++ 5.0
libqhull.h // header file for qhull
user.h // header file of user definable constants
libqhull.c // Quickhull algorithm with partitioning
user.c // user re-definable functions
usermem.c
userprintf.c
userprintf_rbox.c
qhull_a.h // include files for libqhull/*.c
geom.c // geometric routines
geom2.c
geom.h
global.c // global variables
io.c // input-output routines
io.h
mem.c // memory routines, this is stand-alone code
mem.h
merge.c // merging of non-convex facets
merge.h
poly.c // polyhedron routines
poly2.c
poly.h
qset.c // set routines, this only depends on mem.c
qset.h
random.c // utilities w/ Park & Miller's random number generator
random.h
rboxlib.c // point set generator for rbox
stat.c // statistics
stat.h
src/libqhull_r
libqhull_r.pro // Qt project for rentrant, shared library (qhull_r.dll)
index.htm // design documentation for libqhull_r
qh-*_r.htm
qhull-exports_r.def // Export Definition file for Visual C++
Makefile // Simple gcc Makefile for qhull and libqhullstatic.a
libqhull_r.h // header file for qhull
user_r.h // header file of user definable constants
libqhull_r.c // Quickhull algorithm wi_r.hpartitioning
user_r.c // user re-definable functions
usermem.c
userprintf.c
userprintf_rbox.c
qhull_ra.h // include files for libqhull/*_r.c
geom_r.c // geometric routines
geom2.c
geom_r.h
global_r.c // global variables
io_r.c // input-output routines
io_r.h
mem_r.c // memory routines, this is stand-alone code
mem.h
merge_r.c // merging of non-convex facets
merge.h
poly_r.c // polyhedron routines
poly2.c
poly_r.h
qset_r.c // set routines, this only depends on mem_r.c
qset.h
random_r.c // utilities w/ Park & Miller's random number generator
random.h
rboxlib_r.c // point set generator for rbox
stat_r.c // statistics
stat.h
src/libqhullcpp/
libqhullcpp.pro // Qt project for renentrant, static C++ library
Qhull.cpp // Calls libqhull_r.c from C++
Qhull.h
qt-qhull.cpp // Supporting methods for Qt
Coordinates.cpp // input classes
Coordinates.h
PointCoordinates.cpp
PointCoordinates.h
RboxPoints.cpp // call rboxlib.c from C++
RboxPoints.h
QhullFacet.cpp // data structure classes
QhullFacet.h
QhullHyperplane.cpp
QhullHyperplane.h
QhullPoint.cpp
QhullPoint.h
QhullQh.cpp
QhullRidge.cpp
QhullRidge.h
QhullVertex.cpp
QhullVertex.h
QhullFacetList.cpp // collection classes
QhullFacetList.h
QhullFacetSet.cpp
QhullFacetSet.h
QhullIterator.h
QhullLinkedList.h
QhullPoints.cpp
QhullPoints.h
QhullPointSet.cpp
QhullPointSet.h
QhullSet.cpp
QhullSet.h
QhullSets.h
QhullVertexSet.cpp
QhullVertexSet.h
functionObjects.h // supporting classes
QhullError.cpp
QhullError.h
QhullQh.cpp
QhullQh.h
QhullStat.cpp
QhullStat.h
RoadError.cpp // Supporting base classes
RoadError.h
RoadLogEvent.cpp
RoadLogEvent.h
usermem_r-cpp.cpp // Optional override for qh_exit() to throw an error
src/libqhullstatic/
libqhullstatic.pro // Qt project for non-reentrant, static library
src/libqhullstatic_r/
libqhullstatic_r.pro // Qt project for reentrant, static library
src/qhulltest/
qhulltest.pro // Qt project for test of C++ interface
Coordinates_test.cpp // Test of each class
PointCoordinates_test.cpp
Qhull_test.cpp
QhullFacet_test.cpp
QhullFacetList_test.cpp
QhullFacetSet_test.cpp
QhullHyperplane_test.cpp
QhullLinkedList_test.cpp
QhullPoint_test.cpp
QhullPoints_test.cpp
QhullPointSet_test.cpp
QhullRidge_test.cpp
QhullSet_test.cpp
QhullVertex_test.cpp
QhullVertexSet_test.cpp
RboxPoints_test.cpp
RoadTest.cpp // Run multiple test files with QTestLib
RoadTest.h
-----------------
Authors:
C. Bradford Barber Hannu Huhdanpaa (Version 1.0)
bradb@shore.net hannu@qhull.org
Qhull 1.0 and 2.0 were developed under NSF grants NSF/DMS-8920161
and NSF-CCR-91-15793 750-7504 at the Geometry Center and Harvard
University. If you find Qhull useful, please let us know.

32
xs/src/qhull/REGISTER.txt Normal file
View File

@ -0,0 +1,32 @@
Dear Qhull User
We would like to find out how you are using our software. Think of
Qhull as a new kind of shareware: you share your science and successes
with us, and we share our software and support with you.
If you use Qhull, please send us a note telling
us what you are doing with it.
We need to know:
(1) What you are working on - an abstract of your work would be
fine.
(2) How Qhull has helped you, for example, by increasing your
productivity or allowing you to do things you could not do
before. If Qhull had a direct bearing on your work, please
tell us about this.
We encourage you to cite Qhull in your publications.
To cite Qhull, please use
Barber, C.B., Dobkin, D.P., and Huhdanpaa, H.T., "The Quickhull
algorithm for convex hulls," ACM Trans. on Mathematical Software,
22(4):469-483, Dec 1996, http://www.qhull.org.
Please send e-mail to
bradb@shore.net
Thank you!

935
xs/src/qhull/html/index.htm Normal file
View File

@ -0,0 +1,935 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 2.0">
<title>Qhull manual</title>
<!-- Navigation links
NOTE -- verify all links by 'grep href=' 'grep name=' add # 'sort /+7'
index.htm
-->
</head>
<body>
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b><a
href="http://www.qhull.org/news">News</a> about Qhull<br>
<b>Up:</b> <a href="http://www.qhull.org/html/qh-faq.htm">FAQ</a> about Qhull<br>
<b>To:</b> <a href="#TOC">Qhull manual: Table of Contents</a>
(please wait while loading) <br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/fixed.html"><img
src="qh--rand.gif" alt="[random-fixed]" align="middle"
width="100" height="100"></a> Qhull manual </h1>
<p>Qhull is a general dimension code for computing convex hulls,
Delaunay triangulations, halfspace intersections about a point, Voronoi
diagrams, furthest-site Delaunay triangulations, and
furthest-site Voronoi diagrams. These structures have
applications in science, engineering, statistics, and
mathematics. See <a
href="http://www.cs.mcgill.ca/~fukuda/soft/polyfaq/polyfaq.html">Fukuda's
introduction</a> to convex hulls, Delaunay triangulations,
Voronoi diagrams, and linear programming. For a detailed
introduction, see O'Rourke [<a href="#orou94">'94</a>], <i>Computational
Geometry in C</i>.
</p>
<p>There are six programs. Except for rbox, they use
the same code. Each program includes instructions and examples.
<blockquote>
<ul>
<li><a href="qconvex.htm">qconvex</a> -- convex hulls
<li><a href="qdelaun.htm">qdelaunay</a> -- Delaunay triangulations and
furthest-site Delaunay triangulations
<li><a href="qhalf.htm">qhalf</a> -- halfspace intersections about a point
<li><a href="qhull.htm">qhull</a> -- all structures with additional options
<li><a href="qvoronoi.htm">qvoronoi</a> -- Voronoi diagrams and
furthest-site Voronoi diagrams
<li><a href="rbox.htm">rbox</a> -- generate point distributions for qhull
</ul>
</blockquote>
<p>Qhull implements the Quickhull algorithm for computing the
convex hull. Qhull includes options
for hull volume, facet area, multiple output formats, and
graphical output. It can approximate a convex hull. </p>
<p>Qhull handles roundoff errors from floating point
arithmetic. It generates a convex hull with "thick" facets.
A facet's outer plane is clearly above all of the points;
its inner plane is clearly below the facet's vertices. Any
exact convex hull must lie between the inner and outer plane.
<p>Qhull uses merged facets, triangulated output, or joggled
input. Triangulated output triangulates non-simplicial, merged
facets. Joggled input also
guarantees simplicial output, but it
is less accurate than merged facets. For merged facets, Qhull
reports the maximum outer and inner plane.
<p><i>Brad Barber, Arlington, MA</i></p>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<h2><a href="#TOP">&#187;</a><a name="TOC">Qhull manual: Table of
Contents </a></h2>
<ul>
<li><a href="#when">When</a> to use Qhull
<ul>
<li><a href="http://www.qhull.org/news">News</a> for Qhull
with new features and reported bugs.
<li><a href="http://www.qhull.org">Home</a> for Qhull with additional URLs
(<a href=index.htm>local copy</a>)
<li><a href="http://www.qhull.org/html/qh-faq.htm">FAQ</a> for Qhull (<a href="qh-faq.htm">local copy</a>)
<li><a href="http://www.qhull.org/download">Download</a> Qhull (<a href=qh-get.htm>local copy</a>)
<li><a href="qh-quick.htm#programs">Quick</a> reference for Qhull and its <a href="qh-quick.htm#options">options</a>
<p>
<li><a href="../COPYING.txt">COPYING.txt</a> - copyright notice<br>
<li><a href="../REGISTER.txt">REGISTER.txt</a> - registration<br>
<li><a href="../README.txt">README.txt</a> - installation
instructions<br>
<li><a href="../src/Changes.txt">Changes.txt</a> - change history <br>
<li><a href="qhull.txt">qhull.txt</a> - Unix manual page
</ul>
<p>
<li><a href="#description">Description</a> of Qhull
<ul>
<li><a href="#definition">de</a>finition &#149; <a
href="#input">in</a>put &#149; <a href="#output">ou</a>tput
&#149; <a href="#algorithm">al</a>gorithm &#149; <a
href="#structure">da</a>ta structure </li>
<li><a href="qh-impre.htm">Imprecision</a> in Qhull</li>
<li><a href="qh-impre.htm#joggle">Merged facets</a> or joggled input
<li><a href="qh-eg.htm">Examples</a> of Qhull</li>
</ul>
<p>
<li><a href=qh-quick.htm#programs>Qhull programs</a>, with instructions and examples
<ul>
<li><a href="qconvex.htm">qconvex</a> -- convex hulls
<li><a href="qdelaun.htm">qdelaunay</a> -- Delaunay triangulations and
furthest-site Delaunay triangulations
<li><a href="qhalf.htm">qhalf</a> -- halfspace intersections about a point
<li><a href="qhull.htm">qhull</a> -- all structures with additional options
<li><a href="qvoronoi.htm">qvoronoi</a> -- Voronoi diagrams and
furthest-site Voronoi diagrams
<li><a href="rbox.htm">rbox</a> -- generate point distributions for qhull
</ul>
<p>
<li><a href="qh-quick.htm#options">Qhull options</a><ul>
<li><a href="qh-opto.htm#output">Output</a> formats</li>
<li><a href="qh-optf.htm#format">Additional</a> I/O
formats</li>
<li><a href="qh-optg.htm#geomview">Geomview</a>
output options</li>
<li><a href="qh-optp.htm#print">Print</a> options</li>
<li><a href="qh-optq.htm#qhull">Qhull</a> control
options</li>
<li><a href="qh-optc.htm#prec">Precision</a> options</li>
<li><a href="qh-optt.htm#trace">Trace</a> options</li>
</ul>
</li>
<p>
<li><a href="#geomview">Geomview</a>, Qhull's graphical viewer</li>
<ul>
<li><a href="#geomview-install">Installing Geomview</a></li>
<li><a href="#geomview-use">Using Geomview</a></li>
<li><a href="#geomview-win">Building Geomview for Windows</a></li>
</ul>
<p>
<li><a href="qh-code.htm">Qhull internals</a><ul>
<li><a href="qh-code.htm#reentrant">Reentrant</a> Qhull</li>
<li><a href="qh-code.htm#convert">How to convert</a> code to reentrant Qhull</li>
<li><a href="qh-code.htm#64bit">Qhull</a> on 64-bit computers</li>
<li><a href="qh-code.htm#cpp">Calling</a> Qhull
from C++ programs</li>
<li><a href="qh-code.htm#library">Calling</a> Qhull
from C programs</li>
<li><a href="qh-code.htm#performance">Performance</a>
of Qhull</li>
<li><a href="qh-code.htm#enhance">Enhancements</a> to
Qhull</li>
<li><a href="../src/libqhull_r/index.htm">Reentrant</a> Qhull functions, macros, and
data structures </li>
<li><a href="../src/libqhull/index.htm">Qhull</a> functions, macros, and
data structures </li>
</ul>
</li>
<p>
<li>Related URLs
<ul>
<li><a href="news:comp.graphics.algorithms">Newsgroup</a>:
comp.graphics.algorithms
<li><a
href="http://www.faqs.org/faqs/graphics/algorithms-faq/">FAQ</a> for computer graphics algorithms and
Exaflop's <a href="http://exaflop.org/docs/cgafaq/cga6.html">geometric</a> structures.
<li>Amenta's <a href="http://www.geom.uiuc.edu/software/cglist">Directory
of Computational Geometry Software </a></li>
<li>Erickson's <a
href="http://compgeom.cs.uiuc.edu/~jeffe/compgeom/code.html">Computational
Geometry Software</a> </li>
<li>Fukuda's <a
href="http://www.cs.mcgill.ca/~fukuda/soft/polyfaq/polyfaq.html">
introduction</a> to convex hulls, Delaunay triangulations,
Voronoi diagrams, and linear programming.
<li>Stony Brook's <a
href="http://www.cs.sunysb.edu/~algorith/major_section/1.6.shtml">Algorithm Repository</a> on computational geometry.
</li>
</ul>
<p>
<li><a href="#bugs">What to do</a> if something goes wrong</li>
<li><a href="#email">Email</a></li>
<li><a href="#authors">Authors</a></li>
<li><a href="#ref">References</a></li>
<li><a href="#acknowledge">Acknowledgments</a></li>
</ul>
<h2><a href="#TOC">&#187;</a><a name="when">When to use Qhull</a></h2>
<blockquote>
<p>Qhull constructs convex hulls, Delaunay triangulations,
halfspace intersections about a point, Voronoi diagrams, furthest-site Delaunay
triangulations, and furthest-site Voronoi diagrams.</p>
<p>For convex hulls and halfspace intersections, Qhull may be used
for 2-d upto 8-d. For Voronoi diagrams and Delaunay triangulations, Qhull may be
used for 2-d upto 7-d. In higher dimensions, the size of the output
grows rapidly and Qhull does not work well with virtual memory.
If <i>n</i> is the size of
the input and <i>d</i> is the dimension (d>=3), the size of the output
and execution time
grows by <i>n^(floor(d/2)</i>
[see <a href=qh-code.htm#performance>Performance</a>]. For example, do
not try to build a 16-d convex hull of 1000 points. It will
have on the order of 1,000,000,000,000,000,000,000,000 facets.
<p>On a 600 MHz Pentium 3, Qhull computes the 2-d convex hull of
300,000 cocircular points in 11 seconds. It computes the
2-d Delaunay triangulation and 3-d convex hull of 120,000 points
in 12 seconds. It computes the
3-d Delaunay triangulation and 4-d convex hull of 40,000 points
in 18 seconds. It computes the
4-d Delaunay triangulation and 5-d convex hull of 6,000 points
in 12 seconds. It computes the
5-d Delaunay triangulation and 6-d convex hull of 1,000 points
in 12 seconds. It computes the
6-d Delaunay triangulation and 7-d convex hull of 300 points
in 15 seconds. It computes the
7-d Delaunay triangulation and 8-d convex hull of 120 points
in 15 seconds. It computes the
8-d Delaunay triangulation and 9-d convex hull of 70 points
in 15 seconds. It computes the
9-d Delaunay triangulation and 10-d convex hull of 50 points
in 17 seconds. The 10-d convex hull of 50 points has about 90,000 facets.
<!-- duplicated in index.htm and html/index.htm -->
<p>Qhull does <i>not</i> support constrained Delaunay
triangulations, triangulation of non-convex surfaces, mesh
generation of non-convex objects, or medium-sized inputs in 9-D
and higher. </p>
<p>This is a big package with many options. It is one of the
fastest available. It is the only 3-d code that handles precision
problems due to floating point arithmetic. For example, it
implements the identity function for extreme points (see <a
href="qh-impre.htm">Imprecision in Qhull</a>). </p>
<p>[2016] A newly discovered, bad case for Qhull is multiple, nearly incident points within a 10^-13 ball of 3-d and higher
Delaunay triangulations (input sites in the unit cube). Nearly incident points within substantially
smaller or larger balls are OK. Error QH6271 is reported if a problem occurs. A future release of Qhull
will handle this case. For more information, see "Nearly coincident points on an edge" in <a href="../html/qh-impre.htm#limit">Limitations of merged facets</a>
<p>If you need a short code for convex hull, Delaunay
triangulation, or Voronoi volumes consider Clarkson's <a
href="http://www.netlib.org/voronoi/hull.html">hull
program</a>. If you need 2-d Delaunay triangulations consider
Shewchuk's <a href="http://www.cs.cmu.edu/~quake/triangle.html">triangle
program</a>. It is much faster than Qhull and it allows
constraints. Both programs use exact arithmetic. They are in <a
href="http://www.netlib.org/voronoi/">http://www.netlib.org/voronoi/</a>.
<p>If your input is in general position (i.e., no coplanar or colinear points),
<li><a href="https://github.com/tomilov/quickhull/blob/master/include/quickhull.hpp">Tomilov's quickhull.hpp</a> (<a href"http://habrahabr.ru/post/245221/"documentation-ru</a/>)
or Qhull <a
href="http://www.qhull.org/download">version
1.0</a> may meet your needs. Both programs detect precision problems,
but do not handle them.</p>
<p><a href=http://www.cgal.org>CGAL</a> is a library of efficient and reliable
geometric algorithms. It uses C++ templates and the Boost library to produce dimension-specific
code. This allows more efficient use of memory than Qhull's general-dimension
code. CGAL simulates arbitrary precision while Qhull handles round-off error
with thick facets. Compare the two approaches with <a href="http://doc.cgal.org/latest/Manual/devman_robustness.html">Robustness Issues in CGAL</a>,
and <a href+"qh-impre.htm">Imprecision in Qhull</a>.
<p><a href=http://www.algorithmic-solutions.com/enleda.htm>Leda</a> is a
library for writing computational
geometry programs and other combinatorial algorithms. It
includes routines for computing 3-d convex
hulls, 2-d Delaunay triangulations, and 3-d Delaunay triangulations.
It provides rational arithmetic and graphical output. It runs on most
platforms.
<p>If your problem is in high dimensions with a few,
non-simplicial facets, try Fukuda's <a
href="http://www.cs.mcgill.ca/~fukuda/soft/cdd_home/cdd.html">cdd</a>.
It is much faster than Qhull for these distributions. </p>
<p>Custom software for 2-d and 3-d convex hulls may be faster
than Qhull. Custom software should use less memory. Qhull uses
general-dimension data structures and code. The data structures
support non-simplicial facets.</p>
<p>Qhull is not suitable for mesh generation or triangulation of
arbitrary surfaces. You may use Qhull if the surface is convex or
completely visible from an interior point (e.g., a star-shaped
polyhedron). First, project each site to a sphere that is
centered at the interior point. Then, compute the convex hull of
the projected sites. The facets of the convex hull correspond to
a triangulation of the surface. For mesh generation of arbitrary
surfaces, see <a
href="http://www.robertschneiders.de/meshgeneration/meshgeneration.html">Schneiders'
Finite Element Mesh Generation</a>.</p>
<p>Qhull is not suitable for constrained Delaunay triangulations.
With a lot of work, you can write a program that uses Qhull to
add constraints by adding additional points to the triangulation.</p>
<p>Qhull is not suitable for the subdivision of arbitrary
objects. Use <tt>qdelaunay</tt> to subdivide a convex object.</p>
</blockquote>
<h2><a href="#TOC">&#187;</a><a name="description">Description of
Qhull </a></h2>
<blockquote>
<h3><a href="#TOC">&#187;</a><a name="definition">definition</a></h3>
<blockquote>
<p>The <i>convex hull</i> of a point set <i>P</i> is the smallest
convex set that contains <i>P</i>. If <i>P</i> is finite, the
convex hull defines a matrix <i>A</i> and a vector <i>b</i> such
that for all <i>x</i> in <i>P</i>, <i>Ax+b &lt;= [0,...]</i>. </p>
<p>Qhull computes the convex hull in 2-d, 3-d, 4-d, and higher
dimensions. Qhull represents a convex hull as a list of facets.
Each facet has a set of vertices, a set of neighboring facets,
and a halfspace. A halfspace is defined by a unit normal and an
offset (i.e., a row of <i>A</i> and an element of <i>b</i>). </p>
<p>Qhull accounts for round-off error. It returns
&quot;thick&quot; facets defined by two parallel hyperplanes. The
outer planes contain all input points. The inner planes exclude
all output vertices. See <a href="qh-impre.htm#imprecise">Imprecise
convex hulls</a>.</p>
<p>Qhull may be used for the Delaunay triangulation or the
Voronoi diagram of a set of points. It may be used for the
intersection of halfspaces. </p>
</blockquote>
<h3><a href="#TOC">&#187;</a><a name="input">input format</a></h3>
<blockquote>
<p>The input data on <tt>stdin</tt> consists of:</p>
<ul>
<li>first line contains the dimension</li>
<li>second line contains the number of input points</li>
<li>remaining lines contain point coordinates</li>
</ul>
<p>For example: </p>
<pre>
3 #sample 3-d input
5
0.4 -0.5 1.0
1000 -1e-5 -100
0.3 0.2 0.1
1.0 1.0 1.0
0 0 0
</pre>
<p>Input may be entered by hand. End the input with a control-D
(^D) character. </p>
<p>To input data from a file, use I/O redirection or '<a
href="qh-optt.htm#TI">TI file</a>'. The filename may not
include spaces or quotes.</p>
<p>A comment starts with a non-numeric character and continues to
the end of line. The first comment is reported in summaries and
statistics. With multiple <tt>qhull</tt> commands, use option '<a
href="qh-optf.htm#FQ">FQ</a>' to place a comment in the output.</p>
<p>The dimension and number of points can be reversed. Comments
and line breaks are ignored. Error reporting is better if there
is one point per line.</p>
</blockquote>
<h3><a href="#TOC">&#187;</a><a name="option">option format</a></h3>
<blockquote>
<p>Use options to specify the output formats and control
Qhull. The <tt>qhull</tt> program takes all options. The
other programs use a subset of the options. They disallow
experimental and inappropriate options.
<blockquote>
<ul>
<li>
qconvex == qhull
<li>
qdelaunay == qhull d Qbb
<li>
qhalf == qhull H
<li>
qvoronoi == qhull v Qbb
</ul>
</blockquote>
<p>Single letters are used for output formats and precision
constants. The other options are grouped into menus for formats
('<a href="qh-optf.htm#format">F</a>'), Geomview ('<a
href="qh-optg.htm#geomview">G </a>'), printing ('<a
href="qh-optp.htm#print">P</a>'), Qhull control ('<a
href="qh-optq.htm#qhull">Q </a>'), and tracing ('<a
href="qh-optt.htm#trace">T</a>'). The menu options may be listed
together (e.g., 'GrD3' for 'Gr' and 'GD3'). Options may be in any
order. Capitalized options take a numeric argument (except for '<a
href="qh-optp.htm#PG">PG</a>' and '<a href="qh-optf.htm#format">F</a>'
options). Use option '<a href="qh-optf.htm#FO">FO</a>' to print
the selected options.</p>
<p>Qhull uses zero-relative indexing. If there are <i>n</i>
points, the index of the first point is <i>0</i> and the index of
the last point is <i>n-1</i>.</p>
<p>The default options are:</p>
<ul>
<li>summary output ('<a href="qh-opto.htm#s">s</a>') </li>
<li>merged facets ('<a href="qh-optc.htm#C0">C-0</a>' in 2-d,
3-d, 4-d; '<a href="qh-optq.htm#Qx">Qx</a>' in 5-d and
up)</li>
</ul>
<p>Except for bounding box
('<a href="qh-optq.htm#Qbk">Qbk:n</a>', etc.), drop facets
('<a href="qh-optp.htm#Pdk">Pdk:n</a>', etc.), and
Qhull command ('<a href="qh-optf.htm#FQ">FQ</a>'), only the last
occurence of an option counts.
Bounding box and drop facets may be repeated for each dimension.
Option 'FQ' may be repeated any number of times.
<p>The Unix <tt>tcsh</tt> and <tt>ksh </tt>shells make it easy to
try out different options. In Windows 95, use a command window with <tt>doskey</tt>
and a window scroller (e.g., <tt>peruse</tt>). </p>
</blockquote>
<h3><a href="#TOC">&#187;</a><a name="output">output format</a></h3>
<blockquote>
<p>To write the results to a file, use I/O redirection or '<a
href="qh-optt.htm#TO">TO file</a>'. Windows 95 users should use
'TO file' or the console. If a filename is surrounded by single quotes,
it may include spaces.
</p>
<p>The default output option is a short summary ('<a
href="qh-opto.htm#s">s</a>') to <tt>stdout</tt>. There are many
others (see <a href="qh-opto.htm">output</a> and <a
href="qh-optf.htm">formats</a>). You can list vertex incidences,
vertices and facets, vertex coordinates, or facet normals. You
can view Qhull objects with Geomview, Mathematica, or Maple. You can
print the internal data structures. You can call Qhull from your
application (see <a href="qh-code.htm#library">Qhull library</a>).</p>
<p>For example, 'qhull <a href="qh-opto.htm#o">o</a>' lists the
vertices and facets of the convex hull. </p>
<p>Error messages and additional summaries ('<a
href="qh-opto.htm#s">s</a>') go to <tt>stderr</tt>. Unless
redirected, <tt>stderr</tt> is the console.</p>
</blockquote>
<h3><a href="#TOC">&#187;</a><a name="algorithm">algorithm</a></h3>
<blockquote>
<p>Qhull implements the Quickhull algorithm for convex hull
[Barber et al. <a href="#bar-dob96">'96</a>]. This algorithm
combines the 2-d Quickhull algorithm with the <em>n</em>-d
beneath-beyond algorithm [c.f., Preparata &amp; Shamos <a
href="#pre-sha85">'85</a>]. It is similar to the randomized
algorithms of Clarkson and others [Clarkson &amp; Shor <a
href="#cla-sho89">'89</a>; Clarkson et al. <a href="#cla-meh93">'93</a>;
Mulmuley <a href="#mulm94">'94</a>]. For a demonstration, see <a
href="qh-eg.htm#how">How Qhull adds a point</a>. The main
advantages of Quickhull are output sensitive performance (in
terms of the number of extreme points), reduced space
requirements, and floating-point error handling. </p>
</blockquote>
<h3><a href="#TOC">&#187;</a><a name="structure">data structures</a></h3>
<blockquote>
<p>Qhull produces the following data structures for dimension <i>d</i>:
</p>
<ul>
<li>A <em>coordinate</em> is a real number in floating point
format. </li>
<li>A <em>point</em> is an array of <i>d</i> coordinates.
With option '<a href="qh-optq.htm#QJn">QJ</a>', the
coordinates are joggled by a small amount. </li>
<li>A <em>vertex</em> is an input point. </li>
<li>A <em>hyperplane</em> is <i>d</i> normal coefficients and
an offset. The length of the normal is one. The
hyperplane defines a halfspace. If <i>V</i> is a normal, <i>b</i>
is an offset, and <i>x</i> is a point inside the convex
hull, then <i>Vx+b &lt;0</i>.</li>
<li>An <em>outer plane</em> is a positive
offset from a hyperplane. When Qhull is done, all points
will be below all outer planes.</li>
<li>An <em>inner plane</em> is a negative
offset from a hyperplane. When Qhull is done, all
vertices will be above the corresponding inner planes.</li>
<li>An <em>orientation</em> is either 'top' or 'bottom'. It is the
topological equivalent of a hyperplane's geometric
orientation. </li>
<li>A <em>simplicial facet</em> is a set of
<i>d</i> neighboring facets, a set of <i>d</i> vertices, a
hyperplane equation, an inner plane, an outer plane, and
an orientation. For example in 3-d, a simplicial facet is
a triangle. </li>
<li>A <em>centrum</em> is a point on a facet's hyperplane. A
centrum is the average of a facet's vertices. Neighboring
facets are <em>convex</em> if each centrum is below the
neighbor facet's hyperplane. </li>
<li>A <em>ridge</em> is a set of <i>d-1</i> vertices, two
neighboring facets, and an orientation. For example in
3-d, a ridge is a line segment. </li>
<li>A <em>non-simplicial facet</em> is a set of ridges, a
hyperplane equation, a centrum, an outer plane, and an
inner plane. The ridges determine a set of neighboring
facets, a set of vertices, and an orientation. Qhull
produces a non-simplicial facet when it merges two facets
together. For example, a cube has six non-simplicial
facets. </li>
</ul>
<p>For examples, use option '<a href="qh-opto.htm#f">f</a>'. See <a
href="../src/libqhull/qh-poly.htm">polyhedron operations</a> for further
design documentation. </p>
</blockquote>
<h3><a href="#TOC">&#187;</a>Imprecision in Qhull</h3>
<blockquote>
<p>See <a href="qh-impre.htm">Imprecision in Qhull</a> and <a href="qh-impre.htm#joggle">Merged facets or joggled input</a></p>
</blockquote>
<h3><a href="#TOC">&#187;</a>Examples of Qhull</h3>
<blockquote>
<p>See <a href="qh-eg.htm">Examples of Qhull</a>. Most of these examples require <a href="#geomview">Geomview</a>.
Some of the examples have <a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/welcome.html">pictures
</a>.</p>
</blockquote>
</blockquote>
<h2><a href="#TOC">&#187;</a>Options for using Qhull </h2>
<blockquote>
<p>See <a href="qh-quick.htm#options">Options</a>.</p>
</blockquote>
<h2><a href="#TOC">&#187;</a>Qhull internals </h2>
<blockquote>
<p>See <a href="qh-code.htm">Internals</a>.</p>
</blockquote>
<h2><a href="#TOC">&#187;</a><a name="geomview">Geomview, Qhull's
graphical viewer</a></h2>
<blockquote>
<p><a href="http://www.geomview.org">Geomview</a>
is an interactive geometry viewing program.
Geomview provides a good visualization of Qhull's 2-d and 3-d results.
<p>Qhull includes <a href="qh-eg.htm">Examples of Qhull</a> that may be viewed with Geomview.
<p>Geomview can help visulalize a 3-d Delaunay triangulation or the surface of a 4-d convex hull,
Use option '<a href="qh-optq.htm#QVn">QVn</a>' to select the 3-D facets adjacent to a vertex.
<p>You may use Geomview to create movies that animate your objects (c.f., <a href="http://www.geomview.org/FAQ/answers.shtml#mpeg">How can I create a video animation?</a>).
Geomview helped create the <a href="http://www.geom.uiuc.edu/video/">mathematical videos</a> "Not Knot", "Outside In", and "The Shape of Space" from the Geometry Center.
<h3><a href="#TOC">&#187;</a><a name="geomview-install">Installing Geomview</a></h3>
<blockquote>
<p>Geomview is an <a href=http://sourceforge.net/projects/geomview>open source project</a>
under SourceForge.
<p>
For build instructions see
<a href="http://www.geomview.org/download/">Downloading Geomview</a>.
Geomview builds under Linux, Unix, Macintosh OS X, and Windows.
<p>Geomview has <a href="https://packages.debian.org/search?keywords=geomview">installable packages</a> for Debian and Ubuntu.
The OS X build needs Xcode, an X11 SDK, and Lesstif or Motif.
The Windows build uses Cygwin (see <a href="#geomview-win">Building Geomview</a> below for instructions).
<p>If using Xforms (e.g., for Geomview's <a href="http://www.geomview.org/docs/html/Modules.html">External Modules</a>), install the 'libXpm-devel' package from cygwin and move the xforms directory into your geomview directory, e.g.,<br><tt>mv xforms-1.2.4 geomview-1.9.5/xforms</tt>
<p>Geomview's <a href="http://www.geom.uiuc.edu/software/geomview/docs/NDview/manpagehelp.html">ndview<a/> provides multiple views into 4-d and higher objects.
This module is out-of-date (<a href="http://sourceforge.net/p/geomview/mailman/message/2004152/">geomview-users: 4dview</a>).
Download NDview-sgi.tar.Z at <a href="ftp://www.geom.uiuc.edu/pub/software/geomview/newpieces/sgi">newpieces</a> and 4dview at <a href="https://stuff.mit.edu/afs/sipb/project/3d/arch/sgi_62/lib/Geomview/modules/">Geomview/modules</a>.
</blockquote>
<h3><a href="#TOC">&#187;</a><a name="geomview-use">Using Geomview</a></h3>
<blockquote>
<p>Use Geomview to view <a href="qh-eg.htm">Examples of Qhull</a>. You can spin the convex hull, fly a camera through its facets,
and see how Qhull produces thick facets in response to round-off error.
<p>Follow these instructions to view 'eg,01.cube' from Examples of Qhull
<ol>
<li>Launch an XTerm command shell
<ul>
<li>If needed, start the X terminal server, Use 'xinit' or 'startx' in /usr/X11R6/bin<br><tt>xinit -- -multiwindow -clipboard</tt><br><tt>startx</tt>
<li>Start an XTerm command shell. In Windows, click the Cygwin/bash icon on your desktop.
<li>Set the DISPLAY variable, e.g.,<br><tt>export DISPLAY=:0</tt><br><tt>export DISPLAY=:0 >>~/.bashenv</tt>
</ul>
<li>Use Qhull's <a href="qh-optg.htm">Geomview options</a> to create a geomview object
<ul>
<li><tt>rbox c D3 | qconvex G >eg.01.cube</tt>
<li>On windows, convert the output to Unix text format with 'd2u'<br><tt>rbox c D3 | qconvex G | d2u >eg.01.cube</tt><br><tt>d2u eg.*</tt>
</ul>
<li>Run Geomview
<ul>
<li>Start Geomview with your example<br><tt>./geomview eg.01.cube</tt>
<li>Follow the instructions in <a href="http://www.geomview.org/docs/html/Tutorial.html">Gemoview Tutorial</a>
<li>Geomview creates the <i>Geomview control panel</i> with Targets and External Module, the <i>Geomview toolbar</i> with buttons for controlling Geomview, and the <i>Geomview camera window</i> showing a cube.
<li>Clear the camera window by selecting your object in the Targets list and 'Edit > Delete' or 'dd'
<li>Load the <i>Geomview files panel</i>. Select 'Open' in the 'File' menu.
<li>Set 'Filter' in the files panel to your example directory followed by '/*' (e.g., '/usr/local/qhull-2015.2/eg/*')
<li>Click 'Filter' in the files panel to view your examples in the 'Files' list.
<li>Load another example into the camera window by selecting it and clicking 'OK'.
<li>Review the instructions for <a href="http://www.geomview.org/docs/html/Interaction.html">Interacting with Geomview</a>
<li>When viewing multiple objects at once, you may want to turn off normalization. In the 'Inspect > Apperance' control panel, set 'Normalize' to 'None'.
</ul>
</ol>
<p>Geomview defines GCL (a textual API for controlling Geomview) and OOGL (a textual file format for defining objects).
<ul>
<li>To control Geomview, you may use any program that reads and writes from stdin and stdout. For example, it could report Qhull's information about a vertex identified by a double-click 'pick' event.
<li><a href="http://www.geomview.org/docs/html/GCL.html">GCL</a> command language for controlling Geomview
<li><a href="http://www.geomview.org/docs/html/OOGL-File-Formats.html">OOGL</a> file format for defining objects (<a href="http://www.geomview.org/docs/oogltour.html">tutorial</a>).
<li><a href="http://www.geomview.org/docs/html/Modules.html">External Modules</a> for interacting with Geomview via GCL
<li>Interact with your objects via <a href="http://www.geomview.org/docs/html/pick.html">pick</a> commands in response to right-mouse double clicks. Enable pick events with the <a href="http://www.geomview.org/docs/html/interest.html">interest</a> command.
</ul>
</blockquote>
<h3><a href="#TOC">&#187;</a><a name="geomview-win">Building Geomview for Windows</a></h3>
<blockquote>
<p>Compile Geomview under Cygwin. For detailed instructions, see
<a href="http://www.ee.surrey.ac.uk/Personal/L.Wood/software/SaVi/building-under-Windows/"
>Building Savi and Geomview under Windows</a>. These instructions are somewhat out-of-date. Updated
instructions follow.
<p>How to compile Geomview under 32-bit Cygwin (October 2015)</p>
<ol>
<li><b>Note:</b> L. Wood has run into multiple issues with Geomview on Cygwin. He recommends Virtualbox/Ubuntu
and a one-click install of geomview via the Ubuntu package. See his Savi/Geomview link above.
<li>Install 32-bit <a href="http://cygwin.com/">Cygwin</a> as follows.
For additional guidance, see Cygwin's <a href="https://cygwin.com/install.html">Installing and Updating Cygwin Packages</a>
and <a href="http://www.qhull.org/road/road-faq/xml/cmdline.xml#setup-cygwin">Setup cygwin</a>.
<ul>
<li>Launch the cygwin installer.
<li>Select a mirror from <a href="http://cygwin.com/mirrors.html">Cygwin mirrors</a> (e.g., http://mirrors.kernel.org/sourceware/cygwin/ in California).
<li>Select the packages to install. Besides the cygwin packages listed in the Savi/Windows instructions consider adding
<ul>
<li><b>Default</b> -- libXm-devel (required for /usr/include/Xm/Xm.h)
<li><b>Devel</b> -- bashdb, gcc-core (in place of gcc), gdb
<li><b>Lib</b> -- libGL-devel, libGLU1 (required, obsolete), libGLU-devel (required, obsolete), libjpeg-devel(XForms), libXext-devel (required), libXpm-devel (Xforms)
libGL and lib
<li><b>Math</b> -- bc
<li><b>Net</b> -- autossh, inetutils, openssh
<li><b>System</b> -- chere
<li><b>Utils</b> -- dos2unix (required for qhull), keychain
<li>If installing perl, ActiveState Perl may be a better choice than cygwin's perl. Perl is not used by Geomview or Qhull.
<li><a href="https://cygwin.com/cgi-bin2/package-grep.cgi">Cygwin Package Search</a> -- Search for cygwin programs and packages
</ul>
<li>Click 'Next' to download and install the packages.
<li>If the download is incomplete, try again.
<li>If you try again after a successful install, cygwin will uninstall and reinstall all modules..
<li>Click on the 'Cywin Terminal' icon on the Desktop. It sets up a user directory in /home from /etc/skel/...
<li>Mount your disk drives<br>mount c: /c # Ignore the warning /c does not exist
</ul>
<li>Consider installing the <a href="http://www.qhull.org/bash/doc/road-bash.html">Road Bash</a> scripts (/etc/road-*) from <a href="http://www.qhull.org/road/">Road</a>.
They define aliases and functions for Unix command shells (Unix, Linux, Mac OS X, Windows),
<ul>
<li>Download Road Bash and unzip the downloaded file
<li>Copy .../bash/etc/road-* to the Cywin /etc directory (by default, C:\cygwin\etc).
<li>Using the cygwin terminal, convert the road scripts to Unix format<br>d2u /etc/road-*
<li>Try it<br>source /etc/road-home.bashrc
<li>Install it<br>cp /etc/road-home.bashrc ~/.bashrc
</ul>
<li>Launch the X terminal server from '<tt>Start > All programs > Cygwin-X > Xwin Server</tt>'. Alternatively, run 'startx'
<li>Launch an XTerm shell
<ul>
<li>Right click the Cywin icon on the system tray in the Windows taskbar.
<li>Select '<tt>System Tools > XTerm</tt>'
</ul>
<li>Download and extract Geomview -- <a href="http://www.geomview.org/download/">Downloading Geomview</a>
<li>Compile Geomview
<ul>
<li>./configure
<li>make
</ul>
<li>If './configure' fails, check 'config.log' at the failing step. Look carefully for missing libraries, etc. The <a href="http://www.geomview.org/FAQ/answers.shtml">Geomview FAQ</a> contains suggestions (e.g., "configure claims it can't find OpenGl").
<li>If 'make' fails, read the output carefully for error messages. Usually it is a missing include file or package. Locate and install the missing cygwin packages
(<a href="https://cygwin.com/cgi-bin2/package-grep.cgi">Cygwin Package Search</a>).
</ol>
</blockquote>
</blockquote>
<h2><a href="#TOC">&#187;</a><a name="bugs">What to do if something
goes wrong</a></h2>
<blockquote>
<p>Please report bugs to <a href=mailto:qhull_bug@qhull.org>qhull_bug@qhull.org</a>
</a>. Please report if Qhull crashes. Please report if Qhull
generates an &quot;internal error&quot;. Please report if Qhull
produces a poor approximate hull in 2-d, 3-d or 4-d. Please
report documentation errors. Please report missing or incorrect
links.</p>
<p>If you do not understand something, try a small example. The <a
href="rbox.htm">rbox</a> program is an easy way to generate
test cases. The <a href="#geomview">Geomview</a> program helps to
visualize the output from Qhull.</p>
<p>If Qhull does not compile, it is due to an incompatibility
between your system and ours. The first thing to check is that
your compiler is ANSI standard. Qhull produces a compiler error
if __STDC__ is not defined. You may need to set a flag (e.g.,
'-A' or '-ansi').</p>
<p>If Qhull compiles but crashes on the test case (rbox D4),
there's still incompatibility between your system and ours.
Sometimes it is due to memory management. This can be turned off
with qh_NOmem in mem.h. Please let us know if you figure out how
to fix these problems. </p>
<p>If you doubt the output from Qhull, add option '<a
href="qh-optt.htm#Tv">Tv</a>'. It checks that every point is
inside the outer planes of the convex hull. It checks that every
facet is convex with its neighbors. It checks the topology of the
convex hull.</p>
<p>Qhull should work on all inputs. It may report precision
errors if you turn off merged facets with option '<a
href="qh-optq.htm#Q0">Q0</a>'. This can get as bad as facets with
flipped orientation or two facets with the same vertices. You'll
get a long help message if you run into such a case. They are
easy to generate with <tt>rbox</tt>.</p>
<p>If you do find a problem, try to simplify it before reporting
the error. Try different size inputs to locate the smallest one
that causes an error. You're welcome to hunt through the code
using the execution trace ('<a href="qh-optt.htm#Tn">T4</a>') as
a guide. This is especially true if you're incorporating Qhull
into your own program. </p>
<p>When you report an error, please attach a data set to the end
of your message. Include the options that you used with Qhull,
the results of option '<a href="qh-optf.htm#FO">FO</a>', and any
messages generated by Qhull. This allows me to see the error for
myself. Qhull is maintained part-time. </p>
</blockquote>
<h2><a href="#TOC">&#187;</a><a name="email">Email</a></h2>
<blockquote>
<p>Please send correspondence to Brad Barber at <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
and report bugs to <a href=mailto:qhull_bug@qhull.org>qhull_bug@qhull.org</a>
</a>. Let me know how you use Qhull. If you mention it in a
paper, please send a reference and abstract.</p>
<p>If you would like to get Qhull announcements (e.g., a new
version) and news (any bugs that get fixed, etc.), let us know
and we will add you to our mailing list. For Internet news about geometric algorithms
and convex hulls, look at comp.graphics.algorithms and
sci.math.num-analysis. For Qhull news look at <a
href="http://www.qhull.org/news">qhull-news.html</a>.</p>
</blockquote>
<h2><a href="#TOC">&#187;</a><a name="authors">Authors</a></h2>
<blockquote>
<pre>
C. Bradford Barber Hannu Huhdanpaa
bradb@shore.net hannu@qhull.org
</pre>
</blockquote>
<h2><a href="#TOC">&#187;</a><a name="acknowledge">Acknowledgments</a></h2>
<blockquote>
<p>A special thanks to David Dobkin for his guidance. A special
thanks to Albert Marden, Victor Milenkovic, the Geometry Center,
and Harvard University for supporting this work.</p>
<p>A special thanks to Mark Phillips, Robert Miner, and Stuart Levy for running the Geometry
Center web site long after the Geometry Center closed.
Stuart moved the web site to the University of Illinois at Champaign-Urbana.
Mark and Robert are founders of <a href=http://www.geomtech.com>Geometry Technologies</a>.
Mark, Stuart, and Tamara Munzner are the original authors of <a href=http://www.geomview.org>Geomview</a>.
<p>A special thanks to <a href="http://www.endocardial.com/">Endocardial
Solutions, Inc.</a> of St. Paul, Minnesota for their support of the
internal documentation (<a href=../src/libqhull/index.htm>src/libqhull/index.htm</a>). They use Qhull to build 3-d models of
heart chambers.</p>
<p>Qhull 1.0 and 2.0 were developed under National Science Foundation
grants NSF/DMS-8920161 and NSF-CCR-91-15793 750-7504. If you find
it useful, please let us know.</p>
<p>The Geometry Center was supported by grant DMS-8920161 from the
National Science Foundation, by grant DOE/DE-FG02-92ER25137 from
the Department of Energy, by the University of Minnesota, and by
Minnesota Technology, Inc.</p>
</blockquote>
<h2><a href="#TOC">&#187;</a><a name="ref">References</a></h2>
<blockquote>
<p><a name="aure91">Aurenhammer</a>, F., &quot;Voronoi diagrams
-- A survey of a fundamental geometric data structure,&quot; <i>ACM
Computing Surveys</i>, 1991, 23:345-405. </p>
<p><a name="bar-dob96">Barber</a>, C. B., D.P. Dobkin, and H.T.
Huhdanpaa, &quot;The Quickhull Algorithm for Convex Hulls,&quot; <i>ACM
Transactions on Mathematical Software</i>, 22(4):469-483, Dec 1996, www.qhull.org
[<a
href="http://portal.acm.org/citation.cfm?doid=235815.235821">http://portal.acm.org</a>;
<a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.117.405">http://citeseerx.ist.psu.edu</a>].
</p>
<p><a name="cla-sho89">Clarkson</a>, K.L. and P.W. Shor,
&quot;Applications of random sampling in computational geometry,
II&quot;, <i>Discrete Computational Geometry</i>, 4:387-421, 1989</p>
<p><a name="cla-meh93">Clarkson</a>, K.L., K. Mehlhorn, and R.
Seidel, &quot;Four results on randomized incremental
construction,&quot; <em>Computational Geometry: Theory and
Applications</em>, vol. 3, p. 185-211, 1993.</p>
<p><a name="devi01">Devillers</a>, et. al.,
"Walking in a triangulation," <i>ACM Symposium on
Computational Geometry</i>, June 3-5,2001, Medford MA.
<p><a name="dob-kir90">Dobkin</a>, D.P. and D.G. Kirkpatrick,
&quot;Determining the separation of preprocessed polyhedra--a
unified approach,&quot; in <i>Proc. 17th Inter. Colloq. Automata
Lang. Program.</i>, in <i>Lecture Notes in Computer Science</i>,
Springer-Verlag, 443:400-413, 1990. </p>
<p><a name="edel01">Edelsbrunner</a>, H, <i>Geometry and Topology for Mesh Generation</i>,
Cambridge University Press, 2001.
<p><a name=gart99>Gartner, B.</a>, "Fast and robust smallest enclosing balls", <i>Algorithms - ESA '99</i>, LNCS 1643.
<p><a name=golub83>Golub, G.H. and van Loan, C.F.</a>, <i>Matric Computations</i>, Baltimore, Maryland, USA: John Hopkins Press, 1983
<p><a name="fort93">Fortune, S.</a>, &quot;Computational
geometry,&quot; in R. Martin, editor, <i>Directions in Geometric
Computation</i>, Information Geometers, 47 Stockers Avenue,
Winchester, SO22 5LB, UK, ISBN 1-874728-02-X, 1993.</p>
<p><a name="mile93">Milenkovic, V.</a>, &quot;Robust polygon
modeling,&quot; Computer-Aided Design, vol. 25, p. 546-566,
September 1993. </p>
<p><a name="muck96">Mucke</a>, E.P., I. Saias, B. Zhu, <i>Fast
randomized point location without preprocessing in Two- and
Three-dimensional Delaunay Triangulations</i>, ACM Symposium on
Computational Geometry, p. 274-283, 1996 [<a
href="http://www.geom.uiuc.edu/software/cglist/GeomDir/">GeomDir</a>].
</p>
<p><a name="mulm94">Mulmuley</a>, K., <i>Computational Geometry,
An Introduction Through Randomized Algorithms</i>, Prentice-Hall,
NJ, 1994.</p>
<p><a name="orou94">O'Rourke</a>, J., <i>Computational Geometry
in C</i>, Cambridge University Press, 1994.</p>
<p><a name="pre-sha85">Preparata</a>, F. and M. Shamos, <i>Computational
Geometry</i>, Springer-Verlag, New York, 1985.</p>
</blockquote>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b><a
href="http://www.qhull.org/news">News</a> about Qhull<br>
<b>Up:</b> <a href="http://www.qhull.org/html/qh-faq.htm">FAQ</a> about Qhull<br>
<b>To:</b> <a href="#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>Dn:</b> <a href="qh-impre.htm">Imprecision in Qhull</a><br>
<b>Dn:</b> <a href="qh-eg.htm">Description of Qhull examples</a><br>
<b>Dn:</b> <a href="qh-code.htm">Qhull internals</a><br>
<b>Dn:</b> <a href="../src/libqhull/index.htm">Qhull functions, macros, and data
structures</a>
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,630 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>qconvex -- convex hull</title>
</head>
<body>
<!-- Navigation links -->
<a name="TOP"><b>Up</b></a><b>:</b>
<a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a> -- Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis
&#149; <a href="#input">in</a>put &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#controls">co</a>ntrols &#149; <a href="#graphics">gr</a>aphics
&#149; <a href="#notes">no</a>tes &#149; <a href="#conventions">co</a>nventions
&#149; <a href="#options">op</a>tions
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/cone.html"><img
src="qh--cone.gif" alt="[cone]" align="middle" width="100"
height="100"></a>qconvex -- convex hull</h1>
<p>The convex hull of a set of points is the smallest convex set
containing the points. See the detailed introduction by O'Rourke
[<a href="index.htm#orou94">'94</a>]. See <a
href="index.htm#description">Description of Qhull</a> and <a
href="qh-eg.htm#how">How Qhull adds a point</a>.</p>
<blockquote>
<dl>
<dt><b>Example:</b> rbox 10 D3 | qconvex <a
href="qh-opto.htm#s">s</a> <a href="qh-opto.htm#o">o</a> <a
href="qh-optt.htm#TO">TO result</a></dt>
<dd>Compute the 3-d convex hull of 10 random points. Write a
summary to the console and the points and facets to
'result'.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox c | qconvex <a
href="qh-opto.htm#n">n</a></dt>
<dd>Print the normals for each facet of a cube.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox c | qconvex <a
href="qh-opto.htm#i">i</a> <a href="qh-optq.htm#Qt">Qt</a></dt>
<dd>Print the triangulated facets of a cube.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox y 500 W0 | qconvex</dt>
<dd>Compute the convex hull of a simplex with 500
points on its surface.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox x W1e-12 1000 | qconvex
<a href="qh-optq.htm#QR">QR0</a></dt>
<dd>Compute the convex hull of 1000 points near the
surface of a randomly rotated simplex. Report
the maximum thickness of a facet.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox 1000 s | qconvex <a
href="qh-opto.htm#s">s</a> <a
href="qh-optf.htm#FA">FA</a> </dt>
<dd>Compute the convex hull of 1000 cospherical
points. Verify the results and print a summary
with the total area and volume.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox d D12 | qconvex <a
href="qh-optq.htm#QRn">QR0</a> <a
href="qh-optf.htm#FA">FA</a></dt>
<dd>Compute the convex hull of a 12-d diamond.
Randomly rotate the input. Note the large number
of facets and the small volume.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox c D7 | qconvex <a
href="qh-optf.htm#FA">FA</a> <a
href="qh-optt.htm#TFn">TF1000</a></dt>
<dd>Compute the convex hull of the 7-d hypercube.
Report on progress every 1000 facets. Computing
the convex hull of the 9-d hypercube takes too
much time and space. </dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox c d D2 | qconvex <a
href="qh-optq.htm#Qc">Qc</a> <a
href="qh-opto.htm#s">s</a> <a
href="qh-opto.htm#f">f</a> <a
href="qh-optf.htm#Fx">Fx</a> | more</dt>
<dd>Dump all fields of all facets for a square and a
diamond. Also print a summary and a list of
vertices. Note the coplanar points.</dd>
<dt>&nbsp;</dt>
</dl>
</blockquote>
<p>Except for rbox, all of the qhull programs compute a convex hull.
<p>By default, Qhull merges coplanar facets. For example, the convex
hull of a cube's vertices has six facets.
<p>If you use '<a href="qh-optq.htm#Qt">Qt</a>' (triangulated output),
all facets will be simplicial (e.g., triangles in 2-d). For the cube
example, it will have 12 facets. Some facets may be
degenerate and have zero area.
<p>If you use '<a href="qh-optq.htm#QJn">QJ</a>' (joggled input),
all facets will be simplicial. The corresponding vertices will be
slightly perturbed and identical points will be joggled apart.
Joggled input is less accurate that triangulated
output.See <a
href="qh-impre.htm#joggle">Merged facets or joggled input</a>. </p>
<p>The output for 4-d convex hulls may be confusing if the convex
hull contains non-simplicial facets (e.g., a hypercube). See
<a href=qh-faq.htm#extra>Why
are there extra points in a 4-d or higher convex hull?</a><br>
</p>
</p>
<p>The 'qconvex' program is equivalent to
'<a href=qhull.htm#outputs>qhull</a>' in 2-d to 4-d, and
'<a href=qhull.htm#outputs>qhull</a> <a href=qh-optq.htm#Qx>Qx</a>'
in 5-d and higher. It disables the following Qhull
<a href=qh-quick.htm#options>options</a>: <i>d v H Qbb Qf Qg Qm
Qr Qu Qv Qx Qz TR E V Fp Gt Q0,etc</i>.
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<h3><a href="#TOP">&#187;</a><a name="synopsis">qconvex synopsis</a></h3>
<pre>
qconvex- compute the convex hull.
input (stdin): dimension, number of points, point coordinates
comments start with a non-numeric character
options (qconvex.htm):
Qt - triangulated output
QJ - joggle input instead of merging facets
Tv - verify result: structure, convexity, and point inclusion
. - concise list of all options
- - one-line description of all options
output options (subset):
s - summary of results (default)
i - vertices incident to each facet
n - normals with offsets
p - vertex coordinates (includes coplanar points if 'Qc')
Fx - extreme points (convex hull vertices)
FA - compute total area and volume
o - OFF format (dim, n, points, facets)
G - Geomview output (2-d, 3-d, and 4-d)
m - Mathematica output (2-d and 3-d)
QVn - print facets that include point n, -n if not
TO file- output results to file, may be enclosed in single quotes
examples:
rbox c D2 | qconvex s n rbox c D2 | qconvex i
rbox c D2 | qconvex o rbox 1000 s | qconvex s Tv FA
rbox c d D2 | qconvex s Qc Fx rbox y 1000 W0 | qconvex s n
rbox y 1000 W0 | qconvex s QJ rbox d G1 D12 | qconvex QR0 FA Pp
rbox c D7 | qconvex FA TF1000
</pre>
<h3><a href="#TOP">&#187;</a><a name="input">qconvex
input</a></h3>
<blockquote>
<p>The input data on <tt>stdin</tt> consists of:</p>
<ul>
<li>dimension
<li>number of points</li>
<li>point coordinates</li>
</ul>
<p>Use I/O redirection (e.g., qconvex &lt; data.txt), a pipe (e.g., rbox 10 | qconvex),
or the '<a href=qh-optt.htm#TI>TI</a>' option (e.g., qconvex TI data.txt).
<p>Comments start with a non-numeric character. Error reporting is
simpler if there is one point per line. Dimension
and number of points may be reversed.
<p>Here is the input for computing the convex
hull of the unit cube. The output is the normals, one
per facet.</p>
<blockquote>
<p>rbox c &gt; data </p>
<pre>
3 RBOX c
8
-0.5 -0.5 -0.5
-0.5 -0.5 0.5
-0.5 0.5 -0.5
-0.5 0.5 0.5
0.5 -0.5 -0.5
0.5 -0.5 0.5
0.5 0.5 -0.5
0.5 0.5 0.5
</pre>
<p>qconvex s n &lt; data</p>
<pre>
Convex hull of 8 points in 3-d:
Number of vertices: 8
Number of facets: 6
Number of non-simplicial facets: 6
Statistics for: RBOX c | QCONVEX s n
Number of points processed: 8
Number of hyperplanes created: 11
Number of distance tests for qhull: 35
Number of merged facets: 6
Number of distance tests for merging: 84
CPU seconds to compute hull (after input): 0.081
4
6
0 0 -1 -0.5
0 -1 0 -0.5
1 0 0 -0.5
-1 0 0 -0.5
0 1 0 -0.5
0 0 1 -0.5
</pre>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="outputs">qconvex outputs</a></h3>
<blockquote>
<p>These options control the output of qconvex. They may be used
individually or together.</p>
<blockquote>
<dl compact>
<dt>&nbsp;</dt>
<dd><b>Vertices</b></dd>
<dt><a href="qh-optf.htm#Fx">Fx</a></dt>
<dd>list extreme points (i.e., vertices). The first line is the number of
extreme points. Each point is listed, one per line. The cube example
has eight vertices.</dd>
<dt><a href="qh-optf.htm#Fv">Fv</a></dt>
<dd>list vertices for each facet. The first line is the number of facets.
Each remaining line starts with the number of vertices. For the cube example,
each facet has four vertices.</dd>
<dt><a href="qh-opto.htm#i">i</a></dt>
<dd>list vertices for each facet. The first line is the number of facets. The
remaining lines list the vertices for each facet. In 4-d and
higher, triangulate non-simplicial facets by adding an extra point.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Coordinates</b></dd>
<dt><a href="qh-opto.htm#o">o</a></dt>
<dd>print vertices and facets of the convex hull in OFF format. The
first line is the dimension. The second line is the number of
vertices, facets, and ridges. The vertex
coordinates are next, followed by the facets. Each facet starts with
the number of vertices. The cube example has four vertices per facet.</dd>
<dt><a href="qh-optf.htm#Ft">Ft</a></dt>
<dd>print a triangulation of the convex hull in OFF format. The first line
is the dimension. The second line is the number of vertices and added points,
followed by the number of facets and the number of ridges.
The vertex coordinates are next, followed by the centrum coordinates. There is
one centrum for each non-simplicial facet.
The cube example has six centrums, one per square.
Each facet starts with the number of vertices or centrums.
In the cube example, each facet uses two vertices and one centrum.</dd>
<dt><a href="qh-opto.htm#p">p</a></dt>
<dd>print vertex coordinates. The first line is the dimension and the second
line is the number of vertices. The following lines are the coordinates of each
vertex. The cube example has eight vertices.</dd>
<dt><a href="qh-optq.htm#Qc">Qc</a> <a href="qh-opto.htm#p">p</a></dt>
<dd>print coordinates of vertices and coplanar points. The first line is the dimension.
The second line is the number of vertices and coplanar points. The coordinates
are next, one line per point. Use '<a href="qh-optq.htm#Qc">Qc</a> <a href="qh-optq.htm#Qi">Qi</a> p'
to print the coordinates of all points.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Facets</b></dd>
<dt><a href="qh-optf.htm#Fn">Fn</a></dt>
<dd>list neighboring facets for each facet. The first line is the
number of facets. Each remaining line starts with the number of
neighboring facets. The cube example has four neighbors per facet.</dd>
<dt><a href="qh-optf.htm#FN">FN</a></dt>
<dd>list neighboring facets for each point. The first line is the
total number of points. Each remaining line starts with the number of
neighboring facets. Each vertex of the cube example has three neighboring
facets. Use '<a href="qh-optq.htm#Qc">Qc</a> <a href="qh-optq.htm#Qi">Qi</a> FN'
to include coplanar and interior points. </dd>
<dt><a href="qh-optf.htm#Fa">Fa</a></dt>
<dd>print area for each facet. The first line is the number of facets.
Facet area follows, one line per facet. For the cube example, each facet has area one.</dd>
<dt><a href="qh-optf.htm#FI">FI</a></dt>
<dd>list facet IDs. The first line is the number of
facets. The IDs follow, one per line.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Coplanar and interior points</b></dd>
<dt><a href="qh-optf.htm#Fc">Fc</a></dt>
<dd>list coplanar points for each facet. The first line is the number
of facets. The remaining lines start with the number of coplanar points.
A coplanar point is assigned to one facet.</dd>
<dt><a href="qh-optq.htm#Qi">Qi</a> <a href="qh-optf.htm#Fc">Fc</a></dt>
<dd>list interior points for each facet. The first line is the number
of facets. The remaining lines start with the number of interior points.
A coplanar point is assigned to one facet.</dd>
<dt><a href="qh-optf.htm#FP">FP</a></dt>
<dd>print distance to nearest vertex for coplanar points. The first line is the
number of coplanar points. Each remaining line starts with the point ID of
a vertex, followed by the point ID of a coplanar point, its facet, and distance.
Use '<a href="qh-optq.htm#Qc">Qc</a> <a href="qh-optq.htm#Qi">Qi</a>
<a href="qh-optf.htm#FP">FP</a>' for coplanar and interior points.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Hyperplanes</b></dd>
<dt><a href="qh-opto.htm#n">n</a></dt>
<dd>print hyperplane for each facet. The first line is the dimension. The
second line is the number of facets. Each remaining line is the hyperplane's
coefficients followed by its offset.</dd>
<dt><a href="qh-optf.htm#Fo">Fo</a></dt>
<dd>print outer plane for each facet. The output plane is above all points.
The first line is the dimension. The
second line is the number of facets. Each remaining line is the outer plane's
coefficients followed by its offset.</dd>
<dt><a href="qh-optf.htm#Fi">Fi</a></dt>
<dd>print inner plane for each facet. The inner plane of a facet is
below its vertices.
The first line is the dimension. The
second line is the number of facets. Each remaining line is the inner plane's
coefficients followed by its offset.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>General</b></dd>
<dt><a href="qh-opto.htm#s">s</a></dt>
<dd>print summary for the convex hull. Use '<a
href="qh-optf.htm#Fs">Fs</a>' and '<a
href="qh-optf.htm#FS">FS</a>' if you need numeric data.</dd>
<dt><a href="qh-optf.htm#FA">FA</a></dt>
<dd>compute total area and volume for '<a
href="qh-opto.htm#s">s</a>' and '<a href="qh-optf.htm#FS">FS</a>'</dd>
<dt><a href="qh-opto.htm#m">m</a></dt>
<dd>Mathematica output for the convex hull in 2-d or 3-d.</dd>
<dt><a href="qh-optf.htm#FM">FM</a></dt>
<dd>Maple output for the convex hull in 2-d or 3-d.</dd>
<dt><a href="qh-optg.htm#G">G</a></dt>
<dd>Geomview output for the convex hull in 2-d, 3-d, or 4-d.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Scaling and rotation</b></dd>
<dt><a href="qh-optq.htm#Qbk">Qbk:n</a></dt>
<dd>scale k'th coordinate to lower bound.</dd>
<dt><a href="qh-optq.htm#QBk">QBk:n</a></dt>
<dd>scale k'th coordinate to upper bound.</dd>
<dt><a href="qh-optq.htm#QbB">QbB</a></dt>
<dd>scale input to unit cube centered at the origin.</dd>
<dt><a href="qh-optq.htm#QRn">QRn</a></dt>
<dd>randomly rotate the input with a random seed of n. If n=0, the
seed is the time. If n=-1, use time for the random seed, but do
not rotate the input.</dd>
<dt><a href="qh-optq.htm#Qb0">Qbk:0Bk:0</a></dt>
<dd>remove k'th coordinate from input. This computes the
convex hull in one lower dimension.</dd>
</dl>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="controls">qconvex controls</a></h3>
<blockquote>
<p>These options provide additional control:</p>
<blockquote>
<dl compact>
<dt><a href="qh-optq.htm#Qt">Qt</a></dt>
<dd>triangulated output. Qhull triangulates non-simplicial facets. It may produce
degenerate facets of zero area.</dd>
<dt><a href="qh-optq.htm#QJn">QJ</a></dt>
<dd>joggle the input instead of merging facets. This guarantees simplicial facets
(e.g., triangles in 3-d). It is less accurate than triangulated output ('Qt').</dd>
<dt><a href="qh-optq.htm#Qc">Qc</a></dt>
<dd>keep coplanar points</dd>
<dt><a href="qh-optq.htm#Qi">Qi</a></dt>
<dd>keep interior points</dd>
<dt><a href="qh-opto.htm#f">f </a></dt>
<dd>facet dump. Print the data structure for each facet.</dd>
<dt><a href="qh-optq.htm#QVn">QVn</a></dt>
<dd>select facets containing point <em>n</em> as a vertex,</dd>
<dt><a href="qh-optq.htm#QGn">QGn</a></dt>
<dd>select facets that are visible from point <em>n</em>
(marked 'good'). Use <em>-n</em> for the remainder.</dd>
<dt><a href="qh-optp.htm#PDk">PDk:0</a></dt>
<dd>select facets with a negative coordinate for dimension <i>k</i></dd>
<dt><a href="qh-optt.htm#TFn">TFn</a></dt>
<dd>report progress after constructing <em>n</em> facets</dd>
<dt><a href="qh-optt.htm#Tv">Tv</a></dt>
<dd>verify result</dd>
<dt><a href="qh-optt.htm#TO">TI file</a></dt>
<dd>input data from file. The filename may not use spaces or quotes.</dd>
<dt><a href="qh-optt.htm#TO">TO file</a></dt>
<dd>output results to file. Use single quotes if the filename
contains spaces (e.g., <tt>TO 'file with spaces.txt'</tt></dd>
<dt><a href="qh-optq.htm#Qs">Qs</a></dt>
<dd>search all points for the initial simplex. If Qhull can
not construct an initial simplex, it reports a
descriptive message. Usually, the point set is degenerate and one
or more dimensions should be removed ('<a href="qh-optq.htm#Qb0">Qbk:0Bk:0</a>').
If not, use option 'Qs'. It performs an exhaustive search for the
best initial simplex. This is expensive is high dimensions.</dd>
</dl>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="graphics">qconvex graphics</a></h3>
<blockquote>
<p>Display 2-d, 3-d, and 4-d convex hulls with Geomview ('<a
href="qh-optg.htm#G">G</a>').</p>
<p>Display 2-d and 3-d convex hulls with Mathematica ('<a
href="qh-opto.htm#m">m</a>').</p>
<p>To view 4-d convex hulls in 3-d, use '<a
href="qh-optp.htm#Pdk">Pd0d1d2d3</a>' to select the positive
octant and '<a href="qh-optg.htm#GDn">GrD2</a>' to drop dimension
2. </p>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="notes">qconvex notes</a></h3>
<blockquote>
<p>Qhull always computes a convex hull. The
convex hull may be used for other geometric structures. The
general technique is to transform the structure into an
equivalent convex hull problem. For example, the Delaunay
triangulation is equivalent to the convex hull of the input sites
after lifting the points to a paraboloid.</p>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="conventions">qconvex
conventions</a></h3>
<blockquote>
<p>The following terminology is used for convex hulls in Qhull.
See <a href="index.htm#structure">Qhull's data structures</a>.</p>
<ul>
<li><em>point</em> - <em>d</em> coordinates</li>
<li><em>vertex</em> - extreme point of the input set</li>
<li><em>ridge</em> - <i>d-1</i> vertices between two
neighboring facets</li>
<li><em>hyperplane</em> - halfspace defined by a unit normal
and offset</li>
<li><em>coplanar point</em> - a nearly incident point to a
hyperplane</li>
<li><em>centrum</em> - a point on the hyperplane for testing
convexity</li>
<li><em>facet</em> - a facet with vertices, ridges, coplanar
points, neighboring facets, and hyperplane</li>
<li><em>simplicial facet</em> - a facet with <em>d</em>
vertices, <em>d</em> ridges, and <em>d</em> neighbors</li>
<li><em>non-simplicial facet</em> - a facet with more than <em>d</em>
vertices</li>
<li><em>good facet</em> - a facet selected by '<a
href="qh-optq.htm#QVn">QVn</a>', etc.</li>
</ul>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="options">qconvex options</a></h3>
<pre>
qconvex- compute the convex hull
http://www.qhull.org
input (stdin):
first lines: dimension and number of points (or vice-versa).
other lines: point coordinates, best if one point per line
comments: start with a non-numeric character
options:
Qt - triangulated output
QJ - joggle input instead of merging facets
Qc - keep coplanar points with nearest facet
Qi - keep interior points with nearest facet
Qhull control options:
Qbk:n - scale coord k so that low bound is n
QBk:n - scale coord k so that upper bound is n (QBk is 0.5)
QbB - scale input to unit cube centered at the origin
Qbk:0Bk:0 - remove k-th coordinate from input
QJn - randomly joggle input in range [-n,n]
QRn - random rotation (n=seed, n=0 time, n=-1 time/no rotate)
Qs - search all points for the initial simplex
QGn - good facet if visible from point n, -n for not visible
QVn - good facet if it includes point n, -n if not
Trace options:
T4 - trace at level n, 4=all, 5=mem/gauss, -1= events
Tc - check frequently during execution
Ts - print statistics
Tv - verify result: structure, convexity, and point inclusion
Tz - send all output to stdout
TFn - report summary when n or more facets created
TI file - input data from file, no spaces or single quotes
TO file - output results to file, may be enclosed in single quotes
TPn - turn on tracing when point n added to hull
TMn - turn on tracing at merge n
TWn - trace merge facets when width > n
TVn - stop qhull after adding point n, -n for before (see TCn)
TCn - stop qhull after building cone for point n (see TVn)
Precision options:
Cn - radius of centrum (roundoff added). Merge facets if non-convex
An - cosine of maximum angle. Merge facets if cosine > n or non-convex
C-0 roundoff, A-0.99/C-0.01 pre-merge, A0.99/C0.01 post-merge
Rn - randomly perturb computations by a factor of [1-n,1+n]
Un - max distance below plane for a new, coplanar point
Wn - min facet width for outside point (before roundoff)
Output formats (may be combined; if none, produces a summary to stdout):
f - facet dump
G - Geomview output (see below)
i - vertices incident to each facet
m - Mathematica output (2-d and 3-d)
n - normals with offsets
o - OFF file format (dim, points and facets; Voronoi regions)
p - point coordinates
s - summary (stderr)
More formats:
Fa - area for each facet
FA - compute total area and volume for option 's'
Fc - count plus coplanar points for each facet
use 'Qc' (default) for coplanar and 'Qi' for interior
FC - centrum for each facet
Fd - use cdd format for input (homogeneous with offset first)
FD - use cdd format for numeric output (offset first)
FF - facet dump without ridges
Fi - inner plane for each facet
FI - ID for each facet
Fm - merge count for each facet (511 max)
FM - Maple output (2-d and 3-d)
Fn - count plus neighboring facets for each facet
FN - count plus neighboring facets for each point
Fo - outer plane (or max_outside) for each facet
FO - options and precision constants
FP - nearest vertex for each coplanar point
FQ - command used for qconvex
Fs - summary: #int (8), dimension, #points, tot vertices, tot facets,
for output: #vertices, #facets,
#coplanar points, #non-simplicial facets
#real (2), max outer plane, min vertex
FS - sizes: #int (0)
#real(2) tot area, tot volume
Ft - triangulation with centrums for non-simplicial facets (OFF format)
Fv - count plus vertices for each facet
FV - average of vertices (a feasible point for 'H')
Fx - extreme points (in order for 2-d)
Geomview output (2-d, 3-d, and 4-d)
Ga - all points as dots
Gp - coplanar points and vertices as radii
Gv - vertices as spheres
Gi - inner planes only
Gn - no planes
Go - outer planes only
Gc - centrums
Gh - hyperplane intersections
Gr - ridges
GDn - drop dimension n in 3-d and 4-d output
Print options:
PAn - keep n largest facets by area
Pdk:n - drop facet if normal[k] &lt;= n (default 0.0)
PDk:n - drop facet if normal[k] >= n
Pg - print good facets (needs 'QGn' or 'QVn')
PFn - keep facets whose area is at least n
PG - print neighbors of good facets
PMn - keep n facets with most merges
Po - force output. If error, output neighborhood of facet
Pp - do not report precision problems
. - list of all options
- - one line descriptions of all options
</pre>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149;<a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis
&#149; <a href="#input">in</a>put &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#controls">co</a>ntrols &#149; <a href="#graphics">gr</a>aphics
&#149; <a href="#notes">no</a>tes &#149; <a href="#conventions">co</a>nventions
&#149; <a href="#options">op</a>tions
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,416 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>qdelaunay Qu -- furthest-site Delaunay triangulation</title>
</head>
<body>
<!-- Navigation links -->
<a name="TOP"><b>Up</b></a><b>:</b>
<a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis
&#149; <a href="#input">in</a>put &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#controls">co</a>ntrols &#149; <a href="#graphics">gr</a>aphics
&#149; <a href="#notes">no</a>tes &#149; <a href="#conventions">co</a>nventions
&#149; <a href="#options">op</a>tions
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/delaunay.html"><img
src="qh--dt.gif" alt="[delaunay]" align="middle" width="100"
height="100"></a>qdelaunay Qu -- furthest-site Delaunay triangulation</h1>
<p>The furthest-site Delaunay triangulation corresponds to the upper facets of the <a href="qdelaun.htm">Delaunay construction</a>.
Its vertices are the
extreme points of the input sites.
It is the dual of the <a
href="qvoron_f.htm">furthest-site Voronoi diagram</a>.
<blockquote>
<dl>
<dt><b>Example:</b> rbox 10 D2 | qdelaunay <a
href="qh-optq.htm#Qu">Qu</a> <a
href="qh-optq.htm#Qt">Qt</a> <a href="qh-opto.htm#s">s</a>
<a href="qh-opto.htm#i">i</a> <a href="qh-optt.htm#TO">TO
result</a></dt>
<dd>Compute the 2-d, furthest-site Delaunay triangulation of 10 random
points. Triangulate the output.
Write a summary to the console and the regions to
'result'.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox 10 D2 | qdelaunay <a
href="qh-optq.htm#Qu">Qu</a> <a
href="qh-optq.htm#QJn">QJ</a> <a href="qh-opto.htm#s">s</a>
<a href="qh-opto.htm#i">i</a> <a href="qh-optt.htm#TO">TO
result</a></dt>
<dd>Compute the 2-d, furthest-site Delaunay triangulation of 10 random
points. Joggle the input to guarantee triangular output.
Write a summary to the console and the regions to
'result'.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox r y c G1 D2 | qdelaunay <a
href="qh-optq.htm#Qu">Qu</a> <a href="qh-opto.htm#s">s</a>
<a href="qh-optf.htm#Fv">Fv</a> <a href="qh-optt.htm#TO">TO
result</a></dt>
<dd>Compute the 2-d, furthest-site Delaunay triangulation of a triangle inside
a square.
Write a summary to the console and unoriented regions to 'result'.
Merge regions for cocircular input sites (e.g., the square).
The square is the only furthest-site
Delaunay region.</dd>
</dl>
</blockquote>
<p>As with the Delaunay triangulation, Qhull computes the
furthest-site Delaunay triangulation by lifting the input sites to a
paraboloid. The lower facets correspond to the Delaunay
triangulation while the upper facets correspond to the
furthest-site triangulation. Neither triangulation includes
&quot;vertical&quot; facets (i.e., facets whose last hyperplane
coefficient is nearly zero). Vertical facets correspond to input
sites that are coplanar to the convex hull of the input. An
example is points on the boundary of a lattice.</p>
<p>By default, qdelaunay merges cocircular and cospherical regions.
For example, the furthest-site Delaunay triangulation of a square inside a diamond
('rbox D2 c d G4 | qdelaunay Qu') consists of one region (the diamond).
<p>If you use '<a href="qh-optq.htm#Qt">Qt</a>' (triangulated output),
all furthest-site Delaunay regions will be simplicial (e.g., triangles in 2-d).
Some regions may be
degenerate and have zero area.
<p>If you use '<a href="qh-optq.htm#QJn">QJ</a>' (joggled input), all furthest-site
Delaunay regions
will be simplicial (e.g., triangles in 2-d). Joggled input
is less accurate than triangulated output ('Qt'). See <a
href="qh-impre.htm#joggle">Merged facets or joggled input</a>. </p>
<p>The output for 3-d, furthest-site Delaunay triangulations may be confusing if the
input contains cospherical data. See the FAQ item
<a href=qh-faq.htm#extra>Why
are there extra points in a 4-d or higher convex hull?</a>
Avoid these problems with triangulated output ('<a href="qh-optq.htm#Qt">Qt</a>') or
joggled input ('<a href="qh-optq.htm#QJn">QJ</a>').
</p>
<p>The 'qdelaunay' program is equivalent to
'<a href=qhull.htm#outputs>qhull d</a> <a href=qh-optq.htm#Qbb>Qbb</a>' in 2-d to 3-d, and
'<a href=qhull.htm#outputs>qhull d</a> <a href=qh-optq.htm#Qbb>Qbb</a> <a href=qh-optq.htm#Qx>Qx</a>'
in 4-d and higher. It disables the following Qhull
<a href=qh-quick.htm#options>options</a>: <i>d n v H U Qb QB Qc Qf Qg Qi
Qm Qr QR Qv Qx TR E V FC Fi Fo Fp FV Q0,etc</i>.
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<h3><a href="#TOP">&#187;</a><a name="synopsis">furthest-site qdelaunay synopsis</a></h3>
<blockquote>
See <a href="qdelaun.htm#synopsis">qdelaunay synopsis</a>. The same
program is used for both constructions. Use option '<a href="qh-optq.htm#Qu">Qu</a>'
for furthest-site Delaunay triangulations.
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="input">furthest-site qdelaunay
input</a></h3>
<blockquote>
<p>The input data on <tt>stdin</tt> consists of:</p>
<ul>
<li>dimension
<li>number of points</li>
<li>point coordinates</li>
</ul>
<p>Use I/O redirection (e.g., qdelaunay Qu &lt; data.txt), a pipe (e.g., rbox 10 | qdelaunay Qu),
or the '<a href=qh-optt.htm#TI>TI</a>' option (e.g., qdelaunay Qu TI data.txt).
<p>For example, this is a square containing four random points.
Its furthest-site Delaunay
triangulation contains one square.
<p>
<blockquote>
<tt>rbox c 4 D2 &gt; data</tt>
<blockquote><pre>
2 RBOX c 4 D2
8
-0.4999921736307369 -0.3684622117955817
0.2556053225468894 -0.0413498678629751
0.0327672376602583 -0.2810408135699488
-0.452955383763607 0.17886471718444
-0.5 -0.5
-0.5 0.5
0.5 -0.5
0.5 0.5
</pre></blockquote>
<p><tt>qdelaunay Qu i &lt; data</tt>
<blockquote><pre>
Furthest-site Delaunay triangulation by the convex hull of 8 points in 3-d:
Number of input sites: 8
Number of Delaunay regions: 1
Number of non-simplicial Delaunay regions: 1
Statistics for: RBOX c 4 D2 | QDELAUNAY s Qu i
Number of points processed: 8
Number of hyperplanes created: 20
Number of facets in hull: 11
Number of distance tests for qhull: 34
Number of merged facets: 1
Number of distance tests for merging: 107
CPU seconds to compute hull (after input): 0.02
1
7 6 4 5
</pre></blockquote>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="outputs">furthest-site qdelaunay
outputs</a></h3>
<blockquote>
<p>These options control the output of furthest-site Delaunay triangulations:</p>
<blockquote>
<dl compact>
<dd><b>furthest-site Delaunay regions</b></dd>
<dt><a href="qh-opto.htm#i">i</a></dt>
<dd>list input sites for each furthest-site Delaunay region. The first line is the number of regions. The
remaining lines list the input sites for each region. The regions are
oriented. In 3-d and
higher, report cospherical sites by adding extra points. For the points-in-square example,
the square is the only furthest-site Delaunay region.</dd>
<dt><a href="qh-optf.htm#Fv">Fv</a></dt>
<dd>list input sites for each furthest-site Delaunay region. The first line is the number of regions.
Each remaining line starts with the number of input sites. The regions
are unoriented. For the points-in-square example,
the square is the only furthest-site Delaunay region.</dd>
<dt><a href="qh-optf.htm#Ft">Ft</a></dt>
<dd>print a triangulation of the furthest-site Delaunay regions in OFF format. The first line
is the dimension. The second line is the number of input sites and added points,
followed by the number of simplices and the number of ridges.
The input coordinates are next, followed by the centrum coordinates. There is
one centrum for each non-simplicial furthest-site Delaunay region. Each remaining line starts
with dimension+1. The
simplices are oriented.
For the points-in-square example, the square has a centrum at the
origin. It splits the square into four triangular regions.</dd>
<dt><a href="qh-optf.htm#Fn">Fn</a></dt>
<dd>list neighboring regions for each furthest-site Delaunay region. The first line is the
number of regions. Each remaining line starts with the number of
neighboring regions. Negative indices (e.g., <em>-1</em>) indicate regions
outside of the furthest-site Delaunay triangulation.
For the points-in-square example, the four neighboring regions
are outside of the triangulation. They belong to the regular
Delaunay triangulation.</dd>
<dt><a href="qh-optf.htm#FN">FN</a></dt>
<dd>list the furthest-site Delaunay regions for each input site. The first line is the
total number of input sites. Each remaining line starts with the number of
furthest-site Delaunay regions. Negative indices (e.g., <em>-1</em>) indicate regions
outside of the furthest-site Delaunay triangulation.
For the points-in-square example, the four random points belong to no region
while the square's vertices belong to region <em>0</em> and three
regions outside of the furthest-site Delaunay triangulation.</dd>
<dt><a href="qh-optf.htm#Fa">Fa</a></dt>
<dd>print area for each furthest-site Delaunay region. The first line is the number of regions.
The areas follow, one line per region. For the points-in-square example, the
square has unit area. </dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Input sites</b></dd>
<dt><a href="qh-optf.htm#Fx">Fx</a></dt>
<dd>list extreme points of the input sites. These points are vertices of the furthest-point
Delaunay triangulation. They are on the
boundary of the convex hull. The first line is the number of
extreme points. Each point is listed, one per line. The points-in-square example
has four extreme points.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>General</b></dd>
<dt><a href="qh-optf.htm#FA">FA</a></dt>
<dd>compute total area for '<a href="qh-opto.htm#s">s</a>'
and '<a href="qh-optf.htm#FS">FS</a>'. This is the
same as the area of the convex hull.</dd>
<dt><a href="qh-opto.htm#o">o</a></dt>
<dd>print upper facets of the corresponding convex hull (a
paraboloid)</dd>
<dt><a href="qh-opto.htm#m">m</a></dt>
<dd>Mathematica output for the upper facets of the paraboloid (2-d triangulations).</dd>
<dt><a href="qh-optf.htm#FM">FM</a></dt>
<dd>Maple output for the upper facets of the paraboloid (2-d triangulations).</dd>
<dt><a href="qh-optg.htm#G">G</a></dt>
<dd>Geomview output for the paraboloid (2-d or 3-d triangulations).</dd>
<dt><a href="qh-opto.htm#s">s</a></dt>
<dd>print summary for the furthest-site Delaunay triangulation. Use '<a
href="qh-optf.htm#Fs">Fs</a>' and '<a
href="qh-optf.htm#FS">FS</a>' for numeric data.</dd>
</dl>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="controls">furthest-site qdelaunay
controls</a></h3>
<blockquote>
<p>These options provide additional control:</p>
<blockquote>
<dl compact>
<dt><a href="qh-optq.htm#Qu">Qu</a></dt>
<dd>must be used for furthest-site Delaunay triangulation.</dd>
<dt><a href="qh-optq.htm#Qt">Qt</a></dt>
<dd>triangulated output. Qhull triangulates non-simplicial facets. It may produce
degenerate facets of zero area.</dd>
<dt><a href="qh-optq.htm#QJn">QJ</a></dt>
<dd>joggle the input to avoid cospherical and coincident
sites. It is less accurate than triangulated output ('Qt').</dd>
<dt><a href="qh-optq.htm#QVn">QVn</a></dt>
<dd>select facets adjacent to input site <em>n</em> (marked
'good').</dd>
<dt><a href="qh-optt.htm#Tv">Tv</a></dt>
<dd>verify result.</dd>
<dt><a href="qh-optt.htm#TO">TI file</a></dt>
<dd>input data from file. The filename may not use spaces or quotes.</dd>
<dt><a href="qh-optt.htm#TO">TO file</a></dt>
<dd>output results to file. Use single quotes if the filename
contains spaces (e.g., <tt>TO 'file with spaces.txt'</tt></dd>
<dt><a href="qh-optt.htm#TFn">TFn</a></dt>
<dd>report progress after constructing <em>n</em> facets</dd>
<dt><a href="qh-optp.htm#PDk">PDk:1</a></dt>
<dd>include upper and lower facets in the output. Set <em>k</em>
to the last dimension (e.g., 'PD2:1' for 2-d inputs). </dd>
<dt><a href="qh-opto.htm#f">f</a></dt>
<dd>facet dump. Print the data structure for each facet (i.e., furthest-site Delaunay region).</dd>
</dl>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="graphics">furthest-site qdelaunay
graphics</a></h3>
<blockquote>
See <a href="qdelaun.htm#graphics">Delaunay graphics</a>.
They are the same except for Mathematica and Maple output.
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="notes">furthest-site
qdelaunay notes</a></h3>
<blockquote>
<p>The furthest-site Delaunay triangulation does not
record coincident input sites. Use <tt>qdelaunay</tt> instead.
<p><tt>qdelaunay Qu</tt> does not work for purely cocircular
or cospherical points (e.g., rbox c | qdelaunay Qu). Instead,
use <tt>qdelaunay Qz</tt> -- when all points are vertices of the convex
hull of the input sites, the Delaunay triangulation is the same
as the furthest-site Delaunay triangulation.
<p>A non-simplicial, furthest-site Delaunay region indicates nearly cocircular or
cospherical input sites. To avoid non-simplicial regions triangulate
the output ('<a href="qh-optq.htm#Qt">Qt</a>') or joggle
the input ('<a href="qh-optq.htm#QJn">QJ</a>'). Joggled input
is less accurate than triangulated output.
You may also triangulate
non-simplicial regions with option '<a
href="qh-optf.htm#Ft">Ft</a>'. It adds
the centrum to non-simplicial regions. Alternatively, use an <a
href="qh-impre.htm#exact">exact arithmetic code</a>.</p>
<p>Furthest-site Delaunay triangulations do not include facets that are
coplanar with the convex hull of the input sites. A facet is
coplanar if the last coefficient of its normal is
nearly zero (see <a href="../src/libqhull/user.h#ZEROdelaunay">qh_ZEROdelaunay</a>).
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="conventions">furthest-site qdelaunay conventions</a></h3>
<blockquote>
<p>The following terminology is used for furthest-site Delaunay
triangulations in Qhull. The underlying structure is the upper
facets of a convex hull in one higher dimension. See <a
href="qconvex.htm#conventions">convex hull conventions</a>, <a
href="qdelaun.htm#conventions">Delaunay conventions</a>,
and <a href="index.htm#structure">Qhull's data structures</a></p>
<blockquote>
<ul>
<li><em>input site</em> - a point in the input (one dimension
lower than a point on the convex hull)</li>
<li><em>point</em> - <i>d+1</i> coordinates. The last
coordinate is the sum of the squares of the input site's
coordinates</li>
<li><em>vertex</em> - a point on the paraboloid. It
corresponds to a unique input site. </li>
<li><em>furthest-site Delaunay facet</em> - an upper facet of the
paraboloid. The last coefficient of its normal is
clearly positive.</li>
<li><em>furthest-site Delaunay region</em> - a furthest-site Delaunay
facet projected to the input sites</li>
<li><em>non-simplicial facet</em> - more than <em>d</em>
points are cocircular or cospherical</li>
<li><em>good facet</em> - a furthest-site Delaunay facet with optional
restrictions by '<a href="qh-optq.htm#QVn">QVn</a>', etc.</li>
</ul>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="options">furthest-site qdelaunay options</a></h3>
<blockquote>
See <a href="qdelaun.htm#options">qdelaunay options</a>. The same
program is used for both constructions. Use option '<a href="qh-optq.htm#Qu">Qu</a>'
for furthest-site Delaunay triangulations.
</blockquote>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis
&#149; <a href="#input">in</a>put &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#controls">co</a>ntrols &#149; <a href="#graphics">gr</a>aphics
&#149; <a href="#notes">no</a>tes &#149; <a href="#conventions">co</a>nventions
&#149; <a href="#options">op</a>tions
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,628 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>qdelaunay -- Delaunay triangulation</title>
</head>
<body>
<!-- Navigation links -->
<a name="TOP"><b>Up</b></a><b>:</b>
<a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis
&#149; <a href="#input">in</a>put &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#controls">co</a>ntrols &#149; <a href="#graphics">gr</a>aphics
&#149; <a href="#notes">no</a>tes &#149; <a href="#conventions">co</a>nventions
&#149; <a href="#options">op</a>tions
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/delaunay.html"><img
src="qh--dt.gif" alt="[delaunay]" align="middle" width="100"
height="100"></a>qdelaunay -- Delaunay triangulation</h1>
<p>The Delaunay triangulation is the triangulation with empty
circumspheres. It has many useful properties and applications.
See the survey article by Aurenhammer [<a
href="index.htm#aure91">'91</a>] and the detailed introduction
by O'Rourke [<a href="index.htm#orou94">'94</a>]. </p>
<blockquote>
<dl>
<dt><b>Example:</b> rbox r y c G0.1 D2 | qdelaunay <a href="qh-opto.htm#s">s</a>
<a href="qh-optf.htm#Fv">Fv</a> <a href="qh-optt.htm#TO">TO
result</a></dt>
<dd>Compute the 2-d Delaunay triangulation of a triangle and
a small square.
Write a summary to the console and unoriented regions to 'result'.
Merge regions for cocircular input sites (i.e., the
square).</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox r y c G0.1 D2 | qdelaunay <a href="qh-opto.htm#s">s</a>
<a href="qh-optf.htm#Fv">Fv</a> <a href="qh-optq.htm#Qt">Qt</a></dt>
<dd>Compute the 2-d Delaunay triangulation of a triangle and
a small square. Write a summary and unoriented
regions to the console. Produce triangulated output.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox 10 D2 | qdelaunay <a
href="qh-optq.htm#QJn">QJ</a> <a href="qh-opto.htm#s">s</a>
<a href="qh-opto.htm#i">i</a> <a href="qh-optt.htm#TO">TO
result</a></dt>
<dd>Compute the 2-d Delaunay triangulation of 10 random
points. Joggle the input to guarantee triangular output.
Write a summary to the console and the regions to
'result'.</dd>
</dl>
</blockquote>
<p>Qhull computes the Delaunay triangulation by computing a
convex hull. It lifts the input sites to a paraboloid by adding
the sum of the squares of the coordinates. It scales the height
of the paraboloid to improve numeric precision ('<a href=qh-optq.htm#Qbb>Qbb</a>').
It computes the convex
hull of the lifted sites, and projects the lower convex hull to
the input.
<p>Each region of the Delaunay triangulation
corresponds to a facet of the lower half of the convex hull.
Facets of the upper half of the convex hull correspond to the <a
href="qdelau_f.htm">furthest-site Delaunay triangulation</a>.
See the examples, <a href="qh-eg.htm#delaunay">Delaunay and
Voronoi diagrams</a>.</p>
<p>See <a href="http://www.qhull.org/html/qh-faq.htm#TOC">Qhull FAQ</a> - Delaunay and
Voronoi diagram questions.</p>
<p>By default, qdelaunay merges cocircular and cospherical regions.
For example, the Delaunay triangulation of a square inside a diamond
('rbox D2 c d G4 | qdelaunay') contains one region for the square.
<p>Use option '<a href="qh-optq.htm#Qz">Qz</a>' if the input is circular, cospherical, or
nearly so. It improves precision by adding a point "at infinity," above the corresponding paraboloid.
<p>If you use '<a href="qh-optq.htm#Qt">Qt</a>' (triangulated output),
all Delaunay regions will be simplicial (e.g., triangles in 2-d).
Some regions may be
degenerate and have zero area. Triangulated output identifies coincident
points.
<p>If you use '<a href="qh-optq.htm#QJn">QJ</a>' (joggled input), all Delaunay regions
will be simplicial (e.g., triangles in 2-d). Coincident points will
create small regions since the points are joggled apart. Joggled input
is less accurate than triangulated output ('Qt'). See <a
href="qh-impre.htm#joggle">Merged facets or joggled input</a>. </p>
<p>The output for 3-d Delaunay triangulations may be confusing if the
input contains cospherical data. See the FAQ item
<a href=qh-faq.htm#extra>Why
are there extra points in a 4-d or higher convex hull?</a>
Avoid these problems with triangulated output ('<a href="qh-optq.htm#Qt">Qt</a>') or
joggled input ('<a href="qh-optq.htm#QJn">QJ</a>').
</p>
<p>The 'qdelaunay' program is equivalent to
'<a href=qhull.htm#outputs>qhull d</a> <a href=qh-optq.htm#Qbb>Qbb</a>' in 2-d to 3-d, and
'<a href=qhull.htm#outputs>qhull d</a> <a href=qh-optq.htm#Qbb>Qbb</a> <a href=qh-optq.htm#Qx>Qx</a>'
in 4-d and higher. It disables the following Qhull
<a href=qh-quick.htm#options>options</a>: <i>d n v H U Qb QB Qc Qf Qg Qi
Qm Qr QR Qv Qx TR E V FC Fi Fo Fp Ft FV Q0,etc</i>.
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<h3><a href="#TOP">&#187;</a><a name="synopsis">qdelaunay synopsis</a></h3>
<pre>
qdelaunay- compute the Delaunay triangulation.
input (stdin): dimension, number of points, point coordinates
comments start with a non-numeric character
options (qdelaun.htm):
Qt - triangulated output
QJ - joggle input instead of merging facets
Qu - furthest-site Delaunay triangulation
Tv - verify result: structure, convexity, and in-circle test
. - concise list of all options
- - one-line description of all options
output options (subset):
s - summary of results (default)
i - vertices incident to each Delaunay region
Fx - extreme points (vertices of the convex hull)
o - OFF format (shows the points lifted to a paraboloid)
G - Geomview output (2-d and 3-d points lifted to a paraboloid)
m - Mathematica output (2-d inputs lifted to a paraboloid)
QVn - print Delaunay regions that include point n, -n if not
TO file- output results to file, may be enclosed in single quotes
examples:
rbox c P0 D2 | qdelaunay s o rbox c P0 D2 | qdelaunay i
rbox c P0 D3 | qdelaunay Fv Qt rbox c P0 D2 | qdelaunay s Qu Fv
rbox c G1 d D2 | qdelaunay s i rbox c G1 d D2 | qdelaunay s i Qt
rbox M3,4 z 100 D2 | qdelaunay s rbox M3,4 z 100 D2 | qdelaunay s Qt
</pre>
<h3><a href="#TOP">&#187;</a><a name="input">qdelaunay
input</a></h3>
<blockquote>
<p>The input data on <tt>stdin</tt> consists of:</p>
<ul>
<li>dimension
<li>number of points</li>
<li>point coordinates</li>
</ul>
<p>Use I/O redirection (e.g., qdelaunay &lt; data.txt), a pipe (e.g., rbox 10 | qdelaunay),
or the '<a href=qh-optt.htm#TI>TI</a>' option (e.g., qdelaunay TI data.txt).
<p>For example, this is four cocircular points inside a square. Its Delaunay
triangulation contains 8 triangles and one four-sided
figure.
<p>
<blockquote>
<tt>rbox s 4 W0 c G1 D2 &gt; data</tt>
<blockquote><pre>
2 RBOX s 4 W0 c D2
8
-0.4941988586954018 -0.07594397977563715
-0.06448037284989526 0.4958248496365813
0.4911154367094632 0.09383830681375946
-0.348353580869097 -0.3586778257652367
-1 -1
-1 1
1 -1
1 1
</pre></blockquote>
<p><tt>qdelaunay s i &lt; data</tt>
<blockquote><pre>
Delaunay triangulation by the convex hull of 8 points in 3-d
Number of input sites: 8
Number of Delaunay regions: 9
Number of non-simplicial Delaunay regions: 1
Statistics for: RBOX s 4 W0 c D2 | QDELAUNAY s i
Number of points processed: 8
Number of hyperplanes created: 18
Number of facets in hull: 10
Number of distance tests for qhull: 33
Number of merged facets: 2
Number of distance tests for merging: 102
CPU seconds to compute hull (after input): 0.028
9
1 7 5
6 3 4
2 3 6
7 2 6
2 7 1
0 5 4
3 0 4
0 1 5
1 0 3 2
</pre></blockquote>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="outputs">qdelaunay
outputs</a></h3>
<blockquote>
<p>These options control the output of Delaunay triangulations:</p>
<blockquote>
<dl compact>
<dd><b>Delaunay regions</b></dd>
<dt><a href="qh-opto.htm#i">i</a></dt>
<dd>list input sites for each Delaunay region. The first line is the number of regions. The
remaining lines list the input sites for each region. The regions are
oriented. In 3-d and
higher, report cospherical sites by adding extra points. Use triangulated
output ('<a href="qh-optq.htm#Qt">Qt</a>') to avoid non-simpicial regions. For the circle-in-square example,
eight Delaunay regions are triangular and the ninth has four input sites.</dd>
<dt><a href="qh-optf.htm#Fv">Fv</a></dt>
<dd>list input sites for each Delaunay region. The first line is the number of regions.
Each remaining line starts with the number of input sites. The regions
are unoriented. For the circle-in-square example,
eight Delaunay regions are triangular and the ninth has four input sites.</dd>
<dt><a href="qh-optf.htm#Fn">Fn</a></dt>
<dd>list neighboring regions for each Delaunay region. The first line is the
number of regions. Each remaining line starts with the number of
neighboring regions. Negative indices (e.g., <em>-1</em>) indicate regions
outside of the Delaunay triangulation.
For the circle-in-square example, the four regions on the square are neighbors to
the region-at-infinity.</dd>
<dt><a href="qh-optf.htm#FN">FN</a></dt>
<dd>list the Delaunay regions for each input site. The first line is the
total number of input sites. Each remaining line starts with the number of
Delaunay regions. Negative indices (e.g., <em>-1</em>) indicate regions
outside of the Delaunay triangulation.
For the circle-in-square example, each point on the circle belongs to four
Delaunay regions. Use '<a href="qh-optq.htm#Qc">Qc</a> FN'
to include coincident input sites and deleted vertices. </dd>
<dt><a href="qh-optf.htm#Fa">Fa</a></dt>
<dd>print area for each Delaunay region. The first line is the number of regions.
The areas follow, one line per region. For the circle-in-square example, the
cocircular region has area 0.4. </dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Input sites</b></dd>
<dt><a href="qh-optf.htm#Fc">Fc</a></dt>
<dd>list coincident input sites for each Delaunay region.
The first line is the number of regions. The remaining lines start with
the number of coincident sites and deleted vertices. Deleted vertices
indicate highly degenerate input (see'<a href="qh-optf.htm#Fs">Fs</a>').
A coincident site is assigned to one Delaunay
region. Do not use '<a href="qh-optq.htm#QJn">QJ</a>' with 'Fc'; the joggle will separate
coincident sites.</dd>
<dt><a href="qh-optf.htm#FP">FP</a></dt>
<dd>print coincident input sites with distance to
nearest site (i.e., vertex). The first line is the
number of coincident sites. Each remaining line starts with the point ID of
an input site, followed by the point ID of a coincident point, its region, and distance.
Includes deleted vertices which
indicate highly degenerate input (see'<a href="qh-optf.htm#Fs">Fs</a>').
Do not use '<a href="qh-optq.htm#QJn">QJ</a>' with 'FP'; the joggle will separate
coincident sites.</dd>
<dt><a href="qh-optf.htm#Fx">Fx</a></dt>
<dd>list extreme points of the input sites. These points are on the
boundary of the convex hull. The first line is the number of
extreme points. Each point is listed, one per line. The circle-in-square example
has four extreme points.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>General</b></dd>
<dt><a href="qh-optf.htm#FA">FA</a></dt>
<dd>compute total area for '<a href="qh-opto.htm#s">s</a>'
and '<a href="qh-optf.htm#FS">FS</a>'</dd>
<dt><a href="qh-opto.htm#o">o</a></dt>
<dd>print lower facets of the corresponding convex hull (a
paraboloid)</dd>
<dt><a href="qh-opto.htm#m">m</a></dt>
<dd>Mathematica output for the lower facets of the paraboloid (2-d triangulations).</dd>
<dt><a href="qh-optf.htm#FM">FM</a></dt>
<dd>Maple output for the lower facets of the paraboloid (2-d triangulations).</dd>
<dt><a href="qh-optg.htm#G">G</a></dt>
<dd>Geomview output for the paraboloid (2-d or 3-d triangulations).</dd>
<dt><a href="qh-opto.htm#s">s</a></dt>
<dd>print summary for the Delaunay triangulation. Use '<a
href="qh-optf.htm#Fs">Fs</a>' and '<a
href="qh-optf.htm#FS">FS</a>' for numeric data.</dd>
</dl>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="controls">qdelaunay
controls</a></h3>
<blockquote>
<p>These options provide additional control:</p>
<blockquote>
<dl compact>
<dt><a href="qh-optq.htm#Qt">Qt</a></dt>
<dd>triangulated output. Qhull triangulates non-simplicial facets. It may produce
degenerate facets of zero area.</dd>
<dt><a href="qh-optq.htm#QJn">QJ</a></dt>
<dd>joggle the input to avoid cospherical and coincident
sites. It is less accurate than triangulated output ('Qt').</dd>
<dt><a href="qh-optq.htm#Qu">Qu</a></dt>
<dd>compute the <a href="qdelau_f.htm">furthest-site Delaunay triangulation</a>.</dd>
<dt><a href="qh-optq.htm#Qz">Qz</a></dt>
<dd>add a point above the paraboloid to reduce precision
errors. Use it for nearly cocircular/cospherical input
(e.g., 'rbox c | qdelaunay Qz'). The point is printed for
options '<a href="qh-optf.htm#Ft">Ft</a>' and '<a
href="qh-opto.htm#o">o</a>'.</dd>
<dt><a href="qh-optq.htm#QVn">QVn</a></dt>
<dd>select facets adjacent to input site <em>n</em> (marked
'good').</dd>
<dt><a href="qh-optt.htm#Tv">Tv</a></dt>
<dd>verify result.</dd>
<dt><a href="qh-optt.htm#TO">TI file</a></dt>
<dd>input data from file. The filename may not use spaces or quotes.</dd>
<dt><a href="qh-optt.htm#TO">TO file</a></dt>
<dd>output results to file. Use single quotes if the filename
contains spaces (e.g., <tt>TO 'file with spaces.txt'</tt></dd>
<dt><a href="qh-optt.htm#TFn">TFn</a></dt>
<dd>report progress after constructing <em>n</em> facets</dd>
<dt><a href="qh-optp.htm#PDk">PDk:1</a></dt>
<dd>include upper and lower facets in the output. Set <em>k</em>
to the last dimension (e.g., 'PD2:1' for 2-d inputs). </dd>
<dt><a href="qh-opto.htm#f">f</a></dt>
<dd>facet dump. Print the data structure for each facet (i.e., Delaunay region).</dd>
</dl>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="graphics">qdelaunay
graphics</a></h3>
<blockquote>
<p>For 2-d and 3-d Delaunay triangulations, Geomview ('qdelaunay <a
href="qh-optg.htm#G">G</a>') displays the corresponding convex
hull (a paraboloid). </p>
<p>To view a 2-d Delaunay triangulation, use 'qdelaunay <a
href="qh-optg.htm#GDn">GrD2</a>' to drop the last dimension. This
is the same as viewing the hull without perspective (see
Geomview's 'cameras' menu). </p>
<p>To view a 3-d Delaunay triangulation, use 'qdelaunay <a
href="qh-optg.htm#GDn">GrD3</a>' to drop the last dimension. You
may see extra edges. These are interior edges that Geomview moves
towards the viewer (see 'lines closer' in Geomview's camera
options). Use option '<a href="qh-optg.htm#Gt">Gt</a>' to make
the outer ridges transparent in 3-d. See <a
href="qh-eg.htm#delaunay">Delaunay and Voronoi examples</a>.</p>
<p>For 2-d Delaunay triangulations, Mathematica ('<a
href="qh-opto.htm#m">m</a>') and Maple ('<a
href="qh-optf.htm#FM">FM</a>') output displays the lower facets of the corresponding convex
hull (a paraboloid). </p>
<p>For 2-d, furthest-site Delaunay triangulations, Maple and Mathematica output ('<a
href="qh-optq.htm#Qu">Qu</a> <a
href="qh-opto.htm#m">m</a>') displays the upper facets of the corresponding convex
hull (a paraboloid). </p>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="notes">qdelaunay
notes</a></h3>
<blockquote>
<p>You can simplify the Delaunay triangulation by enclosing the input
sites in a large square or cube. This is particularly recommended
for cocircular or cospherical input data.
<p>A non-simplicial Delaunay region indicates nearly cocircular or
cospherical input sites. To avoid non-simplicial regions either triangulate
the output ('<a href="qh-optq.htm#Qt">Qt</a>') or joggle
the input ('<a href="qh-optq.htm#QJn">QJ</a>'). Triangulated output
is more accurate than joggled input. Alternatively, use an <a
href="qh-impre.htm#exact">exact arithmetic code</a>.</p>
<p>Delaunay triangulations do not include facets that are
coplanar with the convex hull of the input sites. A facet is
coplanar if the last coefficient of its normal is
nearly zero (see <a href="../src/libqhull/user.h#ZEROdelaunay">qh_ZEROdelaunay</a>).
<p>See <a href=qh-impre.htm#delaunay>Imprecision issues :: Delaunay triangulations</a>
for a discussion of precision issues. Deleted vertices indicate
highly degenerate input. They are listed in the summary output and
option '<a href="qh-optf.htm#Fs">Fs</a>'.</p>
<p>To compute the Delaunay triangulation of points on a sphere,
compute their convex hull. If the sphere is the unit sphere at
the origin, the facet normals are the Voronoi vertices of the
input. The points may be restricted to a hemisphere. [S. Fortune]
</p>
<p>The 3-d Delaunay triangulation of regular points on a half
spiral (e.g., 'rbox 100 l | qdelaunay') has quadratic size, while the Delaunay triangulation
of random 3-d points is
approximately linear for reasonably sized point sets.
<p>With the <a href="qh-code.htm#library">Qhull library</a>, you
can use <tt>qh_findbestfacet</tt> in <tt>poly2.c</tt> to locate the facet
that contains a point. You should first lift the point to the
paraboloid (i.e., the last coordinate is the sum of the squares
of the point's coordinates -- <tt>qh_setdelaunay</tt>). Do not use options
'<a href="qh-optq.htm#Qbb">Qbb</a>', '<a href="qh-optq.htm#QbB">QbB</a>',
'<a href="qh-optq.htm#Qbk">Qbk:n</a>', or '<a
href="qh-optq.htm#QBk">QBk:n</a>' since these scale the last
coordinate. </p>
<p>If a point is interior to the convex hull of the input set, it
is interior to the adjacent vertices of the Delaunay
triangulation. This is demonstrated by the following pipe for
point 0:
<pre>
qdelaunay &lt;data s FQ QV0 p | qconvex s Qb3:0B3:0 p
</pre>
<p>The first call to qdelaunay returns the neighboring points of
point 0 in the Delaunay triangulation. The second call to qconvex
returns the vertices of the convex hull of these points (after
dropping the lifted coordinate). If point 0 is interior to the
original point set, it is interior to the reduced point set. </p>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="conventions">qdelaunay conventions</a></h3>
<blockquote>
<p>The following terminology is used for Delaunay triangulations
in Qhull for dimension <i>d</i>. The underlying structure is the
lower facets of a convex hull in dimension <i>d+1</i>. For
further information, see <a href="index.htm#structure">data
structures</a> and <a href="qconvex.htm#conventions">convex hull
conventions</a>.</p>
<blockquote>
<ul>
<li><em>input site</em> - a point in the input (one dimension
lower than a point on the convex hull)</li>
<li><em>point</em> - a point has <i>d+1</i> coordinates. The
last coordinate is the sum of the squares of the input
site's coordinates</li>
<li><em>coplanar point</em> - a <em>coincident</em>
input site or a deleted vertex. Deleted vertices
indicate highly degenerate input.</li>
<li><em>vertex</em> - a point on the paraboloid. It
corresponds to a unique input site. </li>
<li><em>point-at-infinity</em> - a point added above the
paraboloid by option '<a href="qh-optq.htm#Qz">Qz</a>'</li>
<li><em>lower facet</em> - a facet corresponding to a
Delaunay region. The last coefficient of its normal is
clearly negative.</li>
<li><em>upper facet</em> - a facet corresponding to a
furthest-site Delaunay region. The last coefficient of
its normal is clearly positive. </li>
<li><em>Delaunay region</em> - a
lower facet projected to the input sites</li>
<li><em>upper Delaunay region</em> - an upper facet projected
to the input sites</li>
<li><em>non-simplicial facet</em> - more than <em>d</em>
input sites are cocircular or cospherical</li>
<li><em>good facet</em> - a Delaunay region with optional
restrictions by '<a href="qh-optq.htm#QVn">QVn</a>', etc.</li>
</ul>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="options">qdelaunay options</a></h3>
<pre>
qdelaunay- compute the Delaunay triangulation
http://www.qhull.org
input (stdin):
first lines: dimension and number of points (or vice-versa).
other lines: point coordinates, best if one point per line
comments: start with a non-numeric character
options:
Qt - triangulated output
QJ - joggle input instead of merging facets
Qu - compute furthest-site Delaunay triangulation
Qhull control options:
QJn - randomly joggle input in range [-n,n]
Qs - search all points for the initial simplex
Qz - add point-at-infinity to Delaunay triangulation
QGn - print Delaunay region if visible from point n, -n if not
QVn - print Delaunay regions that include point n, -n if not
Trace options:
T4 - trace at level n, 4=all, 5=mem/gauss, -1= events
Tc - check frequently during execution
Ts - print statistics
Tv - verify result: structure, convexity, and in-circle test
Tz - send all output to stdout
TFn - report summary when n or more facets created
TI file - input data from file, no spaces or single quotes
TO file - output results to file, may be enclosed in single quotes
TPn - turn on tracing when point n added to hull
TMn - turn on tracing at merge n
TWn - trace merge facets when width > n
TVn - stop qhull after adding point n, -n for before (see TCn)
TCn - stop qhull after building cone for point n (see TVn)
Precision options:
Cn - radius of centrum (roundoff added). Merge facets if non-convex
An - cosine of maximum angle. Merge facets if cosine > n or non-convex
C-0 roundoff, A-0.99/C-0.01 pre-merge, A0.99/C0.01 post-merge
Rn - randomly perturb computations by a factor of [1-n,1+n]
Wn - min facet width for outside point (before roundoff)
Output formats (may be combined; if none, produces a summary to stdout):
f - facet dump
G - Geomview output (see below)
i - vertices incident to each Delaunay region
m - Mathematica output (2-d only, lifted to a paraboloid)
o - OFF format (dim, points, and facets as a paraboloid)
p - point coordinates (lifted to a paraboloid)
s - summary (stderr)
More formats:
Fa - area for each Delaunay region
FA - compute total area for option 's'
Fc - count plus coincident points for each Delaunay region
Fd - use cdd format for input (homogeneous with offset first)
FD - use cdd format for numeric output (offset first)
FF - facet dump without ridges
FI - ID of each Delaunay region
Fm - merge count for each Delaunay region (511 max)
FM - Maple output (2-d only, lifted to a paraboloid)
Fn - count plus neighboring region for each Delaunay region
FN - count plus neighboring region for each point
FO - options and precision constants
FP - nearest point and distance for each coincident point
FQ - command used for qdelaunay
Fs - summary: #int (8), dimension, #points, tot vertices, tot facets,
for output: #vertices, #Delaunay regions,
#coincident points, #non-simplicial regions
#real (2), max outer plane, min vertex
FS - sizes: #int (0)
#real (2), tot area, 0
Fv - count plus vertices for each Delaunay region
Fx - extreme points of Delaunay triangulation (on convex hull)
Geomview options (2-d and 3-d)
Ga - all points as dots
Gp - coplanar points and vertices as radii
Gv - vertices as spheres
Gi - inner planes only
Gn - no planes
Go - outer planes only
Gc - centrums
Gh - hyperplane intersections
Gr - ridges
GDn - drop dimension n in 3-d and 4-d output
Gt - transparent outer ridges to view 3-d Delaunay
Print options:
PAn - keep n largest Delaunay regions by area
Pdk:n - drop facet if normal[k] &lt;= n (default 0.0)
PDk:n - drop facet if normal[k] >= n
Pg - print good Delaunay regions (needs 'QGn' or 'QVn')
PFn - keep Delaunay regions whose area is at least n
PG - print neighbors of good regions (needs 'QGn' or 'QVn')
PMn - keep n Delaunay regions with most merges
Po - force output. If error, output neighborhood of facet
Pp - do not report precision problems
. - list of all options
- - one line descriptions of all options
</pre>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis
&#149; <a href="#input">in</a>put &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#controls">co</a>ntrols &#149; <a href="#graphics">gr</a>aphics
&#149; <a href="#notes">no</a>tes &#149; <a href="#conventions">co</a>nventions
&#149; <a href="#options">op</a>tions
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

File diff suppressed because it is too large Load Diff

693
xs/src/qhull/html/qh-eg.htm Normal file
View File

@ -0,0 +1,693 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Examples of Qhull</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a href="http://www.qhull.org">Home
page</a> for Qhull <br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To: </b><a href="#TOC">Qhull examples: Table of Contents</a> (please wait
while loading)<br>
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/half.html"><img
src="qh--half.gif" alt="[halfspace]" align="middle" width="100"
height="100"></a> Examples of Qhull</h1>
<p>This section of the Qhull manual will introduce you to Qhull
and its options. Each example is a file for viewing with <a
href="index.htm#geomview">Geomview</a>. You will need to
use a Unix computer with a copy of Geomview.
<p>
If you are not running Unix, you can view <a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/welcome.html">pictures</a>
for some of the examples. To understand Qhull without Geomview, try the
examples in <a href="qh-quick.htm#programs">Programs</a> and
<a href="qh-quick.htm#programs">Programs/input</a>. You can also try small
examples that you compute by hand. Use <a href="rbox.htm">rbox</a>
to generate examples.
<p>
To generate the Geomview examples, execute the shell script <tt>eg/q_eg</tt>.
It uses <tt>rbox</tt>. The shell script <tt>eg/q_egtest</tt> generates
test examples, and <tt>eg/q_test</tt> exercises the code. If you
find yourself viewing the inside of a 3-d example, use Geomview's
normalization option on the 'obscure' menu.</p>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<h2><a href="#TOP">&#187;</a><a name="TOC">Qhull examples: Table of
Contents </a></h2>
<ul>
<li><a href="#2d">2-d and 3-d examples</a></li>
<li><a href="#how">How Qhull adds a point</a></li>
<li><a href="#joggle">Triangulated output or joggled input</a></li>
<li><a href="#delaunay">Delaunay and Voronoi diagrams</a></li>
<li><a href="#merge">Facet merging for imprecision</a></li>
<li><a href="#4d">4-d objects</a></li>
<li><a href="#half">Halfspace intersections</a></li>
</ul>
<hr>
<ul>
<li><a href="#TOC">&#187;</a><a name="2d">2-d and 3-d examples</a><ul>
<li><a href="#01">eg.01.cube</a></li>
<li><a href="#02">eg.02.diamond.cube</a></li>
<li><a href="#03">eg.03.sphere</a></li>
<li><a href="#04">eg.04.circle</a></li>
<li><a href="#05">eg.05.spiral</a></li>
<li><a href="#06">eg.06.merge.square</a></li>
<li><a href="#07">eg.07.box</a></li>
<li><a href="#08a">eg.08a.cube.sphere</a></li>
<li><a href="#08b">eg.08b.diamond.sphere</a></li>
<li><a href="#09">eg.09.lens</a></li>
</ul>
</li>
<li><a href="#TOC">&#187;</a><a name="how">How Qhull adds a point</a><ul>
<li><a href="#10a">eg.10a.sphere.visible</a></li>
<li><a href="#10b">eg.10b.sphere.beyond</a></li>
<li><a href="#10c">eg.10c.sphere.horizon</a></li>
<li><a href="#10d">eg.10d.sphere.cone</a></li>
<li><a href="#10e">eg.10e.sphere.new</a></li>
<li><a href="#14">eg.14.sphere.corner</a></li>
</ul>
</li>
<li><a href="#TOC">&#187;</a> <a name="joggle">Triangulated output or joggled input</a>
<ul>
<li><a href="#15a">eg.15a.surface</a></li>
<li><a href="#15b">eg.15b.triangle</a></li>
<li><a href="#15c">eg.15c.joggle</a></li>
</ul>
<li><a href="#TOC">&#187;</a><a name="delaunay"> Delaunay and
Voronoi diagrams</a><ul>
<li><a href="#17a">eg.17a.delaunay.2</a></li>
<li><a href="#17b">eg.17b.delaunay.2i</a></li>
<li><a href="#17c">eg.17c.delaunay.2-3</a></li>
<li><a href="#17d">eg.17d.voronoi.2</a></li>
<li><a href="#17e">eg.17e.voronoi.2i</a></li>
<li><a href="#17f">eg.17f.delaunay.3</a></li>
<li><a href="#18a">eg.18a.furthest.2-3</a></li>
<li><a href="#18b">eg.18b.furthest-up.2-3</a></li>
<li><a href="#18c">eg.18c.furthest.2</a></li>
<li><a href="#19">eg.19.voronoi.region.3</a></li>
</ul>
</li>
<li><a href="#TOC">&#187;</a><a name="merge">Facet merging for
imprecision </a><ul>
<li><a href="#20">eg.20.cone</a></li>
<li><a href="#21a">eg.21a.roundoff.errors</a></li>
<li><a href="#21b">eg.21b.roundoff.fixed</a></li>
<li><a href="#22a">eg.22a.merge.sphere.01</a></li>
<li><a href="#22b">eg.22b.merge.sphere.-01</a></li>
<li><a href="#22c">eg.22c.merge.sphere.05</a></li>
<li><a href="#22d">eg.22d.merge.sphere.-05</a></li>
<li><a href="#23">eg.23.merge.cube</a></li>
</ul>
</li>
<li><a href="#TOC">&#187;</a><a name="4d">4-d objects</a><ul>
<li><a href="#24">eg.24.merge.cube.4d-in-3d</a></li>
<li><a href="#30">eg.30.4d.merge.cube</a></li>
<li><a href="#31">eg.31.4d.delaunay</a></li>
<li><a href="#32">eg.32.4d.octant</a></li>
</ul>
</li>
<li><a href="#TOC">&#187;</a><a name="half">Halfspace
intersections</a><ul>
<li><a href="#33a">eg.33a.cone</a></li>
<li><a href="#33b">eg.33b.cone.dual</a></li>
<li><a href="#33c">eg.33c.cone.halfspace</a></li>
</ul>
</li>
</ul>
<hr>
<h2><a href="#TOC">&#187;</a>2-d and 3-d examples</h2>
<h3><a href="#2d">&#187;</a><a name="01">rbox c D3 | qconvex G
&gt;eg.01.cube </a></h3>
<p>The first example is a cube in 3-d. The color of each facet
indicates its normal. For example, normal [0,0,1] along the Z
axis is (r=0.5, g=0.5, b=1.0). With the 'Dn' option in <tt>rbox</tt>,
you can generate hypercubes in any dimension. Above 7-d the
number of intermediate facets grows rapidly. Use '<a
href="qh-optt.htm#TFn">TFn</a>' to track qconvex's progress. Note
that each facet is a square that qconvex merged from coplanar
triangles.</p>
<h3><a href="#2d">&#187;</a><a name="02">rbox c d G3.0 | qconvex G
&gt;eg.02.diamond.cube </a></h3>
<p>The second example is a cube plus a diamond ('d') scaled by <tt>rbox</tt>'s
'G' option. In higher dimensions, diamonds are much simpler than
hypercubes. </p>
<h3><a href="#2d">&#187;</a><a name="03">rbox s 100 D3 | qconvex G
&gt;eg.03.sphere </a></h3>
<p>The <tt>rbox s</tt> option generates random points and
projects them to the d-sphere. All points should be on the convex
hull. Notice that random points look more clustered than you
might expect. You can get a smoother distribution by merging
facets and printing the vertices, e.g.,<i> rbox 1000 s | qconvex
A-0.95 p | qconvex G &gt;eg.99</i>.</p>
<h3><a href="#2d">&#187;</a><a name="04">rbox s 100 D2 | qconvex G
&gt;eg.04.circle </a></h3>
<p>In 2-d, there are many ways to generate a convex hull. One of
the earliest algorithms, and one of the fastest, is the 2-d
Quickhull algorithm [c.f., Preparata &amp; Shamos <a
href="index.htm#pre-sha85">'85</a>]. It was the model for
Qhull.</p>
<h3><a href="#2d">&#187;</a><a name="05">rbox 10 l | qconvex G
&gt;eg.05.spiral </a></h3>
<p>One rotation of a spiral.</p>
<h3><a href="#2d">&#187;</a><a name="06">rbox 1000 D2 | qconvex C-0.03
Qc Gapcv &gt;eg.06.merge.square</a></h3>
<p>This demonstrates how Qhull handles precision errors. Option '<a
href="qh-optc.htm#Cn">C-0.03</a>' requires a clearly convex angle
between adjacent facets. Otherwise, Qhull merges the facets. </p>
<p>This is the convex hull of random points in a square. The
facets have thickness because they must be outside all points and
must include their vertices. The colored lines represent the
original points and the spheres represent the vertices. Floating
in the middle of each facet is the centrum. Each centrum is at
least 0.03 below the planes of its neighbors. This guarantees
that the facets are convex.</p>
<h3><a href="#2d">&#187;</a><a name="07">rbox 1000 D3 | qconvex G
&gt;eg.07.box </a></h3>
<p>Here's the same distribution but in 3-d with Qhull handling
machine roundoff errors. Note the large number of facets. </p>
<h3><a href="#2d">&#187;</a><a name="08a">rbox c G0.4 s 500 | qconvex G
&gt;eg.08a.cube.sphere </a></h3>
<p>The sphere is just barely poking out of the cube. Try the same
distribution with randomization turned on ('<a
href="qh-optq.htm#Qr">Qr</a>'). This turns Qhull into a
randomized incremental algorithm. To compare Qhull and
randomization, look at the number of hyperplanes created and the
number of points partitioned. Don't compare CPU times since Qhull's
implementation of randomization is inefficient. The number of
hyperplanes and partitionings indicate the dominant costs for
Qhull. With randomization, you'll notice that the number of
facets created is larger than before. This is especially true as
you increase the number of points. It is because the randomized
algorithm builds most of the sphere before it adds the cube's
vertices.</p>
<h3><a href="#2d">&#187;</a><a name="08b">rbox d G0.6 s 500 | qconvex G
&gt;eg.08b.diamond.sphere </a></h3>
<p>This is a combination of the diamond distribution and the
sphere.</p>
<h3><a href="#2d">&#187;</a><a name="09">rbox 100 L3 G0.5 s | qconvex
G &gt;eg.09.lens </a></h3>
<p>Each half of the lens distribution lies on a sphere of radius
three. A directed search for the furthest facet below a point
(e.g., qh_findbest in <tt>geom.c</tt>) may fail if started from
an arbitrary facet. For example, if the first facet is on the
opposite side of the lens, a directed search will report that the
point is inside the convex hull even though it is outside. This
problem occurs whenever the curvature of the convex hull is less
than a sphere centered at the test point. </p>
<p>To prevent this problem, Qhull does not use directed search
all the time. When Qhull processes a point on the edge of the
lens, it partitions the remaining points with an exhaustive
search instead of a directed search (see qh_findbestnew in <tt>geom2.c</tt>).
</p>
<h2><a href="#TOC">&#187;</a>How Qhull adds a point</h2>
<h3><a href="#how">&#187;</a><a name="10a">rbox 100 s P0.5,0.5,0.5 |
qconvex Ga QG0 &gt;eg.10a.sphere.visible</a></h3>
<p>The next 4 examples show how Qhull adds a point. The point
[0.5,0.5,0.5] is at one corner of the bounding box. Qhull adds a
point using the beneath-beyond algorithm. First Qhull finds all
of the facets that are visible from the point. Qhull will replace
these facets with new facets.</p>
<h3><a href="#how">&#187;</a><a name="10b">rbox 100 s
P0.5,0.5,0.5|qconvex Ga QG-0 &gt;eg.10b.sphere.beyond </a></h3>
<p>These are the facets that are not visible from the point.
Qhull will keep these facets.</p>
<h3><a href="#how">&#187;</a><a name="10c">rbox 100 s P0.5,0.5,0.5 |
qconvex PG Ga QG0 &gt;eg.10c.sphere.horizon </a></h3>
<p>These facets are the horizon facets; they border the visible
facets. The inside edges are the horizon ridges. Each horizon
ridge will form the base for a new facet.</p>
<h3><a href="#how">&#187;</a><a name="10d">rbox 100 s P0.5,0.5,0.5 |
qconvex Ga QV0 PgG &gt;eg.10d.sphere.cone </a></h3>
<p>This is the cone of points from the new point to the horizon
facets. Try combining this image with <tt>eg.10c.sphere.horizon</tt>
and <tt>eg.10a.sphere.visible</tt>.
</p>
<h3><a href="#how">&#187;</a><a name="10e">rbox 100 s P0.5,0.5,0.5 |
qconvex Ga &gt;eg.10e.sphere.new</a></h3>
<p>This is the convex hull after [0.5,0.5,0.5] has been added.
Note that in actual practice, the above sequence would never
happen. Unlike the randomized algorithms, Qhull always processes
a point that is furthest in an outside set. A point like
[0.5,0.5,0.5] would be one of the first points processed.</p>
<h3><a href="#how">&#187;</a><a name="14">rbox 100 s P0.5,0.5,0.5 |
qhull Ga QV0g Q0 &gt;eg.14.sphere.corner</a></h3>
<p>The '<a href="qh-optq.htm#QVn">QVn</a>', '<a
href="qh-optq.htm#QGn">QGn </a>' and '<a href="qh-optp.htm#Pdk">Pdk</a>'
options define good facets for Qhull. In this case '<a
href="qh-optq.htm#QVn">QV0</a>' defines the 0'th point
[0.5,0.5,0.5] as the good vertex, and '<a href="qh-optq.htm#Qg">Qg</a>'
tells Qhull to only build facets that might be part of a good
facet. This technique reduces output size in low dimensions. It
does not work with facet merging.</p>
<h2><a href="#TOC">&#187;</a>Triangulated output or joggled input</h2>
<h3><a href="#joggle">&#187;</a><a name="15a">rbox 500 W0 | qconvex QR0 Qc Gvp &gt;eg.15a.surface</a></h3>
<p>This is the convex hull of 500 points on the surface of
a cube. Note the large, non-simplicial facet for each face.
Qhull merges non-convex facets.
<p>If the facets were not merged, Qhull
would report precision problems. For example, turn off facet merging
with option '<a href="qh-optq.htm#Q0">Q0</a>'. Qhull may report concave
facets, flipped facets, or other precision errors:
<blockquote>
rbox 500 W0 | qhull QR0 Q0
</blockquote>
<p>
<h3><a href="#joggle">&#187;</a><a name="15b">rbox 500 W0 | qconvex QR0 Qt Qc Gvp &gt;eg.15b.triangle</a></h3>
<p>Like the previous examples, this is the convex hull of 500 points on the
surface of a cube. Option '<a href="qh-optq.htm#Qt">Qt</a>' triangulates the
non-simplicial facets. Triangulated output is
particularly helpful for Delaunay triangulations.
<p>
<h3><a href="#joggle">&#187;</a><a name="15c">rbox 500 W0 | qconvex QR0 QJ5e-2 Qc Gvp &gt;eg.15c.joggle</a></h3>
<p>This is the convex hull of 500 joggled points on the surface of
a cube. The option '<a href="qh-optq.htm#QJn">QJ5e-2</a>'
sets a very large joggle to make the effect visible. Notice
that all of the facets are triangles. If you rotate the cube,
you'll see red-yellow lines for coplanar points.
<p>
With option '<a href="qh-optq.htm#QJn">QJ</a>', Qhull joggles the
input to avoid precision problems. It adds a small random number
to each input coordinate. If a precision
error occurs, it increases the joggle and tries again. It repeats
this process until no precision problems occur.
<p>
Joggled input is a simple solution to precision problems in
computational geometry. Qhull can also merge facets to handle
precision problems. See <a href="qh-impre.htm#joggle">Merged facets or joggled input</a>.
<h2><a href="#TOC">&#187;</a>Delaunay and Voronoi diagrams</h2>
<h3><a href="#delaunay">&#187;</a><a name="17a">qdelaunay Qt
&lt;eg.data.17 GnraD2 &gt;eg.17a.delaunay.2</a></h3>
<p>
The input file, <tt>eg.data.17</tt>, consists of a square, 15 random
points within the outside half of the square, and 6 co-circular
points centered on the square.
<p>The Delaunay triangulation is the triangulation with empty
circumcircles. The input for this example is unusual because it
includes six co-circular points. Every triangular subset of these
points has the same circumcircle. Option '<a href="qh-optq.htm#Qt">Qt</a>'
triangulates the co-circular facet.</p>
<h3><a href="#delaunay">&#187;</a><a name="17b">qdelaunay &lt;eg.data.17
GnraD2 &gt;eg.17b.delaunay.2i</a></h3>
<p>This is the same example without triangulated output ('<a href="qh-optq.htm#Qt">Qt</a>'). qdelaunay
merges the non-unique Delaunay triangles into a hexagon.</p>
<h3><a href="#delaunay">&#187;</a><a name="17c">qdelaunay &lt;eg.data.17
Ga &gt;eg.17c.delaunay.2-3 </a></h3>
<p>This is how Qhull generated both diagrams. Use Geomview's
'obscure' menu to turn off normalization, and Geomview's
'cameras' menu to turn off perspective. Then load this <a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/delaunay.html">object</a>
with one of the previous diagrams.</p>
<p>The points are lifted to a paraboloid by summing the squares
of each coordinate. These are the light blue points. Then the
convex hull is taken. That's what you see here. If you look up
the Z-axis, you'll see that points and edges coincide.</p>
<h3><a href="#delaunay">&#187;</a><a name="17d">qvoronoi QJ
&lt;eg.data.17 Gna &gt;eg.17d.voronoi.2</a></h3>
<p>The Voronoi diagram is the dual of the Delaunay triangulation.
Here you see the original sites and the Voronoi vertices.
Notice the each
vertex is equidistant from three sites. The edges indicate the
Voronoi region for a site. Qhull does not draw the unbounded
edges. Instead, it draws extra edges to close the unbounded
Voronoi regions. You may find it helpful to enclose the input
points in a square. You can compute the unbounded
rays from option '<a href="qh-optf.htm#Fo2">Fo</a>'.
</p>
<p>Instead
of triangulated output ('<a href="qh-optq.htm#Qt">Qt</a>'), this
example uses joggled input ('<a href="qh-optq.htm#QJn">QJ</a>').
Normally, you should use neither 'QJ' nor 'Qt' for Voronoi diagrams.
<h3><a href="#delaunay">&#187;</a><a name="17e">qvoronoi &lt;eg.data.17
Gna &gt;eg.17e.voronoi.2i </a></h3>
<p>This looks the same as the previous diagrams, but take a look
at the data. Run 'qvoronoi p &lt;eg/eg.data.17'. This prints
the Voronoi vertices.
<p>With 'QJ', there are four nearly identical Voronoi vertices
within 10^-11 of the origin. Option 'QJ' joggled the input. After the joggle,
the cocircular
input sites are no longer cocircular. The corresponding Voronoi vertices are
similar but not identical.
<p>This example does not use options 'Qt' or 'QJ'. The cocircular
input sites define one Voronoi vertex near the origin. </p>
<p>Option 'Qt' would triangulate the corresponding Delaunay region into
four triangles. Each triangle is assigned the same Voronoi vertex.</p>
<h3><a href="#delaunay">&#187;</a><a name="17f"> rbox c G0.1 d |
qdelaunay Gt Qz &lt;eg.17f.delaunay.3 </a></h3>
<p>This is the 3-d Delaunay triangulation of a small cube inside
a prism. Since the outside ridges are transparent, it shows the
interior of the outermost facets. If you slice open the
triangulation with Geomview's ginsu, you will see that the innermost
facet is a cube. Note the use of '<a href="qh-optq.htm#Qz">Qz</a>'
to add a point &quot;at infinity&quot;. This avoids a degenerate
input due to cospherical points.</p>
<h3><a href="#delaunay">&#187;</a><a name="18a">rbox 10 D2 d | qdelaunay
Qu G &gt;eg.18a.furthest.2-3 </a></h3>
<p>The furthest-site Voronoi diagram contains Voronoi regions for
points that are <i>furthest </i>from an input site. It is the
dual of the furthest-site Delaunay triangulation. You can
determine the furthest-site Delaunay triangulation from the
convex hull of the lifted points (<a href="#17c">eg.17c.delaunay.2-3</a>).
The upper convex hull (blue) generates the furthest-site Delaunay
triangulation. </p>
<h3><a href="#delaunay">&#187;</a><a name="18b">rbox 10 D2 d | qdelaunay
Qu Pd2 G &gt;eg.18b.furthest-up.2-3</a></h3>
<p>This is the upper convex hull of the preceding example. The
furthest-site Delaunay triangulation is the projection of the
upper convex hull back to the input points. The furthest-site
Voronoi vertices are the circumcenters of the furthest-site
Delaunay triangles. </p>
<h3><a href="#delaunay">&#187;</a><a name="18c">rbox 10 D2 d | qvoronoi
Qu Gv &gt;eg.18c.furthest.2</a></h3>
<p>This shows an incomplete furthest-site Voronoi diagram. It
only shows regions with more than two vertices. The regions are
artificially truncated. The actual regions are unbounded. You can
print the regions' vertices with 'qvoronoi Qu <a
href="qh-opto.htm#o">o</a>'. </p>
<p>Use Geomview's 'obscure' menu to turn off normalization, and
Geomview's 'cameras' menu to turn off perspective. Then load this
with the upper convex hull.</p>
<h3><a href="#delaunay">&#187;</a><a name="19">rbox 10 D3 | qvoronoi QV5
p | qconvex G &gt;eg.19.voronoi.region.3 </a></h3>
<p>This shows the Voronoi region for input site 5 of a 3-d
Voronoi diagram.</p>
<h2><a href="#TOC">&#187;</a>Facet merging for imprecision</h2>
<h3><a href="#merge">&#187;</a><a name="20">rbox r s 20 Z1 G0.2 |
qconvex G &gt;eg.20.cone </a></h3>
<p>There are two things unusual about this <a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/cone.html">cone</a>.
One is the large flat disk at one end and the other is the
rectangles about the middle. That's how the points were
generated, and if those points were exact, this is the correct
hull. But <tt>rbox</tt> used floating point arithmetic to
generate the data. So the precise convex hull should have been
triangles instead of rectangles. By requiring convexity, Qhull
has recovered the original design.</p>
<h3><a href="#merge">&#187;</a><a name="21a">rbox 200 s | qhull Q0
R0.01 Gav Po &gt;eg.21a.roundoff.errors </a></h3>
<p>This is the convex hull of 200 cospherical points with
precision errors ignored ('<a href="qh-optq.htm#Q0">Q0</a>'). To
demonstrate the effect of roundoff error, we've added a random
perturbation ('<a href="qh-optc.htm#Rn">R0.01</a>') to every
distance and hyperplane calculation. Qhull, like all other convex
hull algorithms with floating point arithmetic, makes
inconsistent decisions and generates wildly wrong results. In
this case, one or more facets are flipped over. These facets have
the wrong color. You can also turn on 'normals' in Geomview's
appearances menu and turn off 'facing normals'. There should be
some white lines pointing in the wrong direction. These
correspond to flipped facets. </p>
<p>Different machines may not produce this picture. If your
machine generated a long error message, decrease the number of
points or the random perturbation ('<a href="qh-optc.htm#Rn">R0.01</a>').
If it did not report flipped facets, increase the number of
points or perturbation.</p>
<h3><a href="#merge">&#187;</a><a name="21b">rbox 200 s | qconvex Qc
R0.01 Gpav &gt;eg.21b.roundoff.fixed </a></h3>
<p>Qhull handles the random perturbations and returns an
imprecise <a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/fixed.html">sphere</a>.
In this case, the output is a weak approximation to the points.
This is because a random perturbation of '<a
href="qh-optc.htm#Rn">R0.01 </a>' is equivalent to losing all but
1.8 digits of precision. The outer planes float above the points
because Qhull needs to allow for the maximum roundoff error. </p>
<p>
If you start with a smaller random perturbation, you
can use joggle ('<a href="qh-optq.htm#QJn">QJn</a>') to avoid
precision problems. You need to set <i>n</i> significantly
larger than the random perturbation. For example, try
'rbox 200 s | qconvex Qc R1e-4 QJ1e-1'.
<h3><a href="#merge">&#187;</a><a name="22a">rbox 1000 s| qconvex C0.01
Qc Gcrp &gt;eg.22a.merge.sphere.01</a></h3>
<h3><a href="#merge">&#187;</a><a name="22b">rbox 1000 s| qconvex
C-0.01 Qc Gcrp &gt;eg.22b.merge.sphere.-01</a></h3>
<h3><a href="#merge">&#187;</a><a name="22c">rbox 1000 s| qconvex C0.05
Qc Gcrpv &gt;eg.22c.merge.sphere.05</a></h3>
<h3><a href="#merge">&#187;</a><a name="22d">rbox 1000 s| qconvex
C-0.05 Qc Gcrpv &gt;eg.22d.merge.sphere.-05</a></h3>
<p>The next four examples compare post-merging and pre-merging ('<a
href="qh-optc.htm#Cn2">Cn</a>' vs. '<a href="qh-optc.htm#Cn">C-n</a>').
Qhull uses '-' as a flag to indicate pre-merging.</p>
<p>Post-merging happens after the convex hull is built. During
post-merging, Qhull repeatedly merges an independent set of
non-convex facets. For a given set of parameters, the result is
about as good as one can hope for.</p>
<p>Pre-merging does the same thing as post-merging, except that
it happens after adding each point to the convex hull. With
pre-merging, Qhull guarantees a convex hull, but the facets are
wider than those from post-merging. If a pre-merge option is not
specified, Qhull handles machine round-off errors.</p>
<p>You may see coplanar points appearing slightly outside
the facets of the last example. This is becomes Geomview moves
line segments forward toward the viewer. You can avoid the
effect by setting 'lines closer' to '0' in Geomview's camera menu.
<h3><a href="#merge">&#187;</a><a name="23">rbox 1000 | qconvex s
Gcprvah C0.1 Qc &gt;eg.23.merge.cube</a></h3>
<p>Here's the 3-d imprecise cube with all of the Geomview
options. There's spheres for the vertices, radii for the coplanar
points, dots for the interior points, hyperplane intersections,
centrums, and inner and outer planes. The radii are shorter than
the spheres because this uses post-merging ('<a href="qh-optc.htm#Cn2">C0.1</a>')
instead of pre-merging.
<h2><a href="#TOC">&#187;</a>4-d objects</h2>
<p>With Qhull and Geomview you can develop an intuitive sense of
4-d surfaces. When you get into trouble, think of viewing the
surface of a 3-d sphere in a 2-d plane.</p>
<h3><a href="#4d">&#187;</a><a name="24">rbox 5000 D4 | qconvex s GD0v
Pd0:0.5 C-0.02 C0.1 &gt;eg.24.merge.cube.4d-in-3d</a></h3>
<p>Here's one facet of the imprecise cube in 4-d. It's projected
into 3-d (the '<a href="qh-optg.htm#GDn">GDn</a>' option drops
dimension n). Each ridge consists of two triangles between this
facet and the neighboring facet. In this case, Geomview displays
the topological ridges, i.e., as triangles between three
vertices. That is why the cube looks lopsided.</p>
<h3><a href="#4d">&#187;</a><a name="30">rbox 5000 D4 | qconvex s
C-0.02 C0.1 Gh &gt;eg.30.4d.merge.cube </a></h3>
<p><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/4dcube.html">Here</a>
is the equivalent in 4-d of the imprecise <a href="#06">square</a>
and imprecise <a href="#23">cube</a>. It's the imprecise convex
hull of 5000 random points in a hypercube. It's a full 4-d object
so Geomview's <tt>ginsu </tt>does not work. If you view it in
Geomview, you'll be inside the hypercube. To view 4-d objects
directly, either load the <tt>4dview</tt> module or the <tt>ndview
</tt>module. For <tt>4dview</tt>, you must have started Geomview
in the same directory as the object. For <tt>ndview</tt>,
initialize a set of windows with the prefab menu, and load the
object through Geomview. The <tt>4dview</tt> module includes an
option for slicing along any hyperplane. If you do this in the x,
y, or z plane, you'll see the inside of a hypercube.</p>
<p>The '<a href="qh-optg.htm#Gh">Gh</a>' option prints the
geometric intersections between adjacent facets. Note the strong
convexity constraint for post-merging ('<a href="qh-optc.htm#Cn2">C0.1</a>').
It deletes the small facets.</p>
<h3><a href="#4d">&#187;</a><a name="31">rbox 20 D3 | qdelaunay G
&gt;eg.31.4d.delaunay </a></h3>
<p>The Delaunay triangulation of 3-d sites corresponds to a 4-d
convex hull. You can't see 4-d directly but each facet is a 3-d
object that you can project to 3-d. This is exactly the same as
projecting a 2-d facet of a soccer ball onto a plane.</p>
<p>Here we see all of the facets together. You can use Geomview's
<tt>ndview</tt> to look at the object from several directions.
Try turning on edges in the appearance menu. You'll notice that
some edges seem to disappear. That's because the object is
actually two sets of overlapping facets.</p>
<p>You can slice the object apart using Geomview's <tt>4dview</tt>.
With <tt>4dview</tt>, try slicing along the w axis to get a
single set of facets and then slice along the x axis to look
inside. Another interesting picture is to slice away the equator
in the w dimension.</p>
<h3><a href="#4d">&#187;</a><a name="32">rbox 30 s D4 | qconvex s G
Pd0d1d2D3</a></h3>
<p>This is the positive octant of the convex hull of 30 4-d
points. When looking at 4-d, it's easier to look at just a few
facets at once. If you picked a facet that was directly above
you, then that facet looks exactly the same in 3-d as it looks in
4-d. If you pick several facets, then you need to imagine that
the space of a facet is rotated relative to its neighbors. Try
Geomview's <tt>ndview</tt> on this example.</p>
<h2><a href="#TOC">&#187;</a>Halfspace intersections</h2>
<h3><a href="#half">&#187;</a><a name="33a">rbox 10 r s Z1 G0.3 |
qconvex G &gt;eg.33a.cone </a></h3>
<h3><a href="#half">&#187;</a><a name="33b">rbox 10 r s Z1 G0.3 |
qconvex FV n | qhalf G &gt;eg.33b.cone.dual</a></h3>
<h3><a href="#half">&#187;</a><a name="33c">rbox 10 r s Z1 G0.3 |
qconvex FV n | qhalf Fp | qconvex G &gt;eg.33c.cone.halfspace</a></h3>
<p>These examples illustrate halfspace intersection. The first
picture is the convex hull of two 20-gons plus an apex. The
second picture is the dual of the first. Try loading <a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/half.html">both</a>
at once. Each vertex of the second picture corresponds to a facet
or halfspace of the first. The vertices with four edges
correspond to a facet with four neighbors. Similarly the facets
correspond to vertices. A facet's normal coefficients divided by
its negative offset is the vertice's coordinates. The coordinates
are the intersection of the original halfspaces. </p>
<p>The third picture shows how Qhull can go back and forth
between equivalent representations. It starts with a cone,
generates the halfspaces that define each facet of the cone, and
then intersects these halfspaces. Except for roundoff error, the
third picture is a duplicate of the first. </p>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home
page for Qhull</a> <br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual: Table of Contents</a><br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To: </b><a href="#TOC">Qhull examples: Table of Contents</a> (please wait
while loading)<br>
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

1547
xs/src/qhull/html/qh-faq.htm Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,106 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Qhull Downloads</title>
</head>
<body>
<!-- Navigation links -->
<p><b>Up:</b> <a href="http://www.qhull.org"><i>Qhull Home Page</i></a><br>
</p>
<hr>
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/cone.html"><img
src="../html/qh--cone.gif" alt="[CONE]" align="middle"
width="100" height="100"></a> Qhull Downloads</h1>
<ul>
<li><a href="http://www.qhull.org">Qhull Home Page</a> <p>Qhull
computes the convex hull, Delaunay triangulation, Voronoi diagram, halfspace
intersection about a point, furthest-site Delaunay
triangulation, and furthest-site Voronoi diagram. It
runs in 2-d, 3-d, 4-d, and higher dimensions. It
implements the Quickhull algorithm for computing the
convex hull. Qhull handles roundoff errors from floating
point arithmetic. It can approximate a convex hull. </p>
<p>Visit <a href="http://www.qhull.org/news">Qhull News</a>
for news, bug reports, change history, and users.
If you use Qhull 2003.1 or 2009.1, please upgrade to 2015.2 or apply
<a href="http://www.qhull.org/download/poly.c-qh_gethash.patch">poly.c-qh_gethash.patch</a>.</p>
</li>
<li><a
href="http://www.qhull.org/download/qhull-2015.2.zip">Download:
Qhull 2015.2 for Windows 10, 8, 7, XP, and NT</a> (2.6 MB,
<a href="http://www.qhull.org/README.txt">readme</a>,
<a href="http://www.qhull.org/download/qhull-2015.2.md5sum">md5sum</a>,
<a href="http://www.qhull.org/download/qhull-2015.2.zip.md5sum">contents</a>)
<p>Type: console programs for Windows (32- or 64-bit)</p>
<p>Includes 32-bit executables, documentation, and sources files. It runs in a
command window. Qhull may be compiled for 64-bits.</p>
</li>
<li><a href="http://github.com/qhull/qhull/wiki">GitHub Qhull</a> (git@github.com:qhull/qhull.git)
<p>Type: git repository for Qhull. See recent <a href="https://github.com/qhull/qhull/blob/master/src/Changes.txt">Changes.txt</a></p>
<p>Includes documentation, source files, C++ interface, and test programs. It builds with gcc, mingw,
CMake, DevStudio, and Qt Creator.
</p>
</li>
<li><a href="http://www.qhull.org/download/qhull-2015-src-7.2.0.tgz">Download: Qhull 2015.2 for Unix</a> (1.0 MB,
<a href="http://www.qhull.org/README.txt">readme</a>,
<a href="http://www.qhull.org/download/qhull-2015.2.md5sum">md5sum</a>,
<a href="http://www.qhull.org/download/qhull-2015-src-7.2.0.tgz.md5sum">contents</a>)
<p>Type: C/C++ source code for 32-bit and 64-bit architectures. See <a href="http://www.qhull.org/src/Changes.txt">Changes.txt</a></p>
<p>Includes documentation, source files, Makefiles, CMakeLists.txt, DevStudio projects, and Qt projects.
Includes preliminary C++ support.</p>
<p>Download and search sites for pre-built packages include
<ul>
<li><a href="https://launchpad.net/ubuntu/+source/qhull">https://launchpad.net/ubuntu/+source/qhull</a>
<li><a href="http://software.opensuse.org/download.html?project=openSUSE%3AFactory&package=qhull">http://software.opensuse.org/download.html?project=openSUSE%3AFactory&package=qhull</a>
<li><a href="https://www.archlinux.org/packages/extra/i686/qhull/">https://www.archlinux.org/packages/extra/i686/qhull/</a>
<li><a href="http://rpmfind.net/linux/rpm2html/search.php?query=qhull">http://rpmfind.net/linux/rpm2html/search.php?query=qhull</a>
<li><a href="http://rpm.pbone.net/index.php3/stat/3/srodzaj/1/search/qhull">http://rpm.pbone.net/index.php3/stat/3/srodzaj/1/search/qhull</a>
</ul></p>
</li>
<li><a
href="http://dl.acm.org/author_page.cfm?id=81100129162">Download:
Article about Qhull</a> (307K)
<p>Type: PDF on ACM Digital Library (from this page only)</p>
<p>Barber, C.B., Dobkin, D.P., and Huhdanpaa, H.T.,
&quot;The Quickhull algorithm for convex hulls,&quot; <i>ACM
Transactions on Mathematical Software</i>, 22(4):469-483, Dec 1996 [<a
href="http://portal.acm.org/citation.cfm?doid=235815.235821">abstract</a>].</p>
</li>
<li><a
href="http://www.qhull.org/download/qhull-1.0.tar.gz">Download:
Qhull version 1.0</a> (92K) <p>Type: C source code for
32-bit architectures </p>
<p>Version 1.0 is a fifth the size of version 2.4. It
computes convex hulls and Delaunay triangulations. If a
precision error occurs, it stops with an error message.
It reports an initialization error for inputs made with
0/1 coordinates. </p>
<p>Version 1.0 compiles on a PC with Borland C++ 4.02 for
Win32 and DOS Power Pack. The options for rbox are
&quot;bcc32 -WX -w- -O2-e -erbox -lc rbox.c&quot;. The
options for qhull are the same. [D. Zwick] </p>
</li>
</ul>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org"><i>Qhull Home Page</i></a><br>
<!-- GC common information --></p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="../html/qh--geom.gif" alt="[HOME]"
align="middle"></a> <i>The Geometry Center Home Page</i> </p>
<p>Comments to: <a href="mailto:qhull@qhull.org">qhull@qhull.org</a><br>
</body>
</html>

View File

@ -0,0 +1,826 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Imprecision in Qhull</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a href="http://www.qhull.org">Home
page</a> for Qhull <br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of
Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To: </b><a href="#TOC">Qhull imprecision</a>: Table of Contents
(please wait while loading)
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/4dcube.html"><img
src="qh--4d.gif" alt="[4-d cube]" align="middle" width="100"
height="100"></a> Imprecision in Qhull</h1>
<p>This section of the Qhull manual discusses the problems caused
by coplanar points and why Qhull uses options '<a
href="qh-optc.htm#C0">C-0</a>' or '<a href="qh-optq.htm#Qx">Qx</a>'
by default. If you ignore precision issues with option '<a
href="qh-optq.htm#Q0">Q0</a>', the output from Qhull can be
arbitrarily bad. Qhull avoids precision problems if you merge facets (the default) or joggle
the input ('<a
href="qh-optq.htm#QJn">QJ</a>'). </p>
<p>Use option '<a href="qh-optt.htm#Tv">Tv</a>' to verify the
output from Qhull. It verifies that adjacent facets are clearly
convex. It verifies that all points are on or below all facets. </p>
<p>Qhull automatically tests for convexity if it detects
precision errors while constructing the hull. </p>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<h2><a href="#TOP">&#187;</a><a name="TOC">Qhull
imprecision: Table of Contents </a></h2>
<ul>
<li><a href="#prec">Precision problems</a></li>
<li><a href="#joggle">Merged facets or joggled input</a></li>
<li><a href="#delaunay">Delaunay triangulations</a></li>
<li><a href="#halfspace">Halfspace intersection/a></li>
<li><a href="#imprecise">Merged facets</a></li>
<li><a href="#how">How Qhull merges facets</a></li>
<li><a href="#limit">Limitations of merged facets</a></li>
<li><a href="#injoggle">Joggled input</a></li>
<li><a href="#exact">Exact arithmetic</a></li>
<li><a href="#approximate">Approximating a convex hull</a></li>
</ul>
<hr>
<h2><a href="#TOC">&#187;</a><a name="prec">Precision problems</a></h2>
<p>Since Qhull uses floating point arithmetic, roundoff error
occurs with each calculation. This causes problems for
geometric algorithms. Other floating point codes for convex
hulls, Delaunay triangulations, and Voronoi diagrams also suffer
from these problems. Qhull handles most of them.</p>
<p>There are several kinds of precision errors:</p>
<ul>
<li>Representation error occurs when there are not enough
digits to represent a number, e.g., 1/3.</li>
<li>Measurement error occurs when the input coordinates are
from measurements. </li>
<li>Roundoff error occurs when a calculation is rounded to a
fixed number of digits, e.g., a floating point
calculation.</li>
<li>Approximation error occurs when the user wants an
approximate result because the exact result contains too
much detail.</li>
</ul>
<p>Under imprecision, calculations may return erroneous results.
For example, roundoff error can turn a small, positive number
into a small, negative number. See Milenkovic [<a
href="index.htm#mile93">'93</a>] for a discussion of <em>strict
robust geometry</em>. Qhull does not meet Milenkovic's criterion
for accuracy. Qhull's error bound is empirical instead of
theoretical.</p>
<p>Qhull 1.0 checked for precision errors but did not handle
them. The output could contain concave facets, facets with
inverted orientation (&quot;flipped&quot; facets), more than two
facets adjacent to a ridge, and two facets with exactly the same
set of vertices.</p>
<p>Qhull 2.4 and later automatically handles errors due to
machine round-off. Option '<a href="qh-optc.htm#C0">C-0</a>' or '<a
href="qh-optq.htm#Qx">Qx</a>' is set by default. In 5-d and
higher, the output is clearly convex but an input point could be
outside of the hull. This may be corrected by using option '<a
href="qh-optc.htm#C0">C-0</a>', but then the output may contain
wide facets.</p>
<p>Qhull 2.5 and later provides option '<a href="qh-optq.htm#QJn">QJ</a>'
to joggled input. Each input coordinate is modified by a
small, random quantity. If a precision error occurs, a larger
modification is tried. When no precision errors occur, Qhull is
done. </p>
<p>Qhull 3.1 and later provides option '<a href="qh-optq.htm#Qt">Qt</a>'
for triangulated output. This removes the need for
joggled input ('<a href="qh-optq.htm#QJn">QJ</a>').
Non-simplicial facets are triangulated.
The facets may have zero area.
Triangulated output is particularly useful for Delaunay triangulations.</p>
<p>By handling round-off errors, Qhull can provide a variety of
output formats. For example, it can return the halfspace that
defines each facet ('<a href="qh-opto.htm#n">n</a>'). The
halfspaces include roundoff error. If the halfspaces were exact,
their intersection would return the original extreme points. With
imprecise halfspaces and exact arithmetic, nearly incident points
may be returned for an original extreme point. By handling
roundoff error, Qhull returns one intersection point for each of
the original extreme points. Qhull may split or merge an extreme
point, but this appears to be unlikely.</p>
<p>The following pipe implements the identity function for
extreme points (with roundoff):
<blockquote>
qconvex <a href="qh-optf.htm#FV">FV</a> <a
href="qh-opto.htm#n">n</a> | qhalf <a href="qh-optf.htm#Fp">Fp</a>
</blockquote>
<p>Bernd Gartner published his
<a href=http://www.inf.ethz.ch/personal/gaertner/miniball.html>Miniball</a>
algorithm ["Fast and robust smallest enclosing balls", <i>Algorithms - ESA '99</i>, LNCS 1643].
It uses floating point arithmetic and a carefully designed primitive operation.
It is practical to 20-D or higher, and identifies at least two points on the
convex hull of the input set. Like Qhull, it is an incremental algorithm that
processes points furthest from the intermediate result and ignores
points that are close to the intermediate result.
<h2><a href="#TOC">&#187;</a><a name="joggle">Merged facets or joggled input</a></h2>
<p>This section discusses the choice between merged facets and joggled input.
By default, Qhull uses merged facets to handle
precision problems. With option '<a href="qh-optq.htm#QJn">QJ</a>',
the input is joggled. See <a href="qh-eg.htm#joggle">examples</a>
of joggled input and triangulated output.
<ul>
<li>Use merged facets (the default)
when you want non-simplicial output (e.g., the faces of a cube).
<li>Use merged facets and triangulated output ('<a href="qh-optq.htm#Qt">Qt</a>') when
you want simplicial output and coplanar facets (e.g., triangles for a Delaunay triangulation).
<li>Use joggled input ('<a href="qh-optq.htm#QJn">QJ</a>') when you need clearly-convex,
simplicial output.
</ul>
<p>The choice between merged facets and joggled input depends on
the application. Both run about the same speed. Joggled input may
be faster if the initial joggle is sufficiently large to avoid
precision errors.
<p>Most applications should used merged facets
with triangulated output. </p>
<p>Use merged facets (the
default, '<a href="qh-optc.htm#C0">C-0</a>')
or triangulated output ('<a href="qh-optq.htm#Qt">Qt</a>') if </p>
<ul>
<li>Your application supports non-simplicial facets, or
it allows degenerate, simplicial facets (option '<a href="qh-optq.htm#Qt">Qt</a>'). </li>
<li>You do not want the input modified. </li>
<li>You want to set additional options for approximating the
hull. </li>
<li>You use single precision arithmetic (<a href="../src/libqhull/user.h#realT">realT</a>).
</li>
</ul>
<p>Use joggled input ('<a href="qh-optq.htm#QJn">QJ</a>') if </p>
<ul>
<li>Your application needs clearly convex, simplicial output</li>
<li>Your application supports perturbed input points and narrow triangles.</li>
<li>Seven significant digits is sufficient accuracy.</li>
</ul>
<p>You may use both techniques or combine joggle with
post-merging ('<a href="qh-optc.htm#Cn2">Cn</a>'). </p>
<p>Other researchers have used techniques similar to joggled
input. Sullivan and Beichel [ref?] randomly perturb the input
before computing the Delaunay triangulation. Corkum and Wyllie
[news://comp.graphics, 1990] randomly rotate a polytope before
testing point inclusion. Edelsbrunner and Mucke [Symp. Comp.
Geo., 1988] and Yap [J. Comp. Sys. Sci., 1990] symbolically
perturb the input to remove singularities. </p>
<p>Merged facets ('<a href="qh-optc.htm#C0">C-0</a>') handles
precision problems directly. If a precision problem occurs, Qhull
merges one of the offending facets into one of its neighbors.
Since all precision problems in Qhull are associated with one or
more facets, Qhull will either fix the problem or attempt to merge the
last remaining facets. </p>
<h2><a href="#TOC">&#187;</a><a name="delaunay">Delaunay
triangulations </a></h2>
<p>Programs that use Delaunay triangulations traditionally assume
a triangulated input. By default, <a href=qdelaun.htm>qdelaunay</a>
merges regions with cocircular or cospherical input sites.
If you want a simplicial triangulation
use triangulated output ('<a href="qh-optq.htm#Qt">Qt</a>') or joggled
input ('<a href="qh-optq.htm#QJn">QJ</a>').
<p>For Delaunay triangulations, triangulated
output should produce good results. All points are within roundoff error of
a paraboloid. If two points are nearly incident, one will be a
coplanar point. So all points are clearly separated and convex.
If qhull reports deleted vertices, the triangulation
may contain serious precision faults. Deleted vertices are reported
in the summary ('<a href="qh-opto.htm#s">s</a>', '<a href="qh-optf.htm#Fs">Fs</a>'</p>
<p>You should use option '<a href="qh-optq.htm#Qbb">Qbb</a>' with Delaunay
triangulations. It scales the last coordinate and may reduce
roundoff error. It is automatically set for <a href=qdelaun.htm>qdelaunay</a>,
<a href=qvoronoi.htm>qvoronoi</a>, and option '<a
href="qh-optq.htm#QJn">QJ</a>'.</p>
<p>Edelsbrunner, H, <i>Geometry and Topology for Mesh Generation</i>, Cambridge University Press, 2001.
Good mathematical treatise on Delaunay triangulation and mesh generation for 2-d
and 3-d surfaces. The chapter on surface simplification is
particularly interesting. It is similar to facet merging in Qhull.
<p>Veron and Leon published an algorithm for shape preserving polyhedral
simplification with bounded error [<i>Computers and Graphics</i>, 22.5:565-585, 1998].
It remove nodes using front propagation and multiple remeshing.
<h2><a href="#TOC">&#187;</a><a name="halfspace">Halfspace intersection</a></h2>
<p>
The identity pipe for Qhull reveals some precision questions for
halfspace intersections. The identity pipe creates the convex hull of
a set of points and intersects the facets' hyperplanes. It should return the input
points, but narrow distributions may drop points while offset distributions may add
points. It may be better to normalize the input set about the origin.
For example, compare the first results with the later two results: [T. Abraham]
<blockquote>
rbox 100 s t | tee r | qconvex FV n | qhalf Fp | cat - r | /bin/sort -n | tail
<br>
rbox 100 L1e5 t | tee r | qconvex FV n | qhalf Fp | cat - r | /bin/sort -n | tail
<br>
rbox 100 s O10 t | tee r | qconvex FV n | qhalf Fp | cat - r | /bin/sort -n | tail
</blockquote>
<h2><a href="#TOC">&#187;</a><a name="imprecise">Merged facets </a></h2>
<p>Qhull detects precision
problems when computing distances. A precision problem occurs if
the distance computation is less than the maximum roundoff error.
Qhull treats the result of a hyperplane computation as if it
were exact.</p>
<p>Qhull handles precision problems by merging non-convex facets.
The result of merging two facets is a thick facet defined by an <i>inner
plane</i> and an <i>outer plane</i>. The inner and outer planes
are offsets from the facet's hyperplane. The inner plane is
clearly below the facet's vertices. At the end of Qhull, the
outer planes are clearly above all input points. Any exact convex
hull must lie between the inner and outer planes.</p>
<p>Qhull tests for convexity by computing a point for each facet.
This point is called the facet's <i>centrum</i>. It is the
arithmetic center of the facet's vertices projected to the
facet's hyperplane. For simplicial facets with <em>d</em>
vertices, the centrum is equivalent to the centroid or center of
gravity. </p>
<p>Two neighboring facets are convex if each centrum is clearly
below the other hyperplane. The '<a href="qh-optc.htm#Cn2">Cn</a>'
or '<a href="qh-optc.htm#Cn">C-n</a>' options sets the centrum's
radius to <i>n </i>. A centrum is clearly below a hyperplane if
the computed distance from the centrum to the hyperplane is
greater than the centrum's radius plus two maximum roundoff
errors. Two are required because the centrum can be the maximum
roundoff error above its hyperplane and the distance computation
can be high by the maximum roundoff error.</p>
<p>With the '<a href="qh-optc.htm#Cn">C-n</a>' or '<a
href="qh-optc.htm#An">A-n </a>' options, Qhull merges non-convex
facets while constructing the hull. The remaining facets are
clearly convex. With the '<a href="qh-optq.htm#Qx">Qx </a>'
option, Qhull merges coplanar facets after constructing the hull.
While constructing the hull, it merges coplanar horizon facets,
flipped facets, concave facets and duplicated ridges. With '<a
href="qh-optq.htm#Qx">Qx</a>', coplanar points may be missed, but
it appears to be unlikely.</p>
<p>If the user sets the '<a href="qh-optc.htm#An2">An</a>' or '<a
href="qh-optc.htm#An">A-n</a>' option, then all neighboring
facets are clearly convex and the maximum (exact) cosine of an
angle is <i>n</i>.</p>
<p>If '<a href="qh-optc.htm#C0">C-0</a>' or '<a
href="qh-optq.htm#Qx">Qx</a>' is used without other precision
options (default), Qhull tests vertices instead of centrums for
adjacent simplices. In 3-d, if simplex <i>abc</i> is adjacent to
simplex <i>bcd</i>, Qhull tests that vertex <i>a</i> is clearly
below simplex <i>bcd </i>, and vertex <i>d</i> is clearly below
simplex <i>abc</i>. When building the hull, Qhull tests vertices
if the horizon is simplicial and no merges occur. </p>
<h2><a href="#TOC">&#187;</a><a name="how">How Qhull merges facets</a></h2>
<p>If two facets are not clearly convex, then Qhull removes one
or the other facet by merging the facet into a neighbor. It
selects the merge which minimizes the distance from the
neighboring hyperplane to the facet's vertices. Qhull also
performs merges when a facet has fewer than <i>d</i> neighbors (called a
degenerate facet), when a facet's vertices are included in a
neighboring facet's vertices (called a redundant facet), when a
facet's orientation is flipped, or when a ridge occurs between
more than two facets.</p>
<p>Qhull performs merges in a series of passes sorted by merge
angle. Each pass merges those facets which haven't already been
merged in that pass. After a pass, Qhull checks for redundant
vertices. For example, if a vertex has only two neighbors in 3-d,
the vertex is redundant and Qhull merges it into an adjacent
vertex.</p>
<p>Merging two simplicial facets creates a non-simplicial facet
of <em>d+1</em> vertices. Additional merges create larger facets.
When merging facet A into facet B, Qhull retains facet B's
hyperplane. It merges the vertices, neighbors, and ridges of both
facets. It recomputes the centrum if a wide merge has not
occurred (qh_WIDEcoplanar) and the number of extra vertices is
smaller than a constant (qh_MAXnewcentrum).</p>
<h2><a href="#TOC">&#187;</a><a name="limit">Limitations of merged
facets</a></h2>
<ul>
<li><b>Uneven dimensions</b> --
If one coordinate has a larger absolute value than other
coordinates, it may dominate the effect of roundoff errors on
distance computations. You may use option '<a
href="qh-optq.htm#QbB">QbB</a>' to scale points to the unit cube.
For Delaunay triangulations and Voronoi diagrams, <a href=qdelaun.htm>qdelaunay</a>
and <a href=qvoronoi.htm>qvoronoi</a> always set
option '<a href="qh-optq.htm#Qbb">Qbb</a>'. It scales the last
coordinate to [0,m] where <i>m</i> is the maximum width of the
other coordinates. Option '<a href="qh-optq.htm#Qbb">Qbb</a>' is
needed for Delaunay triangulations of integer coordinates
and nearly cocircular points.
<p>For example, compare
<pre>
rbox 1000 W0 t | qconvex Qb2:-1e-14B2:1e-14
</pre>
with
<pre>
rbox 1000 W0 t | qconvex
</pre>
The distributions are the same but the first is compressed to a 2e-14 slab.
<p>
<li><b>Post-merging of coplanar facets</b> -- In 5-d and higher, option '<a href="qh-optq.htm#Qx">Qx</a>'
(default) delays merging of coplanar facets until post-merging.
This may allow &quot;dents&quot; to occur in the intermediate
convex hulls. A point may be poorly partitioned and force a poor
approximation. See option '<a href="qh-optq.htm#Qx">Qx</a>' for
further discussion.</p>
<p>This is difficult to produce in 5-d and higher. Option '<a href="qh-optq.htm#Q6">Q6</a>' turns off merging of concave
facets. This is similar to 'Qx'. It may lead to serious precision errors,
for example,
<pre>
rbox 10000 W1e-13 | qhull Q6 Tv
</pre>
<p>
<li><b>Maximum facet width</b> --
Qhull reports the maximum outer plane and inner planes (if
more than roundoff error apart). There is no upper bound
for either figure. This is an area for further research. Qhull
does a good job of post-merging in all dimensions. Qhull does a
good job of pre-merging in 2-d, 3-d, and 4-d. With the '<a
href="qh-optq.htm#Qx">Qx</a>' option, it does a good job in
higher dimensions. In 5-d and higher, Qhull does poorly at
detecting redundant vertices. </p>
<p>In the summary ('<a href="qh-opto.htm#s">s</a>'), look at the
ratio between the maximum facet width and the maximum width of a
single merge, e.g., &quot;(3.4x)&quot;. Qhull usually reports a
ratio of four or lower in 3-d and six or lower in 4-d. If it
reports a ratio greater than 10, this may indicate an
implementation error. Narrow distributions (see following) may
produce wide facets.
<p>For example, if special processing for narrow distributions is
turned off ('<a href="qh-optq.htm#Q10">Q10</a>'), qhull may produce
a wide facet:</p>
<pre>
rbox 1000 L100000 s G1e-16 t1002074964 | qhull Tv Q10
</pre>
<p>
<li><b>Narrow distribution</b> -- In 3-d, a narrow distribution may result in a poor
approximation. For example, if you do not use qdelaunay nor option
'<a href="qh-optq.htm#Qbb">Qbb</a>', the furthest-site
Delaunay triangulation of nearly cocircular points may produce a poor
approximation:
<pre>
rbox s 5000 W1e-13 D2 t1002151341 | qhull d Qt
rbox 1000 s W1e-13 t1002231672 | qhull d Tv
</pre>
<p>During
construction of the hull, a point may be above two
facets with opposite orientations that span the input
set. Even though the point may be nearly coplanar with both
facets, and can be distant from the precise convex
hull of the input sites. Additional facets leave the point distant from
a facet. To fix this problem, add option '<a href="qh-optq.htm#Qbb">Qbb</a>'
(it scales the last coordinate). Option '<a href="qh-optq.htm#Qbb">Qbb</a>'
is automatically set for <a href=qdelaun.htm>qdelaunay</a> and <a href=qvoronoi.htm>qvoronoi</a>.
<p>Qhull generates a warning if the initial simplex is narrow.
For narrow distributions, Qhull changes how it processes coplanar
points -- it does not make a point coplanar until the hull is
finished.
Use option '<a href="qh-optq.htm#Q10">Q10</a>' to try Qhull without
special processing for narrow distributions.
For example, special processing is needed for:
<pre>
rbox 1000 L100000 s G1e-16 t1002074964 | qhull Tv Q10
</pre>
<p>You may turn off the warning message by reducing
qh_WARNnarrow in <tt>user.h</tt> or by setting option
'<a href="qh-optp.htm#Pp">Pp</a>'. </p>
<p>Similar problems occur for distributions with a large flat facet surrounded
with many small facet at a sharp angle to the large facet.
Qhull 3.1 fixes most of these problems, but a poor approximation can occur.
A point may be left outside of the convex hull ('<a href="qh-optt.htm#Tv">Tv</a>').
Examples include
the furthest-site Delaunay triangulation of nearly cocircular points plus the origin, and the convex hull of a cone of nearly cocircular points. The width of the band is 10^-13.
<pre>
rbox s 1000 W1e-13 P0 D2 t996799242 | qhull d Tv
rbox 1000 s Z1 G1e-13 t1002152123 | qhull Tv
rbox 1000 s Z1 G1e-13 t1002231668 | qhull Tv
</pre>
<p>
<li><b>Quadratic running time</b> -- If the output contains large, non-simplicial
facets, the running time for Qhull may be quadratic in the size of the triangulated
output. For example, <tt>rbox 1000 s W1e-13 c G2 | qhull d</tt> is 4 times
faster for 500 points. The convex hull contains two large nearly spherical facets and
many nearly coplanar facets. Each new point retriangulates the spherical facet and repartitions the remaining points into all of the nearly coplanar facets.
In this case, quadratic running time is avoided if you use qdelaunay,
add option '<a href="qh-optq.htm#Qbb">Qbb</a>',
or add the origin ('P0') to the input.
<p>
<li><b>Nearly coincident points within 1e-13</b> --
Multiple, nearly coincident points within a 1e-13 ball of points in the unit cube
may lead to wide facets or quadratic running time.
For example, the convex hull a 1000 coincident, cospherical points in 4-D,
or the 3-D Delaunay triangulation of nearly coincident points, may lead to very
wide facets (e.g., 2267021951.3x).
<p>For Delaunay triangulations, the problem typically occurs for extreme points of the input
set (i.e., on the edge between the upper and lower convex hull). After multiple facet merges, four
facets may share the same, duplicate ridge and must be merged.
Some of these facets may be long and narrow, leading to a very wide merged facet.
If so, error QH6271 is reported. It may be overriden with option '<a href="qh-optq.htm#Q12">Q12</a>'.
<p>Duplicate ridges occur when the horizon facets for a new point is "pinched".
In a duplicate ridge, a subridge (e.g., a line segment in 3-d) is shared by two horizon facets.
At least two of its vertices are nearly coincident. It is easy to generate coincident points with
option 'Cn,r,m' of rbox. It generates n points within an r ball for each of m input sites. For example,
every point of the following distributions has a nearly coincident point within a 1e-13 ball.
Substantially smaller or larger balls do not lead to pinched horizons.
<pre>
rbox 1000 C1,1e-13 D4 s t | qhull
rbox 75 C1,1e-13 t | qhull d
</pre>
For Delaunay triangulations, a bounding box may alleviate this error (e.g., <tt>rbox 500 C1,1E-13 t c G1 | qhull d</tt>).
A later release of qhull will avoid pinched horizons by merging duplicate subridges. A subridge is
merged by merging adjacent vertices.
<p>
<li><b>Facet with zero-area</b> --
It is possible for a zero-area facet to be convex with its
neighbors. This can occur if the hyperplanes of neighboring
facets are above the facet's centrum, and the facet's hyperplane
is above the neighboring centrums. Qhull computes the facet's
hyperplane so that it passes through the facet's vertices. The
vertices can be collinear. </p>
<p>
<li><b>No more facets</b> -- Qhull reports an error if there are <em>d+1</em> facets left
and two of the facets are not clearly convex. This typically
occurs when the convexity constraints are too strong or the input
points are degenerate. The former is more likely in 5-d and
higher -- especially with option '<a href="qh-optc.htm#Cn">C-n</a>'.</p>
<p>
<li><b>Deleted cone</b> -- Lots of merging can end up deleting all
of the new facets for a point. This is a rare event that has
only been seen while debugging the code.
<p>
<li><b>Triangulated output leads to precision problems</b> -- With sufficient
merging, the ridges of a non-simplicial facet may have serious topological
and geometric problems. A ridge may be between more than two
neighboring facets. If so, their triangulation ('<a href="qh-optq.htm#Qt">Qt</a>')
will fail since two facets have the same vertex set. Furthermore,
a triangulated facet may have flipped orientation compared to its
neighbors.</li>
<p>The triangulation process detects degenerate facets with
only two neighbors. These are marked degenerate. They have
zero area.
<p>
<li><b>Coplanar points</b> --
Option '<a href="qh-optq.htm#Qc">Qc</a>' is determined by
qh_check_maxout() after constructing the hull. Qhull needs to
retain all possible coplanar points in the facets' coplanar sets.
This depends on qh_RATIOnearInside in <tt>user.h.</tt>
Furthermore, the cutoff for a coplanar point is arbitrarily set
at the minimum vertex. If coplanar points are important to your
application, remove the interior points by hand (set '<a
href="qh-optq.htm#Qc">Qc</a> <a href="qh-optq.htm#Qi">Qi</a>') or
make qh_RATIOnearInside sufficiently large.</p>
<p>
<li><b>Maximum roundoff error</b> -- Qhull computes the maximum roundoff error from the maximum
coordinates of the point set. Usually the maximum roundoff error
is a reasonable choice for all distance computations. The maximum
roundoff error could be computed separately for each point or for
each distance computation. This is expensive and it conflicts
with option '<a href="qh-optc.htm#Cn">C-n</a>'.
<p>
<li><b>All flipped or upper Delaunay</b> -- When a lot of merging occurs for
Delaunay triangulations, a new point may lead to no good facets. For example,
try a strong convexity constraint:
<pre>
rbox 1000 s t993602376 | qdelaunay C-1e-3
</pre>
</ul>
<h2><a href="#TOC">&#187;</a><a name="injoggle">Joggled input</a></h2>
<p>Joggled input is a simple work-around for precision problems
in computational geometry [&quot;joggle: to shake or jar
slightly,&quot; Amer. Heritage Dictionary]. Other names are
<i>jostled input</i> or <i>random perturbation</i>.
Qhull joggles the
input by modifying each coordinate by a small random quantity. If
a precision problem occurs, Qhull joggles the input with a larger
quantity and the algorithm is restarted. This process continues
until no precision problems occur. Unless all inputs incur
precision problems, Qhull will terminate. Qhull adjusts the inner
and outer planes to account for the joggled input. </p>
<p>Neither joggle nor merged facets has an upper bound for the width of the output
facets, but both methods work well in practice. Joggled input is
easier to justify. Precision errors occur when the points are
nearly singular. For example, four points may be coplanar or
three points may be collinear. Consider a line and an incident
point. A precision error occurs if the point is within some
epsilon of the line. Now joggle the point away from the line by a
small, uniformly distributed, random quantity. If the point is
changed by more than epsilon, the precision error is avoided. The
probability of this event depends on the maximum joggle. Once the
maximum joggle is larger than epsilon, doubling the maximum
joggle will halve the probability of a precision error. </p>
<p>With actual data, an analysis would need to account for each
point changing independently and other computations. It is easier
to determine the probabilities empirically ('<a href="qh-optt.htm#TRn">TRn</a>') . For example, consider
computing the convex hull of the unit cube centered on the
origin. The arithmetic has 16 significant decimal digits. </p>
<blockquote>
<p><b>Convex hull of unit cube</b> </p>
<table border="1">
<tr>
<th align="left">joggle</th>
<th align="right">error prob. </th>
</tr>
<tr>
<td align="right">1.0e-15</td>
<td align="center">0.983 </td>
</tr>
<tr>
<td align="right">2.0e-15</td>
<td align="center">0.830 </td>
</tr>
<tr>
<td align="right">4.0e-15</td>
<td align="center">0.561 </td>
</tr>
<tr>
<td align="right">8.0e-15</td>
<td align="center">0.325 </td>
</tr>
<tr>
<td align="right">1.6e-14</td>
<td align="center">0.185 </td>
</tr>
<tr>
<td align="right">3.2e-14</td>
<td align="center">0.099 </td>
</tr>
<tr>
<td align="right">6.4e-14</td>
<td align="center">0.051 </td>
</tr>
<tr>
<td align="right">1.3e-13</td>
<td align="center">0.025 </td>
</tr>
<tr>
<td align="right">2.6e-13</td>
<td align="center">0.010 </td>
</tr>
<tr>
<td align="right">5.1e-13</td>
<td align="center">0.004 </td>
</tr>
<tr>
<td align="right">1.0e-12</td>
<td align="center">0.002 </td>
</tr>
<tr>
<td align="right">2.0e-12</td>
<td align="center">0.001 </td>
</tr>
</table>
</blockquote>
<p>A larger joggle is needed for multiple points. Since the
number of potential singularities increases, the probability of
one or more precision errors increases. Here is an example. </p>
<blockquote>
<p><b>Convex hull of 1000 points on unit cube</b> </p>
<table border="1">
<tr>
<th align="left">joggle</th>
<th align="right">error prob. </th>
</tr>
<tr>
<td align="right">1.0e-12</td>
<td align="center">0.870 </td>
</tr>
<tr>
<td align="right">2.0e-12</td>
<td align="center">0.700 </td>
</tr>
<tr>
<td align="right">4.0e-12</td>
<td align="center">0.450 </td>
</tr>
<tr>
<td align="right">8.0e-12</td>
<td align="center">0.250 </td>
</tr>
<tr>
<td align="right">1.6e-11</td>
<td align="center">0.110 </td>
</tr>
<tr>
<td align="right">3.2e-11</td>
<td align="center">0.065 </td>
</tr>
<tr>
<td align="right">6.4e-11</td>
<td align="center">0.030 </td>
</tr>
<tr>
<td align="right">1.3e-10</td>
<td align="center">0.010 </td>
</tr>
<tr>
<td align="right">2.6e-10</td>
<td align="center">0.008 </td>
</tr>
<tr>
<td align="right">5.1e-09</td>
<td align="center">0.003 </td>
</tr>
</table>
</blockquote>
<p>Other distributions behave similarly. No distribution should
behave significantly worse. In Euclidean space, the probability
measure of all singularities is zero. With floating point
numbers, the probability of a singularity is non-zero. With
sufficient digits, the probability of a singularity is extremely
small for random data. For a sufficiently large joggle, all data
is nearly random data. </p>
<p>Qhull uses an initial joggle of 30,000 times the maximum
roundoff error for a distance computation. This avoids most
potential singularities. If a failure occurs, Qhull retries at
the initial joggle (in case bad luck occurred). If it occurs
again, Qhull increases the joggle by ten-fold and tries again.
This process repeats until the joggle is a hundredth of the width
of the input points. Qhull reports an error after 100 attempts.
This should never happen with double-precision arithmetic. Once
the probability of success is non-zero, the probability of
success increases about ten-fold at each iteration. The
probability of repeated failures becomes extremely small. </p>
<p>Merged facets produces a significantly better approximation.
Empirically, the maximum separation between inner and outer
facets is about 30 times the maximum roundoff error for a
distance computation. This is about 2,000 times better than
joggled input. Most applications though will not notice the
difference. </p>
<h2><a href="#TOC">&#187;</a><a name="exact">Exact arithmetic</a></h2>
<p>Exact arithmetic may be used instead of floating point.
Singularities such as coplanar points can either be handled
directly or the input can be symbolically perturbed. Using exact
arithmetic is slower than using floating point arithmetic and the
output may take more space. Chaining a sequence of operations
increases the time and space required. Some operations are
difficult to do.</p>
<p>Clarkson's <a
href="http://www.netlib.org/voronoi/hull.html">hull
program</a> and Shewchuk's <a
href="http://www.cs.cmu.edu/~quake/triangle.html">triangle
program</a> are practical implementations of exact arithmetic.</p>
<p>Clarkson limits the input precision to about fifteen digits.
This reduces the number of nearly singular computations. When a
determinant is nearly singular, he uses exact arithmetic to
compute a precise result.</p>
<h2><a href="#TOC">&#187;</a><a name="approximate">Approximating a
convex hull</a></h2>
<p>Qhull may be used for approximating a convex hull. This is
particularly valuable in 5-d and higher where hulls can be
immense. You can use '<a href="qh-optq.htm#Qx">Qx</a> <a
href="qh-optc.htm#Cn">C-n</a>' to merge facets as the hull is
being constructed. Then use '<a href="qh-optc.htm#Cn2">Cn</a>'
and/or '<a href="qh-optc.htm#An2">An</a>' to merge small facets
during post-processing. You can print the <i>n</i> largest facets
with option '<a href="qh-optp.htm#PAn">PAn</a>'. You can print
facets whose area is at least <i>n</i> with option '<a
href="qh-optp.htm#PFn">PFn</a>'. You can output the outer planes
and an interior point with '<a href="qh-optf.htm#FV">FV</a> <a
href="qh-optf.htm#Fo">Fo</a>' and then compute their intersection
with 'qhalf'. </p>
<p>To approximate a convex hull in 6-d and higher, use
post-merging with '<a href="qh-optc.htm#Wn">Wn</a>' (e.g., qhull
W1e-1 C1e-2 TF2000). Pre-merging with a convexity constraint
(e.g., qhull Qx C-1e-2) often produces a poor approximation or
terminates with a simplex. Option '<a href="qh-optq.htm#QbB">QbB</a>'
may help to spread out the data.</p>
<p>You will need to experiment to determine a satisfactory set of
options. Use <a href="rbox.htm">rbox</a> to generate test sets
quickly and <a href="index.htm#geomview">Geomview</a> to view
the results. You will probably want to write your own driver for
Qhull using the Qhull library. For example, you could select the
largest facet in each quadrant.</p>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home
page</a> for Qhull <br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of
Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#TOC">Qhull imprecision: Table of Contents</a>
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,292 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Qhull precision options</title>
</head>
<body>
<!-- Navigation links -->
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/delaunay.html"><img
src="qh--dt.gif" alt="[delaunay]" align="middle" width="100"
height="100"></a> Qhull precision options</h1>
This section lists the precision options for Qhull. These options are
indicated by an upper-case letter followed by a number.
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="index.htm#TOC">&#187;</a> <a href="qh-quick.htm#programs">Programs</a>
<a name="prec">&#149;</a> <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<h2>Precision options</h2>
<p>Most users will not need to set these options. They are best
used for <a href="qh-impre.htm#approximate">approximating</a> a
convex hull. They may also be used for testing Qhull's handling
of precision errors.</p>
<p>By default, Qhull uses options '<a href="#C0">C-0</a>' for
2-d, 3-d and 4-d, and '<a href="qh-optq.htm#Qx">Qx</a>' for 5-d
and higher. These options use facet merging to handle precision
errors. You may also use joggled input '<a href="qh-optq.htm#QJn">QJ</a>'
to avoid precision problems.
For more information see <a
href="qh-impre.htm">Imprecision in Qhull</a>.</p>
<dl compact>
<dt>&nbsp;</dt>
<dd><b>General</b></dd>
<dt><a href="#Cn2">Cn</a></dt>
<dd>centrum radius for post-merging</dd>
<dt><a href="#Cn">C-n</a></dt>
<dd>centrum radius for pre-merging</dd>
<dt><a href="#An2">An</a></dt>
<dd>cosine of maximum angle for post-merging</dd>
<dt><a href="#An">A-n</a></dt>
<dd>cosine of maximum angle for pre-merging</dd>
<dt><a href="qh-optq.htm#Qx">Qx</a></dt>
<dd>exact pre-merges (allows coplanar facets)</dd>
<dt><a href="#C0">C-0</a></dt>
<dd>handle all precision errors</dd>
<dt><a href="#Wn">Wn</a></dt>
<dd>min distance above plane for outside points</dd>
</dl>
<dl compact>
<dt>&nbsp;</dt>
<dd><b>Experimental</b></dd>
<dt><a href="#Un">Un</a></dt>
<dd>max distance below plane for a new, coplanar point</dd>
<dt><a href="#En">En</a></dt>
<dd>max roundoff error for distance computation</dd>
<dt><a href="#Vn">Vn</a></dt>
<dd>min distance above plane for a visible facet</dd>
<dt><a href="#Rn">Rn</a></dt>
<dd>randomly perturb computations by a factor of [1-n,1+n]</dd>
</dl>
<dl compact>
</dl>
<hr>
<h3><a href="#prec">&#187;</a><a name="An">A-n - cosine of maximum
angle for pre-merging.</a></h3>
<p>Pre-merging occurs while Qhull constructs the hull. It is
indicated by '<a href="#Cn">C-n</a>', 'A-n', or '<a
href="qh-optq.htm#Qx">Qx</a>'.</p>
<p>If the angle between a pair of facet normals is greater than <i>n</i>,
Qhull merges one of the facets into a neighbor. It selects the
facet that is closest to a neighboring facet.</p>
<p>For example, option 'A-0.99' merges facets during the
construction of the hull. If the cosine of the angle between
facets is greater than 0.99, one or the other facet is merged.
Qhull accounts for the maximum roundoff error.</p>
<p>If 'A-n' is set without '<a href="#Cn">C-n</a>', then '<a
href="#C0">C-0</a>' is automatically set. </p>
<p>In 5-d and higher, you should set '<a href="qh-optq.htm#Qx">Qx</a>'
along with 'A-n'. It skips merges of coplanar facets until after
the hull is constructed and before '<a href="#An2">An</a>' and '<a
href="#Cn2">Cn</a>' are checked. </p>
<h3><a href="#prec">&#187;</a><a name="An2">An - cosine of maximum angle for
post-merging.</a></h3>
<p>Post merging occurs after the hull is constructed. For
example, option 'A0.99' merges a facet if the cosine of the angle
between facets is greater than 0.99. Qhull accounts for the
maximum roundoff error.</p>
<p>If 'An' is set without '<a href="#Cn2">Cn</a>', then '<a
href="#Cn2">C0</a>' is automatically set. </p>
<h3><a href="#prec">&#187;</a><a name="C0">C-0 - handle all precision
errors </a></h3>
<p>Qhull handles precision errors by merging facets. The 'C-0'
option handles all precision errors in 2-d, 3-d, and 4-d. It is
set by default. It may be used in higher dimensions, but
sometimes the facet width grows rapidly. It is usually better to
use '<a href="qh-optq.htm#Qx">Qx</a>' in 5-d and higher.
Use '<a href="qh-optq.htm#QJn">QJ</a>' to joggle the input
instead of merging facets.
Use '<a
href="qh-optq.htm#Q0">Q0</a>' to turn both options off.</p>
<p>Qhull optimizes 'C-0' (&quot;_zero-centrum&quot;) by testing
vertices instead of centrums for adjacent simplices. This may be
slower in higher dimensions if merges decrease the number of
processed points. The optimization may be turned off by setting a
small value such as 'C-1e-30'. See <a href="qh-impre.htm">How
Qhull handles imprecision</a>.</p>
<h3><a href="#prec">&#187;</a><a name="Cn">C-n - centrum radius for
pre-merging</a></h3>
<p>Pre-merging occurs while Qhull constructs the hull. It is
indicated by 'C-n', '<a href="#An">A-n</a>', or '<a
href="qh-optq.htm#Qx">Qx</a>'.</p>
<p>The <i>centrum</i> of a facet is a point on the facet for
testing facet convexity. It is the average of the vertices
projected to the facet's hyperplane. Two adjacent facets are
convex if each centrum is clearly below the other facet. </p>
<p>If adjacent facets are non-convex, one of the facets is merged
into a neighboring facet. Qhull merges the facet that is closest
to a neighboring facet. </p>
<p>For option 'C-n', <i>n</i> is the centrum radius. For example,
'C-0.001' merges facets whenever the centrum is less than 0.001
from a neighboring hyperplane. Qhull accounts for roundoff error
when testing the centrum.</p>
<p>In 5-d and higher, you should set '<a href="qh-optq.htm#Qx">Qx</a>'
along with 'C-n'. It skips merges of coplanar facets until after
the hull is constructed and before '<a href="#An2">An</a>' and '<a
href="#Cn2">Cn</a>' are checked. </p>
<h3><a href="#prec">&#187;</a><a name="Cn2">Cn - centrum radius for
post-merging</a></h3>
<p>Post-merging occurs after Qhull constructs the hull. It is
indicated by '<a href="#Cn2">Cn</a>' or '<a href="#An2">An</a>'. </p>
<p>For option '<a href="#Cn2">Cn</a>', <i>n</i> is the centrum
radius. For example, 'C0.001' merges facets when the centrum is
less than 0.001 from a neighboring hyperplane. Qhull accounts for
roundoff error when testing the centrum.</p>
<p>Both pre-merging and post-merging may be defined. If only
post-merging is used ('<a href="qh-optq.htm#Q0">Q0</a>' with
'Cn'), Qhull may fail to produce a hull due to precision errors
during the hull's construction.</p>
<h3><a href="#prec">&#187;</a><a name="En">En - max roundoff error
for distance computations</a></h3>
<p>This allows the user to change the maximum roundoff error
computed by Qhull. The value computed by Qhull may be overly
pessimistic. If 'En' is set too small, then the output may not be
convex. The statistic &quot;max. distance of a new vertex to a
facet&quot; (from option '<a href="qh-optt.htm#Ts">Ts</a>') is a
reasonable upper bound for the actual roundoff error. </p>
<h3><a href="#prec">&#187;</a><a name="Rn">Rn - randomly perturb
computations </a></h3>
<p>This option perturbs every distance, hyperplane, and angle
computation by up to <i>(+/- n * max_coord)</i>. It simulates the
effect of roundoff errors. Unless '<a href="#En">En</a>' is
explicitly set, it is adjusted for 'Rn'. The command 'qhull Rn'
will generate a convex hull despite the perturbations. See the <a
href="qh-eg.htm#merge">Examples </a>section for an example.</p>
<p>Options 'Rn C-n' have the effect of '<a href="#Wn">W2n</a>'
and '<a href="#Cn">C-2n</a>'. To use time as the random number
seed, use option '<a href="qh-optq.htm#QRn">QR-1</a>'.</p>
<h3><a href="#prec">&#187;</a><a name="Un">Un - max distance for a
new, coplanar point </a></h3>
<p>This allows the user to set coplanarity. When pre-merging ('<a
href="#Cn">C-n </a>', '<a href="#An">A-n</a>' or '<a
href="qh-optq.htm#Qx">Qx</a>'), Qhull merges a new point into any
coplanar facets. The default value for 'Un' is '<a href="#Vn">Vn</a>'.</p>
<h3><a href="#prec">&#187;</a><a name="Vn">Vn - min distance for a
visible facet </a></h3>
<p>This allows the user to set facet visibility. When adding a
point to the convex hull, Qhull determines all facets that are
visible from the point. A facet is visible if the distance from
the point to the facet is greater than 'Vn'.</p>
<p>Without merging, the default value for 'Vn' is the roundoff
error ('<a href="#En">En</a>'). With merging, the default value
is the pre-merge centrum ('<a href="#Cn">C-n</a>') in 2-d or 3-d,
or three times that in other dimensions. If the outside width is
specified with option '<a href="#Wn">Wn </a>', the maximum,
default value for 'Vn' is '<a href="#Wn">Wn</a>'.</p>
<p>Qhull warns if 'Vn' is greater than '<a href="#Wn">Wn</a>' and
furthest outside ('<a href="qh-optq.htm#Qf">Qf</a>') is not
selected; this combination usually results in flipped facets
(i.e., reversed normals).</p>
<h3><a href="#prec">&#187;</a><a name="Wn">Wn - min distance above
plane for outside points</a></h3>
<p>Points are added to the convex hull only if they are clearly
outside of a facet. A point is outside of a facet if its distance
to the facet is greater than 'Wn'. Without pre-merging, the
default value for 'Wn' is '<a href="#En">En </a>'. If the user
specifies pre-merging and does not set 'Wn', than 'Wn' is set to
the maximum of '<a href="#Cn">C-n</a>' and <i>maxcoord*(1 - </i><a
href="#An"><i>A-n</i></a><i>)</i>.</p>
<p>This option is good for <a href="qh-impre.htm#approximate">approximating</a>
a convex hull.</p>
<p>Options '<a href="qh-optq.htm#Qc">Qc</a>' and '<a
href="qh-optq.htm#Qi">Qi</a>' use the minimum vertex to
distinguish coplanar points from interior points.</p>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,736 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Qhull format options (F)</title>
</head>
<body><!-- Navigation links -->
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/delaunay.html"><IMG
align=middle alt=[delaunay] height=100
src="qh--dt.gif" width=100 ></a> Qhull format options (F)</h1>
<p>This section lists the format options for Qhull. These options
are indicated by 'F' followed by a letter. See <A
href="qh-opto.htm#output" >Output</a>, <a href="qh-optp.htm#print">Print</a>,
and <a href="qh-optg.htm#geomview">Geomview</a> for other output
options. </p>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="index.htm#TOC">&#187;</a> <a href="qh-quick.htm#programs">Programs</a>
<a name="format">&#149;</a> <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<h2>Additional input &amp; output formats</h2>
<p>These options allow for automatic processing of Qhull output.
Options '<a href="qh-opto.htm#i">i</a>', '<a href="qh-opto.htm#o">o</a>',
'<a href="qh-opto.htm#n">n</a>', and '<a href="qh-opto.htm#p">p</a>'
may also be used.</p>
<dl compact>
<dt>
<dd><b>Summary and control</b>
<dt><a href="#FA">FA</a>
<dd>compute total area and volume for option '<A
href="qh-opto.htm#s">s</a>'
<dt><a href="#FV">FV</a>
<dd>print average vertex (interior point for '<A
href="qhalf.htm">qhalf</a>')
<dt><a href="#FQ">FQ</a>
<dd>print command for qhull and input
<dt><a href="#FO">FO</a>
<dd>print options to stderr or stdout
<dt><a href="#FS">FS</a>
<dd>print sizes: total area and volume
<dt><a href="#Fs">Fs</a>
<dd>print summary: dim, #points, total vertices and
facets, #vertices, #facets, max outer and inner plane
<dt><a href="#Fd">Fd</a>
<dd>use format for input (offset first)
<dt><a href="#FD">FD</a>
<dd>use cdd format for normals (offset first)
<dt><a href="#FM">FM</a>
<dd>print Maple output (2-d and 3-d)
<dt>
<dt>
<dd><b>Facets, points, and vertices</b>
<dt><a href="#Fa">Fa</a>
<dd>print area for each facet
<dt><a href="#FC">FC</a>
<dd>print centrum for each facet
<dt><a href="#Fc">Fc</a>
<dd>print coplanar points for each facet
<dt><a href="#Fx">Fx</a>
<dd>print extreme points (i.e., vertices) of convex hull.
<dt><a href="#FF">FF</a>
<dd>print facets w/o ridges
<dt><a href="#FI">FI</a>
<dd>print ID for each facet
<dt><a href="#Fi">Fi</a>
<dd>print inner planes for each facet
<dt><a href="#Fm">Fm</a>
<dd>print merge count for each facet (511 max)
<dt><a href="#FP">FP</a>
<dd>print nearest vertex for coplanar points
<dt><a href="#Fn">Fn</a>
<dd>print neighboring facets for each facet
<dt><a href="#FN">FN</a>
<dd>print neighboring facets for each point
<dt><a href="#Fo">Fo</a>
<dd>print outer planes for each facet
<dt><a href="#Ft">Ft</a>
<dd>print triangulation with added points
<dt><a href="#Fv">Fv</a>
<dd>print vertices for each facet
<dt>
<dt>
<dd><b>Delaunay, Voronoi, and halfspace</b>
<dt><a href="#Fx">Fx</a>
<dd>print extreme input sites of Delaunay triangulation
or Voronoi diagram.
<dt><a href="#Fp">Fp</a>
<dd>print points at halfspace intersections
<dt><a href="#Fi2">Fi</a>
<dd>print separating hyperplanes for inner, bounded
Voronoi regions
<dt><a href="#Fo2">Fo</a>
<dd>print separating hyperplanes for outer, unbounded
Voronoi regions
<dt><a href="#Fv2">Fv</a>
<dd>print Voronoi diagram as ridges for each input pair
<dt><a href="#FC">FC</a>
<dd>print Voronoi vertex ("center") for each facet</dd>
</dl>
<hr>
<h3><a href="#format">&#187;</a><a name="Fa">Fa - print area for each
facet </a></h3>
<p>The first line is the number of facets. The remaining lines
are the area for each facet, one facet per line. See '<A
href="#FA" >FA</a>' and '<a href="#FS">FS</a>' for computing the total area and volume.</p>
<p>Use '<a href="qh-optp.htm#PAn">PAn</a>' for printing the n
largest facets. Use option '<a href="qh-optp.htm#PFn">PFn</a>'
for printing facets larger than <i>n</i>.</p>
<p>For Delaunay triangulations, the area is the area of each
Delaunay triangle. For Voronoi vertices, the area is the area of
the dual facet to each vertex. </p>
<p>Qhull uses the centrum and ridges to triangulate
non-simplicial facets. The area for non-simplicial facets is the
sum of the areas for each triangle. It is an approximation of the
actual area. The ridge's vertices are projected to the facet's
hyperplane. If a vertex is far below a facet (qh_WIDEcoplanar in <tt>user.h</tt>),
the corresponding triangles are ignored.</p>
<p>For non-simplicial facets, vertices are often below the
facet's hyperplane. If so, the approximation is less than the
actual value and it may be significantly less. </p>
<h3><a href="#format">&#187;</a><a name="FA">FA - compute total area
and volume for option 's' </a></h3>
<p>With option 'FA', Qhull includes the total area and volume in
the summary ('<a href="qh-opto.htm#s">s</a>'). Option '<a href="#FS">FS</a>' also includes the total area and volume.
If facets are
merged, the area and volume are approximations. Option 'FA' is
automatically set for options '<a href="#Fa">Fa</a>', '<A
href="qh-optp.htm#PAn" >PAn</a>', and '<a href="qh-optp.htm#PFn">PFn</a>'.
</p>
<p>With '<a href="qdelaun.htm">qdelaunay</a> <A
href="qh-opto.htm#s" >s</a> FA', Qhull computes the total area of
the Delaunay triangulation. This equals the volume of the convex
hull of the data points. With options '<a href="qdelau_f.htm">qdelaunay Qu</a>
<a href="qh-opto.htm#s">s</a> FA', Qhull computes the
total area of the furthest-site Delaunay triangulation. This
equals of the total area of the Delaunay triangulation. </p>
<p>See '<a href="#Fa">Fa</a>' for further details. Option '<a href="#FS">FS</a>' also computes the total area and volume.</p>
<h3><a href="#format">&#187;</a><a name="Fc">Fc - print coplanar
points for each facet </a></h3>
<p>The output starts with the number of facets. Then each facet
is printed one per line. Each line is the number of coplanar
points followed by the point ids. </p>
<p>By default, option 'Fc' reports coplanar points
('<a href="qh-optq.htm#Qc">Qc</a>'). You may also use
option '<a href="qh-optq.htm#Qi">Qi</a>'. Options 'Qi Fc' prints
interior points while 'Qci Fc' prints both coplanar and interior
points.
<p>Each coplanar point or interior point is assigned to the
facet it is furthest above (resp., least below). </p>
<p>Use 'Qc <a href="qh-opto.htm#p">p</a>' to print vertex and
coplanar point coordinates. Use '<a href="qh-optf.htm#Fv">Fv</a>'
to print vertices. </p>
<h3><a href="#format">&#187;</a><a name="FC">FC - print centrum or
Voronoi vertex for each facet </a></h3>
<p>The output starts with the dimension followed by the number of
facets. Then each facet centrum is printed, one per line. For
<a href="qvoronoi.htm">qvoronoi</a>, Voronoi vertices are
printed instead. </p>
<h3><a href="#format">&#187;</a><a name="Fd">Fd - use cdd format for
input </a></h3>
<p>The input starts with comments. The first comment is reported
in the summary. Data starts after a "begin" line. The
next line is the number of points followed by the dimension plus
one and "real" or "integer". Then the points
are listed with a leading "1" or "1.0". The
data ends with an "end" line.</p>
<p>For halfspaces ('<a href="qhalf.htm">qhalf</a> Fd'),
the input format is the same. Each halfspace starts with its
offset. The signs of the offset and coefficients are the
opposite of Qhull's
convention. The first two lines of the input may be an interior
point in '<a href="#FV">FV</a>' format.</p>
<h3><a href="#format">&#187;</a><a name="FD">FD - use cdd format for
normals </a></h3>
<p>Option 'FD' prints normals ('<a href="qh-opto.htm#n">n</a>', '<A
href="#Fo" >Fo</a>', '<a href="#Fi">Fi</a>') or points ('<A
href="qh-opto.htm#p" >p</a>') in cdd format. The first line is the
command line that invoked Qhull. Data starts with a
"begin" line. The next line is the number of normals or
points followed by the dimension plus one and "real".
Then the normals or points are listed with the offset before the
coefficients. The offset for points is 1.0. For normals,
the offset and coefficients use the opposite sign from Qhull.
The data ends with an "end" line.</p>
<h3><a href="#format">&#187;</a><a name="FF">FF - print facets w/o
ridges </a></h3>
<p>Option 'FF' prints all fields of all facets (as in '<A
href="qh-opto.htm#f" >f</a>') without printing the ridges. This is
useful in higher dimensions where a facet may have many ridges.
For simplicial facets, options 'FF' and '<a href="qh-opto.htm#f">f
</a>' are equivalent.</p>
<h3><a href="#format">&#187;</a><a name="Fi">Fi - print inner planes
for each facet </a></h3>
<p>The first line is the dimension plus one. The second line is
the number of facets. The remainder is one inner plane per line.
The format is the same as option '<a href="qh-opto.htm#n">n</a>'.</p>
<p>The inner plane is a plane that is below the facet's vertices.
It is an offset from the facet's hyperplane. It includes a
roundoff error for computing the vertex distance.</p>
<p>Note that the inner planes for Geomview output ('<A
href="qh-optg.htm#Gi" >Gi</a>') include an additional offset for
vertex visualization and roundoff error. </p>
<h3><a href="#format">&#187;</a><a name="Fi2">Fi - print separating
hyperplanes for inner, bounded Voronoi regions</a></h3>
<p>With <a href="qvoronoi.htm" >qvoronoi</a>, 'Fi' prints the
separating hyperplanes for inner, bounded regions of the Voronoi
diagram. The first line is the number of ridges. Then each
hyperplane is printed, one per line. A line starts with the
number of indices and floats. The first pair of indices indicates
an adjacent pair of input sites. The next <i>d</i> floats are the
normalized coefficients for the hyperplane, and the last float is
the offset. The hyperplane is oriented toward '<A
href="qh-optq.htm#QVn" >QVn</a>' (if defined), or the first input
site of the pair. </p>
<p>Use '<a href="qh-optf.htm#Fo2">Fo</a>' for unbounded regions,
and '<a href="qh-optf.htm#Fv2">Fv</a>' for the corresponding
Voronoi vertices. </p>
<p>Use '<a href="qh-optt.htm#Tv">Tv</a>' to verify that the
hyperplanes are perpendicular bisectors. It will list relevant
statistics to stderr. The hyperplane is a perpendicular bisector
if the midpoint of the input sites lies on the plane, all Voronoi
vertices in the ridge lie on the plane, and the angle between the
input sites and the plane is ninety degrees. This is true if all
statistics are zero. Roundoff and computation errors make these
non-zero. The deviations appear to be largest when the
corresponding Delaunay triangles are large and thin; for example,
the Voronoi diagram of nearly cospherical points. </p>
<h3><a href="#format">&#187;</a><a name="FI">FI - print ID for each
facet </a></h3>
<p>Print facet identifiers. These are used internally and listed
with options '<a href="qh-opto.htm#f">f</a>' and '<a href="#FF">FF</a>'.
Options '<a href="#Fn">Fn </a>' and '<a href="#FN">FN</a>' use
facet identifiers for negative indices. </p>
<h3><a href="#format">&#187;</a><a name="Fm">Fm - print merge count
for each facet </a></h3>
<p>The first line is the number of facets. The remainder is the
number of merges for each facet, one per line. At most 511 merges
are reported for a facet. See '<a href="qh-optp.htm#PMn">PMn</a>'
for printing the facets with the most merges. </p>
<h3><a href="#format">&#187;</a><a name="FM">FM - print Maple
output </a></h3>
<p>Qhull writes a Maple file for 2-d and 3-d convex hulls,
2-d and 3-d halfspace intersections,
and 2-d Delaunay triangulations. Qhull produces a 2-d
or 3-d plot.
<p><i>Warning</i>: This option has not been tested in Maple.
<p>[From T. K. Abraham with help from M. R. Feinberg and N. Platinova.]
The following steps apply while working within the
Maple worksheet environment :
<ol>
<li>Generate the data and store it as an array . For example, in 3-d, data generated
in Maple is of the form : x[i],y[i],z[i]
<p>
<li>Create a single variable and assign the entire array of data points to this variable.
Use the "seq" command within square brackets as shown in the following example.
(The square brackets are essential for the rest of the steps to work.)
<p>
>data:=[seq([x[i],y[i],z[i]],i=1..n)]:# here n is the number of data points
<li>Next we need to write the data to a file to be read by qhull. Before
writing the data to a file, make sure that the qhull executable files and
the data file lie in the same subdirectory. If the executable files are
stored in the "C:\qhull3.1\" subdirectory, then save the file in the same
subdirectory, say "C:\qhull3.1\datafile.txt". For the sake of integrity of
the data file , it is best to first ensure that the data file does not
exist before writing into the data file. This can be done by running a
delete command first . To write the data to the file, use the "writedata"
and the "writedata[APPEND]" commands as illustrated in the following example :
<p>
>system("del c:\\qhull3.1\\datafile.txt");#To erase any previous versions of the file
<br>>writedata("c:\\qhull3.1\\datafile.txt ",[3, nops(data)]);#writing in qhull format
<br>>writedata[APPEND]("c:\\ qhull3.1\\datafile.txt ", data);#writing the data points
<li>
Use the 'FM' option to produce Maple output. Store the output as a ".mpl" file.
For example, using the file we created above, we type the following (in DOS environment)
<p>
qconvex s FM &lt;datafile.txt >dataplot.mpl
<li>
To read 3-d output in Maple, we use the 'read' command followed by
a 'display3d' command. For example (in Maple environment):
<p>
>with (plots):
<br>>read `c:\\qhull3.1\\dataplot.mpl`:#IMPORTANT - Note that the punctuation mark used is ' and NOT '. The correct punctuation mark is the one next to the key for "1" (not the punctuation mark near the enter key)
<br>> qhullplot:=%:
<br>> display3d(qhullplot);
</ol>
<p>For Delaunay triangulation orthogonal projection is better.
<p>For halfspace intersections, Qhull produces the dual
convex hull.
<p>See <a href="qh-faq.htm#math">Is Qhull available for Maple?</a>
for other URLs.
<h3><a href="#format">&#187;</a><a name="Fn">Fn - print neighboring
facets for each facet </a></h3>
<p>The output starts with the number of facets. Then each facet
is printed one per line. Each line is the number of neighbors
followed by an index for each neighbor. The indices match the
other facet output formats.</p>
<p>For simplicial facets, each neighbor is opposite
the corresponding vertex (option '<a href="#Fv">Fv</a>').
Do not compare to option '<a href="qh-opto.htm#i">i</a>'. Option 'i'
orients facets by reversing the order of two vertices. For non-simplicial facets,
the neighbors are unordered.
<p>A negative index indicates an unprinted facet due to printing
only good facets ('<a href="qh-optp.htm#Pg">Pg</a>', <a href="qdelaun.htm" >qdelaunay</a>,
<a href="qvoronoi.htm" >qvoronoi</a>). It
is the negation of the facet's ID (option '<a href="#FI">FI</a>').
For example, negative indices are used for facets "at
infinity" in the Delaunay triangulation.</p>
<h3><a href="#format">&#187;</a><a name="FN">FN - print neighboring
facets for each point </a></h3>
<p>The first line is the number of points. Then each point is
printed, one per line. For unassigned points (either interior or
coplanar), the line is "0". For assigned coplanar
points ('<a href="qh-optq.htm#Qc">Qc</a>'), the line is
"1" followed by the index of the facet that is furthest
below the point. For assigned interior points ('<A
href="qh-optq.htm#Qi" >Qi</a>'), the line is "1"
followed by the index of the facet that is least above the point.
For vertices that do not belong to good facet, the line is
"0"</p>
<p>For vertices of good facets, the line is the number of
neighboring facets followed by the facet indices. The indices
correspond to the other '<a href="#format">F</a>' formats. In 4-d
and higher, the facets are sorted by index. In 3-d, the facets
are in adjacency order (not oriented).</p>
<p>A negative index indicates an unprinted facet due to printing
only good facets (<a href="qdelaun.htm" >qdelaunay</a>,
<a href="qvoronoi.htm" >qvoronoi</a>, '<a href="qh-optp.htm#Pdk">Pdk</a>',
'<a href="qh-optp.htm#Pg">Pg</a>'). It is the negation of the
facet's ID ('<a href="#FI"> FI</a>'). For example, negative
indices are used for facets "at infinity" in the
Delaunay triangulation.</p>
<p>For Voronoi vertices, option 'FN' lists the vertices of the
Voronoi region for each input site. Option 'FN' lists the regions
in site ID order. Option 'FN' corresponds to the second half of
option '<a href="qh-opto.htm#o">o</a>'. To convert from 'FN' to '<A
href="qh-opto.htm#o" >o</a>', replace negative indices with zero
and increment non-negative indices by one. </p>
<p>If you are using the <a href="qh-code.htm#library">Qhull
library</a> or <a href="qh-code.htm#cpp">C++ interface</a>, option 'FN' has the side effect of reordering the
neighbors for a vertex </p>
<h3><a href="#format">&#187;</a><a name="Fo">Fo - print outer planes
for each facet </a></h3>
<p>The first line is the dimension plus one. The second line is
the number of facets. The remainder is one outer plane per line.
The format is the same as option '<a href="qh-opto.htm#n">n</a>'.</p>
<p>The outer plane is a plane that is above all points. It is an
offset from the facet's hyperplane. It includes a roundoff error
for computing the point distance. When testing the outer plane
(e.g., '<a href="qh-optt.htm#Tv">Tv</a>'), another roundoff error
should be added for the tested point.</p>
<p>If outer planes are not checked ('<a href="qh-optq.htm#Q5">Q5</a>')
or not computed (!qh_MAXoutside), the maximum, computed outside
distance is used instead. This can be much larger than the actual
outer planes.</p>
<p>Note that the outer planes for Geomview output ('<A
href="qh-optg.htm#G" >G</a>') include an additional offset for
vertex/point visualization, 'lines closer,' and roundoff error.</p>
<h3><a href="#format">&#187;</a><a name="Fo2">Fo - print separating
hyperplanes for outer, unbounded Voronoi regions</a></h3>
<p>With <a href="qvoronoi.htm" >qvoronoi</a>, 'Fo' prints the
separating hyperplanes for outer, unbounded regions of the
Voronoi diagram. The first line is the number of ridges. Then
each hyperplane is printed, one per line. A line starts with the
number of indices and floats. The first pair of indices indicates
an adjacent pair of input sites. The next <i>d</i> floats are the
normalized coefficients for the hyperplane, and the last float is
the offset. The hyperplane is oriented toward '<A
href="qh-optq.htm#QVn" >QVn</a>' (if defined), or the first input
site of the pair. </p>
<p>Option 'Fo' gives the hyperplanes for the unbounded rays of
the unbounded regions of the Voronoi diagram. Each hyperplane
goes through the midpoint of the corresponding input sites. The
rays are directed away from the input sites. </p>
<p>Use '<a href="qh-optf.htm#Fi2">Fi</a>' for bounded regions,
and '<a href="qh-optf.htm#Fv2">Fv</a>' for the corresponding
Voronoi vertices. Use '<a href="qh-optt.htm#Tv">Tv</a>' to verify
that the corresponding Voronoi vertices lie on the hyperplane. </p>
<h3><a href="#format">&#187;</a><a name="FO">FO - print list of
selected options </a></h3>
<p>Lists selected options and default values to stderr.
Additional 'FO's are printed to stdout. </p>
<h3><a href="#format">&#187;</a><a name="Fp">Fp - print points at
halfspace intersections</a></h3>
<p>The first line is the number of intersection points. The
remainder is one intersection point per line. A intersection
point is the intersection of <i>d</i> or more halfspaces from
'<a href="qhalf.htm">qhalf</a>'. It corresponds to a
facet of the dual polytope. The "infinity" point
[-10.101,-10.101,...] indicates an unbounded intersection.</p>
<p>If [x,y,z] are the dual facet's normal coefficients and <i>b&lt;0</i>
is its offset, the halfspace intersection occurs at
[x/-b,y/-b,z/-b] plus the interior point. If <i>b&gt;=0</i>, the
halfspace intersection is unbounded. </p>
<h3><a href="#format">&#187;</a><a name="FP">FP - print nearest
vertex for coplanar points </a></h3>
<p>The output starts with the number of coplanar points. Then
each coplanar point is printed one per line. Each line is the
point ID of the closest vertex, the point ID of the coplanar
point, the corresponding facet ID, and the distance. Sort the
lines to list the coplanar points nearest to each vertex. </p>
<p>Use options '<a href="qh-optq.htm#Qc">Qc</a>' and/or '<A
href="qh-optq.htm#Qi" >Qi</a>' with 'FP'. Options 'Qc FP' prints
coplanar points while 'Qci FP' prints coplanar and interior
points. Option 'Qc' is automatically selected if 'Qi' is not
selected.
<p>For Delaunay triangulations (<a href="qdelaun.htm" >qdelaunay</a>
or <a href="qvoronoi.htm" >qvoronoi</a>), a coplanar point is nearly
incident to a vertex. The distance is the distance in the
original point set.</p>
<p>If imprecision problems are severe, Qhull will delete input
sites when constructing the Delaunay triangulation. Option 'FP' will
list these points along with coincident points.</p>
<p>If there are many coplanar or coincident points and non-simplicial
facets are triangulated ('<a href="qh-optq.htm#Qt">Qt</a>'), option
'FP' may be inefficient. It redetermines the original vertex set
for each coplanar point.</p>
<h3><a href="#format">&#187;</a><a name="FQ">FQ - print command for
qhull and input </a></h3>
<p>Prints qhull and input command, e.g., "rbox 10 s | qhull
FQ". Option 'FQ' may be repeated multiple times.</p>
<h3><a href="#format">&#187;</a><a name="Fs">Fs - print summary</a></h3>
<p>The first line consists of number of integers ("10")
followed by the:
<ul>
<li>dimension
<li>number of points
<li>number of vertices
<li>number of facets
<li>number of vertices selected for output
<li>number of facets selected for output
<li>number of coplanar points for selected facets
<li>number of nonsimplicial or merged facets selected for
output
<LI>number of deleted vertices</LI>
<LI>number of triangulated facets ('<a href="qh-optq.htm#Qt">Qt</a>')</LI>
</ul>
<p>The second line consists of the number of reals
("2") followed by the:
<ul>
<li>maximum offset to an outer plane
<li>minimum offset to an inner plane.</li>
</ul>
Roundoff and joggle are included.
<P></P>
<p>For Delaunay triangulations and Voronoi diagrams, the
number of deleted vertices should be zero. If greater than zero, then the
input is highly degenerate and coplanar points are not necessarily coincident
points. For example, <tt>'RBOX 1000 s W1e-13 t995138628 | QHULL d Qbb'</tt> reports
deleted vertices; the input is nearly cospherical.</p>
<P>Later versions of Qhull may produce additional integers or reals.</P>
<h3><a href="#format">&#187;</a><a name="FS">FS - print sizes</a></h3>
<p>The first line consists of the number of integers
("0"). The second line consists of the number of reals
("2"), followed by the total facet area, and the total
volume. Later versions of Qhull may produce additional integers
or reals.</p>
<p>The total volume measures the volume of the intersection of
the halfspaces defined by each facet. It is computed from the
facet area. Both area and volume are approximations for
non-simplicial facets. See option '<a href="#Fa">Fa </a>' for
further notes. Option '<a href="#FA">FA </a>' also computes the total area and volume. </p>
<h3><a href="#format">&#187;</a><a name="Ft">Ft - print triangulation</a></h3>
<p>Prints a triangulation with added points for non-simplicial
facets. The output is </p>
<ul>
<li>The first line is the dimension
<li>The second line is the number of points, the number
of facets, and the number of ridges.
<li>All of the input points follow, one per line.
<li>The centrums follow, one per non-simplicial facet
<li>Then the facets follow as a list of point indices
preceded by the number of points. The simplices are
oriented. </li>
</ul>
<p>For convex hulls with simplicial facets, the output is the
same as option '<a href="qh-opto.htm#o">o</a>'.</p>
<p>The added points are the centrums of the non-simplicial
facets. Except for large facets, the centrum is the average
vertex coordinate projected to the facet's hyperplane. Large
facets may use an old centrum to avoid recomputing the centrum
after each merge. In either case, the centrum is clearly below
neighboring facets. See <a href="qh-impre.htm">Precision issues</a>.
</p>
<p>The new simplices will not be clearly convex with their
neighbors and they will not satisfy the Delaunay property. They
may even have a flipped orientation. Use triangulated input ('<A
href="qh-optq.htm#Qt">Qt</a>') for Delaunay triangulations.
<p>For Delaunay triangulations with simplicial facets, the output is the
same as option '<a href="qh-opto.htm#o">o</a>' without the lifted
coordinate. Since 'Ft' is invalid for merged Delaunay facets, option
'Ft' is not available for qdelaunay or qvoronoi. It may be used with
joggled input ('<a href="qh-optq.htm#QJn" >QJ</a>') or triangulated output ('<A
href="qh-optq.htm#Qt" >Qt</a>'), for example, rbox 10 c G 0.01 | qhull d QJ Ft</p>
<p>If you add a point-at-infinity with '<a href="qh-optq.htm#Qz">Qz</a>',
it is printed after the input sites and before any centrums. It
will not be used in a Delaunay facet.</p>
<h3><a href="#format">&#187;</a><a name="Fv">Fv - print vertices for
each facet</a></h3>
<p>The first line is the number of facets. Then each facet is
printed, one per line. Each line is the number of vertices
followed by the corresponding point ids. Vertices are listed in
the order they were added to the hull (the last one added is the
first listed).
</p>
<p>Option '<a href="qh-opto.htm#i">i</a>' also lists the vertices,
but it orients facets by reversing the order of two
vertices. Option 'i' triangulates non-simplicial, 4-d and higher facets by
adding vertices for the centrums.
</p>
<h3><a href="#format">&#187;</a><a name="Fv2">Fv - print Voronoi
diagram</a></h3>
<p>With <a href="qvoronoi.htm" >qvoronoi</a>, 'Fv' prints the
Voronoi diagram or furthest-site Voronoi diagram. The first line
is the number of ridges. Then each ridge is printed, one per
line. The first number is the count of indices. The second pair
of indices indicates a pair of input sites. The remaining indices
list the corresponding ridge of Voronoi vertices. Vertex 0 is the
vertex-at-infinity. It indicates an unbounded ray. </p>
<p>All vertices of a ridge are coplanar. If the ridge is
unbounded, add the midpoint of the pair of input sites. The
unbounded ray is directed from the Voronoi vertices to infinity. </p>
<p>Use '<a href="qh-optf.htm#Fo2">Fo</a>' for separating
hyperplanes of outer, unbounded regions. Use '<A
href="qh-optf.htm#Fi2" >Fi</a>' for separating hyperplanes of
inner, bounded regions. </p>
<p>Option 'Fv' does not list ridges that require more than one
midpoint. For example, the Voronoi diagram of cospherical points
lists zero ridges (e.g., 'rbox 10 s | qvoronoi Fv Qz').
Other examples are the Voronoi diagrams of a rectangular mesh
(e.g., 'rbox 27 M1,0 | qvoronoi Fv') or a point set with
a rectangular corner (e.g.,
'rbox P4,4,4 P4,2,4 P2,4,4 P4,4,2 10 | qvoronoi Fv').
Both cases miss unbounded rays at the corners.
To determine these ridges, surround the points with a
large cube (e.g., 'rbox 10 s c G2.0 | qvoronoi Fv Qz').
The cube needs to be large enough to bound all Voronoi regions of the original point set.
Please report any other cases that are missed. If you
can formally describe these cases or
write code to handle them, please send email to <A
href="mailto:qhull@qhull.org" >qhull@qhull.org</a>. </p>
<h3><a href="#format">&#187;</a><a name="FV">FV - print average
vertex </a></h3>
<p>The average vertex is the average of all vertex coordinates.
It is an interior point for halfspace intersection. The first
line is the dimension and "1"; the second line is the
coordinates. For example,</p>
<blockquote>
<p>qconvex FV <A
href="qh-opto.htm#n">n</a> | qhalf <a href="#Fp">Fp</a></p>
</blockquote>
<p>prints the extreme points of the original point set (roundoff
included). </p>
<h3><a href="#format">&#187;</a><a name="Fx">Fx - print extreme
points (vertices) of convex hulls and Delaunay triangulations</a></h3>
<p>The first line is the number of points. The following lines
give the index of the corresponding points. The first point is
'0'. </p>
<p>In 2-d, the extreme points (vertices) are listed in
counterclockwise order (by qh_ORIENTclock in user.h). </p>
<p>In 3-d and higher convex hulls, the extreme points (vertices)
are sorted by index. This is the same order as option '<A
href="qh-opto.htm#p" >p</a>' when it doesn't include coplanar or
interior points. </p>
<p>For Delaunay triangulations, 'Fx' lists the extreme
points of the input sites (i.e., the vertices of their convex hull). The points
are unordered. <!-- Navigation links --> </p>
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p><!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><IMG align=middle
height=40 src="qh--geom.gif" width=40 ></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created:
Sept. 25, 1995 --- <!-- hhmts start -->Last modified: see top
<!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,274 @@
<html>
<head>
<title>Qhull Geomview options (G)</title>
</head>
<body>
<!-- Navigation links -->
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/delaunay.html"><img
src="qh--dt.gif" alt="[delaunay]" align="middle" width="100"
height="100"></a> Qhull Geomview options (G)</h1>
This section lists the Geomview options for Qhull. These options are
indicated by 'G' followed by a letter. See
<a href="qh-opto.htm#output">Output</a>, <a href="qh-optp.htm#print">Print</a>,
and <a href="qh-optf.htm#format">Format</a> for other output options.
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="index.htm#TOC">&#187;</a> <a href="qh-quick.htm#programs">Programs</a>
<a name="geomview">&#149;</a> <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<h2>Geomview output options</h2>
<p><a href="http://www.geomview.org">Geomview</a> is the graphical
viewer for visualizing Qhull output in 2-d, 3-d and 4-d.</p>
<p>Geomview displays each facet of the convex hull. The color of
a facet is determined by the coefficients of the facet's normal
equation. For imprecise hulls, Geomview displays the inner and
outer hull. Geomview can also display points, ridges, vertices,
coplanar points, and facet intersections. </p>
<p>For 2-d Delaunay triangulations, Geomview displays the
corresponding paraboloid. Geomview displays the 2-d Voronoi
diagram. For halfspace intersections, it displays the
dual convex hull. </p>
<dl compact>
<dt>&nbsp;</dt>
<dd><b>General</b></dd>
<dt><a href="#G">G</a></dt>
<dd>display Geomview output</dd>
<dt><a href="#Gt">Gt</a></dt>
<dd>display transparent 3-d Delaunay triangulation</dd>
<dt><a href="#GDn">GDn</a></dt>
<dd>drop dimension n in 3-d and 4-d output </dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Specific</b></dd>
<dt><a href="#Ga">Ga</a></dt>
<dd>display all points as dots</dd>
<dt><a href="#Gc">Gc</a></dt>
<dd>display centrums (2-d, 3-d)</dd>
<dt><a href="#Gp">Gp</a></dt>
<dd>display coplanar points and vertices as radii</dd>
<dt><a href="#Gh">Gh</a></dt>
<dd>display hyperplane intersections</dd>
<dt><a href="#Gi">Gi</a></dt>
<dd>display inner planes only (2-d, 3-d)</dd>
<dt><a href="#Go">Go</a></dt>
<dd>display outer planes only (2-d, 3-d)</dd>
<dt><a href="#Gr">Gr</a></dt>
<dd>display ridges (3-d)</dd>
<dt><a href="#Gv">Gv</a></dt>
<dd>display vertices as spheres</dd>
<dt><a href="#Gn">Gn</a></dt>
<dd>do not display planes</dd>
</dl>
<hr>
<h3><a href="#geomview">&#187;</a><a name="G">G - produce output for
viewing with Geomview</a></h3>
<p>By default, option 'G' displays edges in 2-d, outer planes in
3-d, and ridges in 4-d.</p>
<p>A ridge can be explicit or implicit. An explicit ridge is a <i>(d-1)</i>-dimensional
simplex between two facets. In 4-d, the explicit ridges are
triangles. An implicit ridge is the topological intersection of
two neighboring facets. It is the union of explicit ridges.</p>
<p>For non-simplicial 4-d facets, the explicit ridges can be
quite complex. When displaying a ridge in 4-d, Qhull projects the
ridge's vertices to one of its facets' hyperplanes. Use '<a
href="#Gh">Gh</a>' to project ridges to the intersection of both
hyperplanes. This usually results in a cleaner display. </p>
<p>For 2-d Delaunay triangulations, Geomview displays the
corresponding paraboloid. Geomview displays the 2-d Voronoi
diagram. For halfspace intersections, it displays the
dual convex hull.
<h3><a href="#geomview">&#187;</a><a name="Ga">Ga - display all
points as dots </a></h3>
<p>Each input point is displayed as a green dot.</p>
<h3><a href="#geomview">&#187;</a><a name="Gc">Gc - display centrums
(3-d) </a></h3>
<p>The centrum is defined by a green radius sitting on a blue
plane. The plane corresponds to the facet's hyperplane. If you
sight along a facet's hyperplane, you will see that all
neighboring centrums are below the facet. The radius is defined
by '<a href="qh-optc.htm#Cn">C-n</a>' or '<a
href="qh-optc.htm#Cn2">Cn</a>'.</p>
<h3><a href="#geomview">&#187;</a><a name="GDn">GDn - drop dimension
n in 3-d and 4-d output </a></h3>
<p>The result is a 2-d or 3-d object. In 4-d, this corresponds to
viewing the 4-d object from the nth axis without perspective.
It's best to view 4-d objects in pieces. Use the '<a
href="qh-optp.htm#Pdk">Pdk</a>' '<a href="qh-optp.htm#Pg">Pg</a>'
'<a href="qh-optp.htm#PG">PG</a>' '<a href="qh-optq.htm#QGn">QGn</a>'
and '<a href="qh-optq.htm#QVn">QVn</a>' options to select a few
facets. If one of the facets is perpendicular to an axis, then
projecting along that axis will show the facet exactly as it is
in 4-d. If you generate many facets, use Geomview's <tt>ginsu</tt>
module to view the interior</p>
<p>To view multiple 4-d dimensions at once, output the object
without 'GDn' and read it with Geomview's <tt>ndview</tt>. As you
rotate the object in one set of dimensions, you can see how it
changes in other sets of dimensions.</p>
<p>For additional control over 4-d objects, output the object
without 'GDn' and read it with Geomview's <tt>4dview</tt>. You
can slice the object along any 4-d plane. You can also flip the
halfspace that's deleted when slicing. By combining these
features, you can get some interesting cross sections.</p>
<h3><a href="#geomview">&#187;</a><a name="Gh">Gh - display
hyperplane intersections (3-d, 4-d)</a></h3>
<p>In 3-d, the intersection is a black line. It lies on two
neighboring hyperplanes, c.f., the blue squares associated with
centrums ('<a href="#Gc">Gc </a>'). In 4-d, the ridges are
projected to the intersection of both hyperplanes. If you turn on
edges (Geomview's 'appearances' menu), each triangle corresponds
to one ridge. The ridges may overlap each other.</p>
<h3><a href="#geomview">&#187;</a><a name="Gi">Gi - display inner
planes only (2-d, 3-d)</a></h3>
<p>The inner plane of a facet is below all of its vertices. It is
parallel to the facet's hyperplane. The inner plane's color is
the opposite of the outer plane's color, i.e., <i>[1-r,1-g,1-b] </i>.
Its edges are determined by the vertices.</p>
<h3><a href="#geomview">&#187;</a><a name="Gn">Gn - do not display
planes </a></h3>
<p>By default, Geomview displays the precise plane (no merging)
or both inner and output planes (if merging). If merging,
Geomview does not display the inner plane if the the difference
between inner and outer is too small.</p>
<h3><a href="#geomview">&#187;</a><a name="Go">Go - display outer
planes only (2-d, 3-d)</a></h3>
<p>The outer plane of a facet is above all input points. It is
parallel to the facet's hyperplane. Its color is determined by
the facet's normal, and its edges are determined by the vertices.</p>
<h3><a href="#geomview">&#187;</a><a name="Gp">Gp - display coplanar
points and vertices as radii </a></h3>
<p>Coplanar points ('<a href="qh-optq.htm#Qc">Qc</a>'), interior
points ('<a href="qh-optq.htm#Qi">Qi</a>'), outside points ('<a
href="qh-optt.htm#TCn">TCn</a>' or '<a href="qh-optt.htm#TVn">TVn</a>'),
and vertices are displayed as red and yellow radii. The radii are
perpendicular to the corresponding facet. Vertices are aligned
with an interior point. The radii define a ball which corresponds
to the imprecision of the point. The imprecision is the maximum
of the roundoff error, the centrum radius, and <i>maxcoord * (1 -
</i><a href="qh-optc.htm#An"><i>A-n</i></a><i>)</i>. It is at
least 1/20'th of the maximum coordinate, and ignores post merging
if pre-merging is done.</p>
<p>If '<a href="qh-optg.htm#Gv">Gv</a>' (print vertices as
spheres) is also selected, option 'Gp' displays coplanar
points as radii. Select options <a href="qh-optq.htm#Qc">Qc</a>'
and/or '<a href="qh-optq.htm#Qi">Qi</a>'. Options 'Qc Gpv' displays
coplanar points while 'Qci Gpv' displays coplanar and interior
points. Option 'Qc' is automatically selected if 'Qi' is not
selected with options 'Gpv'.
<h3><a href="#geomview">&#187;</a><a name="Gr">Gr - display ridges
(3-d) </a></h3>
<p>A ridge connects the two vertices that are shared by
neighboring facets. It is displayed in green. A ridge is the
topological edge between two facets while the hyperplane
intersection is the geometric edge between two facets. Ridges are
always displayed in 4-d.</p>
<h3><a href="#geomview">&#187;</a><a name="Gt">Gt - transparent 3-d
Delaunay </a></h3>
<p>A 3-d Delaunay triangulation looks like a convex hull with
interior facets. Option 'Gt' removes the outside ridges to reveal
the outermost facets. It automatically sets options '<a
href="#Gr">Gr</a>' and '<a href="#GDn">GDn</a>'. See example <a
href="qh-eg.htm#17f">eg.17f.delaunay.3</a>.</p>
<h3><a href="#geomview">&#187;</a><a name="Gv">Gv - display vertices
as spheres (2-d, 3-d)</a></h3>
<p>The radius of the sphere corresponds to the imprecision of the
data. See '<a href="#Gp">Gp</a>' for determining the radius.</p>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,353 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Qhull output options</title>
</head>
<body>
<!-- Navigation links -->
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/delaunay.html"><img
src="qh--dt.gif" alt="[delaunay]" align="middle" width="100"
height="100"></a> Qhull output options</h1>
<p>This section lists the output options for Qhull. These options
are indicated by lower case characters. See <a
href="qh-optf.htm#format">Formats</a>, <a
href="qh-optp.htm#print">Print</a>, and <a
href="qh-optg.htm#geomview">Geomview</a> for other output
options. </p>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="index.htm#TOC">&#187;</a> <a href="qh-quick.htm#programs">Programs</a>
<a name="output">&#149;</a> <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<h2>Output options</h2>
<p>Qhull prints its output to standard out. All output is printed
text. The default output is a summary (option '<a href="#s">s</a>').
Other outputs may be specified as follows. </p>
<dl compact>
<dt><a href="#f">f</a></dt>
<dd>print all fields of all facets</dd>
<dt><a href="#n">n</a></dt>
<dd>print hyperplane normals with offsets</dd>
<dt><a href="#m">m</a></dt>
<dd>print Mathematica output (2-d and 3-d)</dd>
<dt><a href="#o">o</a></dt>
<dd>print OFF file format (dim, points and facets)</dd>
<dt><a href="#s">s</a></dt>
<dd>print summary to stderr</dd>
<dt><a href="#p">p</a></dt>
<dd>print vertex and point coordinates</dd>
<dt><a href="#i">i</a></dt>
<dd>print vertices incident to each facet </dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Related options</b></dd>
<dt><a href="qh-optf.htm#format">F</a></dt>
<dd>additional input/output formats</dd>
<dt><a href="qh-optg.htm#geomview">G</a></dt>
<dd>Geomview output</dd>
<dt><a href="qh-optp.htm#print">P</a></dt>
<dd>Print options</dd>
<dt><a href="qh-optf.htm#Ft">Ft</a></dt>
<dd>print triangulation with added points</dd>
<dt>&nbsp;</dt>
</dl>
<hr>
<h3><a href="#output">&#187;</a><a name="f">f - print all fields of
all facets </a></h3>
<p>Print <a href=../src/libqhull.h#facetT>all fields</a> of all facets.
The facet is the primary <a href=index.htm#structure>data structure</a> for
Qhull.
<p>Option 'f' is for
debugging. Most of the fields are available via the '<a
href="qh-optf.htm#format">F</a>' options. If you need specialized
information from Qhull, you can use the <a
href="qh-code.htm#library">Qhull library</a> or <a
href="qh-code.htm#cpp">C++ interface</a>.</p>
<p>Use the '<a href="qh-optf.htm#FF">FF</a>' option to print the
facets but not the ridges. </p>
<h3><a href="#output">&#187;</a><a name="i">i - print vertices
incident to each facet </a></h3>
<p>The first line is the number of facets. The remaining lines
list the vertices for each facet, one facet per line. The indices
are 0-relative indices of the corresponding input points. The
facets are oriented. Option '<a href="qh-optf.htm#Fv">Fv</a>'
displays an unoriented list of vertices with a vertex count per
line. Options '<a href="qh-opto.htm#o">o</a>' and '<a
href="qh-optf.htm#Ft">Ft</a>' displays coordinates for each
vertex prior to the vertices for each facet. </p>
<p>Simplicial facets (e.g., triangles in 3-d) consist of <i>d</i>
vertices. Non-simplicial facets in 3-d consist of 4 or more
vertices. For example, a facet of a cube consists of 4 vertices.
Use option '<a href="qh-optq.htm#Qt">Qt</a>' to triangulate non-simplicial facets.</p>
<p>For 4-d and higher convex hulls and 3-d and higher Delaunay
triangulations, <i>d</i> vertices are listed for all facets. A
non-simplicial facet is triangulated with its centrum and each
ridge. The index of the centrum is higher than any input point.
Use option '<a href="qh-optf.htm#Fv">Fv</a>' to list the vertices
of non-simplicial facets as is. Use option '<a
href="qh-optf.htm#Ft">Ft</a>' to print the coordinates of the
centrums as well as those of the input points. </p>
<h3><a href="#output">&#187;</a><a name="m">m - print Mathematica
output </a></h3>
<p>Qhull writes a Mathematica file for 2-d and 3-d convex hulls,
2-d and 3-d halfspace intersections,
and 2-d Delaunay triangulations. Qhull produces a list of
objects that you can assign to a variable in Mathematica, for
example: &quot;<tt>list= &lt;&lt; &lt;outputfilename&gt; </tt>&quot;.
If the object is 2-d, it can be visualized by &quot;<tt>Show[Graphics[list]]
</tt>&quot;. For 3-d objects the command is &quot;<tt>Show[Graphics3D[list]]
</tt>&quot;. Now the object can be manipulated by commands of the
form <tt>&quot;Show[%, &lt;parametername&gt; -&gt;
&lt;newvalue&gt;]</tt>&quot;. </p>
<p>For Delaunay triangulation orthogonal projection is better.
This can be specified, for example, by &quot;<tt>BoxRatios:
Show[%, BoxRatios -&gt; {1, 1, 1e-8}]</tt>&quot;. To see the
meaningful side of the 3-d object used to visualize 2-d Delaunay,
you need to change the viewpoint: &quot;<tt>Show[%, ViewPoint
-&gt; {0, 0, -1}]</tt>&quot;. By specifying different viewpoints
you can slowly rotate objects. </p>
<p>For halfspace intersections, Qhull produces the dual
convex hull.
<p>See <a href="qh-faq.htm#math">Is Qhull available for Mathematica?</a>
for URLs.
<h3><a href="#output">&#187;</a><a name="n">n - print hyperplane
normals with offsets </a></h3>
<p>The first line is the dimension plus one. The second line is
the number of facets. The remaining lines are the normals for
each facet, one normal per line. The facet's offset follows its
normal coefficients.</p>
<p>The normals point outward, i.e., the convex hull satisfies <i>Ax
&lt;= -b </i>where <i>A</i> is the matrix of coefficients and <i>b</i>
is the vector of offsets.</p>
<p>A point is <i>inside</i> or <i>below</i> a hyperplane if its distance
to the hyperplane is negative. A point is <i>outside</i> or <i>above</i> a hyperplane
if its distance to the hyperplane is positive. Otherwise a point is <i>on</i> or
<i>coplanar to</i> the hyperplane.
<p>If cdd output is specified ('<a href="qh-optf.htm#FD">FD</a>'),
Qhull prints the command line, the keyword &quot;begin&quot;, the
number of facets, the dimension (plus one), the keyword
&quot;real&quot;, and the normals for each facet. The facet's
negative offset precedes its normal coefficients (i.e., if the
origin is an interior point, the offset is positive). Qhull ends
the output with the keyword &quot;end&quot;. </p>
<h3><a href="#output">&#187;</a><a name="o">o - print OFF file format
</a></h3>
<p>The output is: </p>
<ul>
<li>The first line is the dimension </li>
<li>The second line is the number of points, the number of
facets, and the number of ridges. </li>
<li>All of the input points follow, one per line. </li>
<li>Then Qhull prints the vertices for each facet. Each facet
is on a separate line. The first number is the number of
vertices. The remainder is the indices of the
corresponding points. The vertices are oriented in 2-d,
3-d, and in simplicial facets. </li>
</ul>
<p>Option '<a href="qh-optf.htm#Ft">Ft</a>' prints the same
information with added points for non-simplicial facets.</p>
<p>Option '<a href="qh-opto.htm#i">i</a>' displays vertices
without the point coordinates. Option '<a href="qh-opto.htm#p">p</a>'
displays the point coordinates without vertex and facet information.</p>
<p>In 3-d, Geomview can load the file directly if you delete the
first line (e.g., by piping through '<tt>tail +2</tt>').</p>
<p>For Voronoi diagrams (<a href=qvoronoi.htm>qvoronoi</a>), option
'o' prints Voronoi vertices and Voronoi regions instead of input
points and facets. The first vertex is the infinity vertex
[-10.101, -10.101, ...]. Then, option 'o' lists the vertices in
the Voronoi region for each input site. The regions appear in
site ID order. In 2-d, the vertices of a Voronoi region are
sorted by adjacency (non-oriented). In 3-d and higher, the
Voronoi vertices are sorted by index. See the '<a
href="qh-optf.htm#FN">FN</a>' option for listing Voronoi regions
without listing Voronoi vertices.</p>
<p>If you are using the Qhull library, options 'v o' have the
side effect of reordering the neighbors for a vertex.</p>
<h3><a href="#output">&#187;</a><a name="p">p - print vertex and
point coordinates </a></h3>
<p>The first line is the dimension. The second line is the number
of vertices. The remaining lines are the vertices, one vertex per
line. A vertex consists of its point coordinates</p>
<p>With the '<a href="qh-optg.htm#Gc">Gc</a>' and '<a
href="qh-optg.htm#Gi">Gi</a>' options, option 'p' also prints
coplanar and interior points respectively.</p>
<p>For <a href=qvoronoi.htm>qvoronoi</a>, it prints the
coordinates of each Voronoi vertex.</p>
<p>For <a href=qdelaun.htm>qdelaunay</a>, it prints the
input sites as lifted to a paraboloid. For <a href=qhalf.htm>qhalf</a>
it prints the dual points. For both, option 'p' is the same as the first
section of option '<a href="qh-opto.htm#o">o</a>'.</p>
<p>Use '<a href="qh-optf.htm#Fx">Fx</a>' to list the point ids of
the extreme points (i.e., vertices). </p>
<p>If a subset of the facets is selected ('<a
href="qh-optp.htm#Pdk">Pdk</a>', '<a href="qh-optp.htm#PDk">PDk</a>',
'<a href="qh-optp.htm#Pg">Pg</a>' options), option 'p' only
prints vertices and points associated with those facets.</p>
<p>If cdd-output format is selected ('<a href="qh-optf.htm#FD">FD</a>'),
the first line is &quot;begin&quot;. The second line is the
number of vertices, the dimension plus one, and &quot;real&quot;.
The vertices follow with a leading &quot;1&quot;. Output ends
with &quot;end&quot;. </p>
<h3><a href="#output">&#187;</a><a name="s">s - print summary to
stderr </a></h3>
<p>The default output of Qhull is a summary to stderr. Options '<a
href="qh-optf.htm#FS">FS</a>' and '<a href="qh-optf.htm#Fs">Fs</a>'
produce the same information for programs. <b>Note</b>: Windows 95 and 98
treats stderr the same as stdout. Use option '<a href="qh-optt.htm#TO">TO file</a>' to separate
stderr and stdout.</p>
<p>The summary lists the number of input points, the dimension,
the number of vertices in the convex hull, and the number of
facets in the convex hull. It lists the number of selected
(&quot;good&quot;) facets for options '<a href="qh-optp.htm#Pg">Pg</a>',
'<a href="qh-optp.htm#Pdk">Pdk</a>', <a href=qdelaun.htm>qdelaunay</a>,
or <a href=qvoronoi.htm>qvoronoi</a> (Delaunay triangulations only
use the lower half of a convex hull). It lists the number of
coplanar points. For Delaunay triangulations without '<a
href="qh-optq.htm#Qc">Qc</a>', it lists the total number of
coplanar points. It lists the number of simplicial facets in
the output.</p>
<p>The terminology depends on the output structure. </p>
<p>The summary lists these statistics:</p>
<ul>
<li>number of points processed by Qhull </li>
<li>number of hyperplanes created</li>
<li>number of distance tests (not counting statistics,
summary, and checking) </li>
<li>number of merged facets (if any)</li>
<li>number of distance tests for merging (if any)</li>
<li>CPU seconds to compute the hull</li>
<li>the maximum joggle for '<a href="qh-optq.htm#QJn">QJ</a>'<br>
or, the probability of precision errors for '<a
href="qh-optq.htm#QJn">QJ</a> <a href="qh-optt.htm#TRn">TRn</a>'
</li>
<li>total area and volume (if computed, see '<a
href="qh-optf.htm#FS">FS</a>' '<a href="qh-optf.htm#FA">FA</a>'
'<a href="qh-optf.htm#Fa">Fa</a>' '<a
href="qh-optp.htm#PAn">PAn</a>')</li>
<li>max. distance of a point above a facet (if non-zero)</li>
<li>max. distance of a vertex below a facet (if non-zero)</li>
</ul>
<p>The statistics include intermediate hulls. For example 'rbox d
D4 | qhull' reports merged facets even though the final hull is
simplicial. </p>
<p>Qhull starts counting CPU seconds after it has read and
projected the input points. It stops counting before producing
output. In the code, CPU seconds measures the execution time of
function qhull() in <tt>libqhull.c</tt>. If the number of CPU
seconds is clearly wrong, check qh_SECticks in <tt>user.h</tt>. </p>
<p>The last two figures measure the maximum distance from a point
or vertex to a facet. They are not printed if less than roundoff
or if not merging. They account for roundoff error in computing
the distance (c.f., option '<a href="qh-optc.htm#Rn">Rn</a>').
Use '<a href="qh-optf.htm#Fs">Fs</a>' to report the maximum outer
and inner plane. </p>
<p>A number may appear in parentheses after the maximum distance
(e.g., 2.1x). It is the ratio between the maximum distance and
the worst-case distance due to merging two simplicial facets. It
should be small for 2-d, 3-d, and 4-d, and for higher dimensions
with '<a href="qh-optq.htm#Qx">Qx</a>'. It is not printed if less
than 0.05. </p>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,253 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Qhull print options (P)</title>
</head>
<body>
<!-- Navigation links -->
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/delaunay.html"><img
src="qh--dt.gif" alt="[delaunay]" align="middle" width="100"
height="100"></a> Qhull print options (P)</h1>
This section lists the print options for Qhull. These options are
indicated by 'P' followed by a letter. See
<a href="qh-opto.htm#output">Output</a>, <a href="qh-optg.htm#geomview">Geomview</a>,
and <a href="qh-optf.htm#format">Format</a> for other output options.
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="index.htm#TOC">&#187;</a> <a href="qh-quick.htm#programs">Programs</a>
<a name="format">&#149;</a> <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<h2>Print options</h2>
<blockquote>
<dl compact>
<dt>&nbsp;</dt>
<dd><b>General</b></dd>
<dt><a href="#Pp">Pp</a></dt>
<dd>do not report precision problems </dd>
<dt><a href="#Po">Po</a></dt>
<dd>force output despite precision problems</dd>
<dt><a href="#Po2">Po</a></dt>
<dd>if error, output neighborhood of facet</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Select</b></dd>
<dt><a href="#Pdk">Pdk:n</a></dt>
<dd>print facets with normal[k] &gt;= n (default 0.0)</dd>
<dt><a href="#PDk">PDk:n</a></dt>
<dd>print facets with normal[k] &lt;= n </dd>
<dt><a href="#PFn">PFn</a></dt>
<dd>print facets whose area is at least n</dd>
<dt><a href="#Pg">Pg</a></dt>
<dd>print good facets only (needs '<a href="qh-optq.htm#QGn">QGn</a>'
or '<a href="qh-optq.htm#QVn">QVn </a>')</dd>
<dt><a href="#PMn">PMn</a></dt>
<dd>print n facets with most merges</dd>
<dt><a href="#PAn">PAn</a></dt>
<dd>print n largest facets by area</dd>
<dt><a href="#PG">PG</a></dt>
<dd>print neighbors of good facets</dd>
</dl>
</blockquote>
<hr>
<h3><a href="#print">&#187;</a><a name="PAn">PAn - keep n largest
facets by area</a></h3>
<p>The <i>n</i> largest facets are marked good for printing. This
may be useful for <a href="qh-impre.htm#approximate">approximating
a hull</a>. Unless '<a href="#PG">PG</a>' is set, '<a href="#Pg">Pg</a>'
is automatically set. </p>
<h3><a href="#print">&#187;</a><a name="Pdk">Pdk:n - print facet if
normal[k] &gt;= n </a></h3>
<p>For a given output, print only those facets with <i>normal[k] &gt;= n</i>
and <i>drop</i> the others. For example, 'Pd0:0.5' prints facets with <i>normal[0]
&gt;= 0.5 </i>. The default value of <i>n</i> is zero. For
example in 3-d, 'Pd0d1d2' prints facets in the positive octant.
<p>
If no facets match, the closest facet is returned.</p>
<p>
On Windows 95, do not combine multiple options. A 'd' is considered
part of a number. For example, use 'Pd0:0.5 Pd1:0.5' instead of
'Pd0:0.5d1:0.5'.
<h3><a href="#print">&#187;</a><a name="PDk">PDk:n - print facet if
normal[k] &lt;= n</a></h3>
<p>For a given output, print only those facets with <i>normal[k] &lt;= n</i>
and <i>drop</i> the others.
For example, 'PD0:0.5' prints facets with <i>normal[0]
&lt;= 0.5 </i>. The default value of <i>n</i> is zero. For
example in 3-d, 'PD0D1D2' displays facets in the negative octant.
<p>
If no facets match, the closest facet is returned.</p>
<p>In 2-d, 'd G PD2' displays the Delaunay triangulation instead
of the corresponding paraboloid. </p>
<p>Be careful of placing 'Dk' or 'dk' immediately after a real
number. Some compilers treat the 'D' as a double precision
exponent. </p>
<h3><a href="#print">&#187;</a><a name="PFn">PFn - keep facets whose
area is at least n</a></h3>
<p>The facets with area at least <i>n</i> are marked good for
printing. This may be useful for <a
href="qh-impre.htm#approximate">approximating a hull</a>. Unless
'<a href="#PG">PG</a>' is set, '<a href="#Pg">Pg</a>' is
automatically set. </p>
<h3><a href="#print">&#187;</a><a name="Pg">Pg - print good facets </a></h3>
<p>Qhull can mark facets as &quot;good&quot;. This is used to</p>
<ul>
<li>mark the lower convex hull for Delaunay triangulations
and Voronoi diagrams</li>
<li>mark the facets that are visible from a point (the '<a
href="qh-optq.htm#QGn">QGn </a>' option)</li>
<li>mark the facets that contain a point (the '<a
href="qh-optq.htm#QVn">QVn</a>' option).</li>
<li>indicate facets with a large enough area (options '<a
href="#PAn">PAn</a>' and '<a href="#PFn">PFn</a>')</li>
</ul>
<p>Option '<a href="#Pg">Pg</a>' only prints good facets that
also meet '<a href="#Pdk">Pdk</a>' and '<a href="#PDk">PDk</a>'
options. It is automatically set for options '<a href="#PAn">PAn</a>',
'<a href="#PFn">PFn </a>', '<a href="qh-optq.htm#QGn">QGn</a>',
and '<a href="qh-optq.htm#QVn">QVn</a>'.</p>
<h3><a href="#print">&#187;</a><a name="PG">PG - print neighbors of
good facets</a></h3>
<p>Option 'PG' can be used with or without option '<a href="#Pg">Pg</a>'
to print the neighbors of good facets. For example, options '<a
href="qh-optq.htm#QGn">QGn</a>' and '<a href="qh-optq.htm#QVn">QVn</a>'
print the horizon facets for point <i>n. </i></p>
<h3><a href="#print">&#187;</a><a name="PMn">PMn - keep n facets with
most merges</a></h3>
<p>The n facets with the most merges are marked good for
printing. This may be useful for <a
href="qh-impre.htm#approximate">approximating a hull</a>. Unless
'<a href="#PG">PG</a>' is set, '<a href="#Pg">Pg</a>' is
automatically set. </p>
<p>Use option '<a href="qh-optf.htm#Fm">Fm</a>' to print merges
per facet.
<h3><a href="#print">&#187;</a><a name="Po">Po - force output despite
precision problems</a></h3>
<p>Use options 'Po' and '<a href="qh-optq.htm#Q0">Q0</a>' if you
can not merge facets, triangulate the output ('<a href="qh-optq.htm#Qt">Qt</a>'),
or joggle the input (<a href="qh-optq.htm#QJn">QJ</a>).
<p>Option 'Po' can not force output when
duplicate ridges or duplicate facets occur. It may produce
erroneous results. For these reasons, merged facets, joggled input, or <a
href="qh-impre.htm#exact">exact arithmetic</a> are better.</p>
<p>If you need a simplicial Delaunay triangulation, use
joggled input '<a href="qh-optq.htm#QJn">QJ</a>' or triangulated
output '<a
href="qh-optf.htm#Ft">Ft</a>'.
<p>Option 'Po' may be used without '<a href="qh-optq.htm#Q0">Q0</a>'
to remove some steps from Qhull or to output the neighborhood of
an error.</p>
<p>Option 'Po' may be used with option '<a href="qh-optq.htm#Q5">Q5</a>')
to skip qh_check_maxout (i.e., do not determine the maximum outside distance).
This can save a significant amount of time.
<p>If option 'Po' is used,</p>
<ul>
<li>most precision errors allow Qhull to continue. </li>
<li>verify ('<a href="qh-optt.htm#Tv">Tv</a>') does not check
coplanar points.</li>
<li>points are not partitioned into flipped facets and a
flipped facet is always visible to a point. This may
delete flipped facets from the output. </li>
</ul>
<h3><a href="#print">&#187;</a><a name="Po2">Po - if error, output
neighborhood of facet</a></h3>
<p>If an error occurs before the completion of Qhull and tracing
is not active, 'Po' outputs a neighborhood of the erroneous
facets (if any). It uses the current output options.</p>
<p>See '<a href="qh-optp.htm#Po">Po</a>' - force output despite
precision problems.
<h3><a href="#print">&#187;</a><a name="Pp">Pp - do not report
precision problems </a></h3>
<p>With option 'Pp', Qhull does not print statistics about
precision problems, and it removes some of the warnings. It
removes the narrow hull warning.</p>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,731 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Qhull control options (Q)</title>
</head>
<body>
<!-- Navigation links -->
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/delaunay.html"><img
src="qh--dt.gif" alt="[delaunay]" align="middle" width="100"
height="100"></a> Qhull control options (Q)</h1>
<p>This section lists the control options for Qhull. These
options are indicated by 'Q' followed by a letter. </p>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="index.htm#TOC">&#187;</a> <a href="qh-quick.htm#programs">Programs</a>
<a name="qhull">&#149;</a> <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<h2>Qhull control options</h2>
<dl compact>
<dt>&nbsp;</dt>
<dd><b>General</b></dd>
<dt><a href="#Qu">Qu</a></dt>
<dd>compute upper hull for furthest-site Delaunay
triangulation </dd>
<dt><a href="#Qc">Qc</a></dt>
<dd>keep coplanar points with nearest facet</dd>
<dt><a href="#Qi">Qi</a></dt>
<dd>keep interior points with nearest facet</dd>
<dt><a href="#QJn">QJ</a></dt>
<dd>joggled input to avoid precision problems</dd>
<dt><a href="#Qt">Qt</a></dt>
<dd>triangulated output</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Precision handling</b></dd>
<dt><a href="#Qz">Qz</a></dt>
<dd>add a point-at-infinity for Delaunay triangulations</dd>
<dt><a href="#Qx">Qx</a></dt>
<dd>exact pre-merges (allows coplanar facets)</dd>
<dt><a href="#Qs">Qs</a></dt>
<dd>search all points for the initial simplex</dd>
<dt><a href="#Qbb">Qbb</a></dt>
<dd>scale last coordinate to [0,m] for Delaunay</dd>
<dt><a href="#Qv">Qv</a></dt>
<dd>test vertex neighbors for convexity</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Transform input</b></dd>
<dt><a href="#Qb0">Qbk:0Bk:0</a></dt>
<dd>drop dimension k from input</dd>
<dt><a href="#QRn">QRn</a></dt>
<dd>random rotation (n=seed, n=0 time, n=-1 time/no rotate)</dd>
<dt><a href="#Qbk">Qbk:n</a></dt>
<dd>scale coord[k] to low bound of n (default -0.5)</dd>
<dt><a href="#QBk">QBk:n</a></dt>
<dd>scale coord[k] to upper bound of n (default 0.5)</dd>
<dt><a href="#QbB">QbB</a></dt>
<dd>scale input to fit the unit cube</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Select facets</b></dd>
<dt><a href="#QVn">QVn</a></dt>
<dd>good facet if it includes point n, -n if not</dd>
<dt><a href="#QGn">QGn</a></dt>
<dd>good facet if visible from point n, -n for not visible</dd>
<dt><a href="#Qg">Qg</a></dt>
<dd>only build good facets (needs '<a href="#QGn">QGn</a>', '<a
href="#QVn">QVn </a>', or '<a href="qh-optp.htm#Pdk">Pdk</a>')</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Experimental</b></dd>
<dt><a href="#Q4">Q4</a></dt>
<dd>avoid merging old facets into new facets</dd>
<dt><a href="#Q5">Q5</a></dt>
<dd>do not correct outer planes at end of qhull</dd>
<dt><a href="#Q3">Q3</a></dt>
<dd>do not merge redundant vertices</dd>
<dt><a href="#Q6">Q6</a></dt>
<dd>do not pre-merge concave or coplanar facets</dd>
<dt><a href="#Q0">Q0</a></dt>
<dd>do not pre-merge facets with 'C-0' or 'Qx'</dd>
<dt><a href="#Q8">Q8</a></dt>
<dd>ignore near-interior points</dd>
<dt><a href="#Q2">Q2</a></dt>
<dd>merge all non-convex at once instead of independent sets</dd>
<dt><a href="#Qf">Qf</a></dt>
<dd>partition point to furthest outside facet</dd>
<dt><a href="#Q7">Q7</a></dt>
<dd>process facets depth-first instead of breadth-first</dd>
<dt><a href="#Q9">Q9</a></dt>
<dd>process furthest of furthest points</dd>
<dt><a href="#Q10">Q10</a></dt>
<dd>no special processing for narrow distributions</dd>
<dt><a href="#Q11">Q11</a></dt>
<dd>copy normals and recompute centrums for tricoplanar facets</dd>
<dt><a href="#Q12">Q12</a></dt>
<dd>do not error on wide merge due to duplicate ridge and nearly coincident points</dd>
<dt><a href="#Qm">Qm</a></dt>
<dd>process points only if they would increase the max. outer
plane </dd>
<dt><a href="#Qr">Qr</a></dt>
<dd>process random outside points instead of furthest one</dd>
<dt><a href="#Q1">Q1</a></dt>
<dd>sort merges by type instead of angle</dd>
</dl>
<hr>
<h3><a href="#qhull">&#187;</a><a name="Qbb">Qbb - scale the last
coordinate to [0,m] for Delaunay</a></h3>
<p>After scaling with option 'Qbb', the lower bound of the last
coordinate will be 0 and the upper bound will be the maximum
width of the other coordinates. Scaling happens after projecting
the points to a paraboloid and scaling other coordinates. </p>
<p>Option 'Qbb' is automatically set for <a href=qdelaun.htm>qdelaunay</a>
and <a href=qvoronoi.htm>qvoronoi</a>. Option 'Qbb' is automatically set for joggled input '<a
href="qh-optq.htm#QJn">QJ</a>'. </p>
<p>Option 'Qbb' should be used for Delaunay triangulations with
integer coordinates. Since the last coordinate is the sum of
squares, it may be much larger than the other coordinates. For
example, <tt>rbox 10000 D2 B1e8 | qhull d</tt> has precision
problems while <tt>rbox 10000 D2 B1e8 | qhull d Qbb</tt> is OK. </p>
<h3><a href="#qhull">&#187;</a><a name="QbB">QbB - scale the input to
fit the unit cube</a></h3>
<p>After scaling with option 'QbB', the lower bound will be -0.5
and the upper bound +0.5 in all dimensions. For different bounds
change qh_DEFAULTbox in <tt>user.h</tt> (0.5 is best for <a
href="index.htm#geomview">Geomview</a>).</p>
<p>For Delaunay and Voronoi diagrams, scaling happens after
projection to the paraboloid. Under precise arithmetic, scaling
does not change the topology of the convex hull. Scaling may
reduce precision errors if coordinate values vary widely.</p>
<h3><a href="#qhull">&#187;</a><a name="Qbk">Qbk:n - scale coord[k]
to low bound</a></h3>
<p>After scaling, the lower bound for dimension k of the input
points will be n. 'Qbk' scales coord[k] to -0.5. </p>
<h3><a href="#qhull">&#187;</a><a name="QBk">QBk:n - scale coord[k]
to upper bound </a></h3>
<p>After scaling, the upper bound for dimension k of the input
points will be n. 'QBk' scales coord[k] to 0.5. </p>
<h3><a href="#qhull">&#187;</a><a name="Qb0">Qbk:0Bk:0 - drop
dimension k from the input points</a></h3>
<p>Drop dimension<em> k </em>from the input points. For example,
'Qb1:0B1:0' deletes the y-coordinate from all input points. This
allows the user to take convex hulls of sub-dimensional objects.
It happens before the Delaunay and Voronoi transformation.
It happens after the halfspace transformation for both the data
and the feasible point.</p>
<h3><a href="#qhull">&#187;</a><a name="Qc">Qc - keep coplanar points
with nearest facet </a></h3>
<p>During construction of the hull, a point is coplanar if it is
between '<a href="qh-optc.htm#Wn">Wn</a>' above and '<a
href="qh-optc.htm#Un">Un</a>' below a facet's hyperplane. A
different definition is used for output from Qhull. </p>
<p>For output, a coplanar point is above the minimum vertex
(i.e., above the inner plane). With joggle ('<a
href="qh-optq.htm#QJn">QJ</a>'), a coplanar point includes points
within one joggle of the inner plane. </p>
<p>With option 'Qc', output formats '<a href="qh-opto.htm#p">p </a>',
'<a href="qh-opto.htm#f">f</a>', '<a href="qh-optg.htm#Gp">Gp</a>',
'<a href="qh-optf.htm#Fc">Fc</a>', '<a href="qh-optf.htm#FN">FN</a>',
and '<a href="qh-optf.htm#FP">FP</a>' will print the coplanar
points. With options 'Qc <a href="#Qi">Qi</a>' these outputs
include the interior points.</p>
<p>For Delaunay triangulations (<a href=qdelaun.htm>qdelaunay</a>
or <a href=qvoronoi.htm>qvoronoi</a>), a coplanar point is a point
that is nearly incident to a vertex. All input points are either
vertices of the triangulation or coplanar.</p>
<p>Qhull stores coplanar points with a facet. While constructing
the hull, it retains all points within qh_RATIOnearInside
(user.h) of a facet. In qh_check_maxout(), it uses these points
to determine the outer plane for each facet. With option 'Qc',
qh_check_maxout() retains points above the minimum vertex for the
hull. Other points are removed. If qh_RATIOnearInside is wrong or
if options '<a href="#Q5">Q5</a> <a href="#Q8">Q8</a>' are set, a
coplanar point may be missed in the output (see <a
href="qh-impre.htm#limit">Qhull limitations</a>).</p>
<h3><a href="#qhull">&#187;</a><a name="Qf">Qf - partition point to
furthest outside facet </a></h3>
<p>After adding a new point to the convex hull, Qhull partitions
the outside points and coplanar points of the old, visible
facets. Without the '<a href="qh-opto.htm#f">f </a>' option and
merging, it assigns a point to the first facet that it is outside
('<a href="qh-optc.htm#Wn">Wn</a>'). When merging, it assigns a
point to the first facet that is more than several times outside
(see qh_DISToutside in user.h).</p>
<p>If option 'Qf' is selected, Qhull performs a directed search
(no merging) or an exhaustive search (merging) of new facets.
Option 'Qf' may reduce precision errors if pre-merging does not
occur.</p>
<p>Option '<a href="#Q9">Q9</a>' processes the furthest of all
furthest points.</p>
<h3><a href="#qhull">&#187;</a><a name="Qg">Qg - only build good
facets (needs 'QGn' 'QVn' or 'Pdk') </a></h3>
<p>Qhull has several options for defining and printing good
facets. With the '<a href="#Qg">Qg</a>' option, Qhull will only
build those facets that it needs to determine the good facets in
the output. This may speed up Qhull in 2-d and 3-d. It is
useful for furthest-site Delaunay
triangulations (<a href=qdelau_f.htm>qdelaunay Qu</a>,
invoke with 'qhull d Qbb <a href="#Qu">Qu</a> Qg').
It is not effective in higher
dimensions because many facets see a given point and contain a
given vertex. It is not guaranteed to work for all combinations.</p>
<p>See '<a href="#QGn">QGn</a>', '<a href="#QVn">QVn</a>', and '<a
href="qh-optp.htm#Pdk">Pdk</a>' for defining good facets, and '<a
href="qh-optp.htm#Pg">Pg</a>' and '<a href="qh-optp.htm#PG">PG</a>'
for printing good facets and their neighbors. If pre-merging ('<a
href="qh-optc.htm#Cn">C-n</a>') is not used and there are
coplanar facets, then 'Qg Pg' may produce a different result than
'<a href="qh-optp.htm#Pg">Pg</a>'. </p>
<h3><a href="#qhull">&#187;</a><a name="QGn">QGn - good facet if
visible from point n, -n for not visible </a></h3>
<p>With option 'QGn', a facet is good (see '<a href="#Qg">Qg</a>'
and '<a href="qh-optp.htm#Pg">Pg</a>') if it is visible from
point n. If <i>n &lt; 0</i>, a facet is good if it is not visible
from point n. Point n is not added to the hull (unless '<a
href="qh-optt.htm#TCn">TCn</a>' or '<a href="qh-optt.htm#TPn">TPn</a>').</p>
<p>With <a href="rbox.htm">rbox</a>, use the 'Pn,m,r' option
to define your point; it will be point 0 ('QG0'). </p>
<h3><a href="#qhull">&#187;</a><a name="Qi">Qi - keep interior points
with nearest facet </a></h3>
<p>Normally Qhull ignores points that are clearly interior to the
convex hull. With option 'Qi', Qhull treats interior points the
same as coplanar points. Option 'Qi' does not retain coplanar
points. You will probably want '<a href="#Qc">Qc </a>' as well. </p>
<p>Option 'Qi' is automatically set for '<a href=qdelaun.htm>qdelaunay</a>
<a href="#Qc">Qc</a>' and '<a href=qvoronoi.htm>qvoronoi</a>
<a href="#Qc">Qc</a>'. If you use
'<a href=qdelaun.htm>qdelaunay</a> Qi' or '<a href=qvoronoi.htm>qvoronoi</a>
Qi', option '<a href="qh-opto.htm#s">s</a>' reports all nearly
incident points while option '<a href="qh-optf.htm#Fs">Fs</a>'
reports the number of interior points (should always be zero).</p>
<p>With option 'Qi', output formats '<a href="qh-opto.htm#p">p</a>',
'<a href="qh-opto.htm#f">f</a>','<a href="qh-optg.htm#Gp">Gp</a>',
'<a href="qh-optf.htm#Fc">Fc</a>', '<a href="qh-optf.htm#FN">FN</a>',
and '<a href="qh-optf.htm#FP">FP</a>' include interior points. </p>
<h3><a href="#qhull">&#187;</a><a name="QJ">QJ</a> or <a name="QJn">QJn</a> - joggled
input to avoid precision errors</a></h3>
<p>Option 'QJ' or 'QJn' joggles each input coordinate by adding a
random number in the range [-n,n]. If a precision error occurs,
It tries again. If precision errors still occur, Qhull increases <i>n</i>
ten-fold and tries again. The maximum value for increasing <i>n</i>
is 0.01 times the maximum width of the input. Option 'QJ' selects
a default value for <i>n</i>. <a href="../src/user.h#JOGGLEdefault">User.h</a>
defines these parameters and a maximum number of retries. See <a
href="qh-impre.htm#joggle">Merged facets or joggled input</a>. </p>
<p>Users of joggled input should consider converting to
triangulated output ('<a href="../html/qh-optq.htm#Qt">Qt</a>'). Triangulated output is
approximately 1000 times more accurate than joggled input.
<p>Option 'QJ' also sets '<a href="qh-optq.htm#Qbb">Qbb</a>' for
Delaunay triangulations and Voronoi diagrams. It does not set
'Qbb' if '<a href="qh-optq.htm#Qbk">Qbk:n</a>' or '<a
href="qh-optq.htm#QBk">QBk:n</a>' are set. </p>
<p>If 'QJn' is set, Qhull does not merge facets unless requested
to. All facets are simplicial (triangular in 2-d). This may be
important for your application. You may also use triangulated output
('<a href="qh-optq.htm#Qt">Qt</a>') or Option '<a href="qh-optf.htm#Ft">Ft</a>'.
<p>Qhull adjusts the outer and inner planes for 'QJn' ('<a
href="qh-optf.htm#Fs">Fs</a>'). They are increased by <i>sqrt(d)*n</i>
to account for the maximum distance between a joggled point and
the corresponding input point. Coplanar points ('<a
href="qh-optq.htm#Qc">Qc</a>') require an additional <i>sqrt(d)*n</i>
since vertices and coplanar points may be joggled in opposite
directions. </p>
<p>For Delaunay triangulations (<a href=qdelaun.htm>qdelaunay</a>), joggle
happens before lifting the input sites to a paraboloid. Instead of
'QJ', you may use triangulated output ('<a
href="qh-optq.htm#Qt">Qt</a>')</p>
<p>This option is deprecated for Voronoi diagrams (<a href=qvoronoi.htm>qvoronoi</a>).
It triangulates cospherical points, leading to duplicated Voronoi vertices.</p>
<p>By default, 'QJn' uses a fixed random number seed. To use time
as the random number seed, select '<a href="qh-optq.htm#QRn">QR-1</a>'.
The summary ('<a href="qh-opto.htm#s">s</a>') will show the
selected seed as 'QR-n'.
<p>With 'QJn', Qhull does not error on degenerate hyperplane
computations. Except for Delaunay and Voronoi computations, Qhull
does not error on coplanar points. </p>
<p>Use option '<a href="qh-optf.htm#FO">FO</a>' to display the
selected options. Option 'FO' displays the joggle and the joggle
seed. If Qhull restarts, it will redisplay the options. </p>
<p>Use option '<a href="qh-optt.htm#TRn">TRn</a>' to estimate the
probability that Qhull will fail for a given 'QJn'.
<h3><a href="#qhull">&#187;</a><a name="Qm">Qm - only process points
that increase the maximum outer plane </a></h3>
<p>Qhull reports the maximum outer plane in its summary ('<a
href="qh-opto.htm#s">s</a>'). With option 'Qm', Qhull does not
process points that are below the current, maximum outer plane.
This is equivalent to always adjusting '<a href="qh-optc.htm#Wn">Wn
</a>' to the maximum distance of a coplanar point to a facet. It
is ignored for points above the upper convex hull of a Delaunay
triangulation. Option 'Qm' is no longer important for merging.</p>
<h3><a href="#qhull">&#187;</a><a name="Qr">Qr - process random
outside points instead of furthest ones </a></h3>
<p>Normally, Qhull processes the furthest point of a facet's
outside points. Option 'Qr' instead selects a random outside
point for processing. This makes Qhull equivalent to the
randomized incremental algorithms.</p>
<p>The original randomization algorithm by Clarkson and Shor [<a
href="index.htm#cla-sho89">'89</a>] used a conflict list which
is equivalent to Qhull's outside set. Later randomized algorithms
retained the previously constructed facets. </p>
<p>To compare Qhull to the randomized algorithms with option
'Qr', compare &quot;hyperplanes constructed&quot; and
&quot;distance tests&quot;. Qhull does not report CPU time
because the randomization is inefficient. </p>
<h3><a href="#qhull">&#187;</a><a name="QRn">QRn - random rotation </a></h3>
<p>Option 'QRn' randomly rotates the input. For Delaunay
triangulations (<a href=qdelaun.htm>qdelaunay</a> or <a href=qvoronoi.htm>qvoronoi</a>),
it rotates the lifted points about
the last axis. </p>
<p>If <em>n=0</em>, use time as the random number seed. If <em>n&gt;0</em>,
use n as the random number seed. If <em>n=-1</em>, don't rotate
but use time as the random number seed. If <em>n&lt;-1</em>,
don't rotate but use <em>n</em> as the random number seed. </p>
<h3><a href="#qhull">&#187;</a><a name="Qs">Qs - search all points
for the initial simplex </a></h3>
<p>Qhull constructs an initial simplex from <i>d+1</i> points. It
selects points with the maximum and minimum coordinates and
non-zero determinants. If this fails, it searches all other
points. In 8-d and higher, Qhull selects points with the minimum
x or maximum coordinate (see qh_initialvertices in <tt>poly2.c </tt>).
It rejects points with nearly zero determinants. This should work
for almost all input sets.</p>
<p>If Qhull can not construct an initial simplex, it reports a
descriptive message. Usually, the point set is degenerate and one
or more dimensions should be removed ('<a href="#Qb0">Qbk:0Bk:0</a>').
If not, use option 'Qs'. It performs an exhaustive search for the
best initial simplex. This is expensive is high dimensions. </p>
<h3><a href="#qhull">&#187;</a><a name="Qt">Qt - triangulated output</a></h3>
<p>By default, qhull merges facets to handle precision errors. This
produces non-simplicial facets (e.g., the convex hull of a cube has 6 square
facets). Each facet is non-simplicial because it has four vertices.
<p>Use option 'Qt' to triangulate all non-simplicial facets before generating
results. Alternatively, use joggled input ('<a href="#QJn">QJ</a>') to
prevent non-simplical facets. Unless '<a href="qh-optp.htm#Pp">Pp</a>' is set,
qhull produces a warning if 'QJ' and 'Qt' are used together.
<p>For Delaunay triangulations (<a href=qdelaun.htm>qdelaunay</a>), triangulation
occurs after lifting the input sites to a paraboloid and computing the convex hull.
</p>
<p>Option 'Qt' is deprecated for Voronoi diagrams (<a href=qvoronoi.htm>qvoronoi</a>).
It triangulates cospherical points, leading to duplicated Voronoi vertices.</p>
<p>Option 'Qt' may produce degenerate facets with zero area.</p>
<p>Facet area and hull volumes may differ with and without
'Qt'. The triangulations are different and different triangles
may be ignored due to precision errors.
<p>With sufficient merging, the ridges of a non-simplicial facet may share more than two neighboring facets. If so, their triangulation ('<a href="#Qt">Qt</a>') will fail since two facets have the same vertex set. </p>
<h3><a href="#qhull">&#187;</a><a name="Qu">Qu - compute upper hull
for furthest-site Delaunay triangulation </a></h3>
<p>When computing a Delaunay triangulation (<a href=qdelaun.htm>qdelaunay</a>
or <a href=qvoronoi.htm>qvoronoi</a>),
Qhull computes both the the convex hull of points on a
paraboloid. It normally prints facets of the lower hull. These
correspond to the Delaunay triangulation. With option 'Qu', Qhull
prints facets of the upper hull. These correspond to the <a
href="qdelau_f.htm">furthest-site Delaunay triangulation</a>
and the <a href="qvoron_f.htm">furthest-site Voronoi diagram</a>.</p>
<p>Option 'qhull d Qbb Qu <a href="#Qg">Qg</a>' may improve the speed of option
'Qu'. If you use the Qhull library, a faster method is 1) use
Qhull to compute the convex hull of the input sites; 2) take the
extreme points (vertices) of the convex hull; 3) add one interior
point (e.g.,
'<a href="qh-optf.htm#FV">FV</a>', the average of <em>d</em> extreme points); 4) run
'qhull d Qbb Qu' or 'qhull v Qbb Qu' on these points.</p>
<h3><a href="#qhull">&#187;</a><a name="Qv">Qv - test vertex
neighbors for convexity </a></h3>
<p>Normally, Qhull tests all facet neighbors for convexity.
Non-neighboring facets which share a vertex may not satisfy the
convexity constraint. This occurs when a facet undercuts the
centrum of another facet. They should still be convex. Option
'Qv' extends Qhull's convexity testing to all neighboring facets
of each vertex. The extra testing occurs after the hull is
constructed.. </p>
<h3><a href="#qhull">&#187;</a><a name="QVn">QVn - good facet if it
includes point n, -n if not </a></h3>
<p>With option 'QVn', a facet is good ('<a href="#Qg">Qg</a>',
'<a href="qh-optp.htm#Pg">Pg</a>') if one of its vertices is
point n. If <i>n&lt;0</i>, a good facet does not include point n.
<p>If options '<a href="qh-optp.htm#PG">PG</a>'
and '<a href="#Qg">Qg</a>' are not set, option '<a href="qh-optp.htm#Pg">Pg</a>'
(print only good)
is automatically set.
</p>
<p>Option 'QVn' behaves oddly with options '<a href="qh-optf.htm#Fx">Fx</a>'
and '<a href=qvoronoi.htm>qvoronoi</a> <a href="qh-optf.htm#Fv2">Fv</a>'.
<p>If used with option '<a href="#Qg">Qg</a>' (only process good facets), point n is
either in the initial simplex or it is the first
point added to the hull. Options 'QVn Qg' require either '<a href="#QJn">QJ</a>' or
'<a href="#Q0">Q0</a>' (no merging).</p>
<h3><a href="#qhull">&#187;</a><a name="Qx">Qx - exact pre-merges
(allows coplanar facets) </a></h3>
<p>Option 'Qx' performs exact merges while building the hull.
Option 'Qx' is set by default in 5-d and higher. Use option '<a
href="#Q0">Q0</a>' to not use 'Qx' by default. Unless otherwise
specified, option 'Qx' sets option '<a href="qh-optc.htm#C0">C-0</a>'.
</p>
<p>The &quot;exact&quot; merges are merging a point into a
coplanar facet (defined by '<a href="qh-optc.htm#Vn">Vn </a>', '<a
href="qh-optc.htm#Un">Un</a>', and '<a href="qh-optc.htm#Cn">C-n</a>'),
merging concave facets, merging duplicate ridges, and merging
flipped facets. Coplanar merges and angle coplanar merges ('<a
href="qh-optc.htm#An">A-n</a>') are not performed. Concavity
testing is delayed until a merge occurs.</p>
<p>After the hull is built, all coplanar merges are performed
(defined by '<a href="qh-optc.htm#Cn">C-n</a>' and '<a
href="qh-optc.htm#An">A-n</a>'), then post-merges are performed
(defined by '<a href="qh-optc.htm#Cn2">Cn</a>' and '<a
href="qh-optc.htm#An2">An</a>'). If facet progress is logged ('<a
href="qh-optt.htm#TFn">TFn</a>'), Qhull reports each phase and
prints intermediate summaries and statistics ('<a
href="qh-optt.htm#Ts">Ts</a>'). </p>
<p>Without 'Qx' in 5-d and higher, options '<a
href="qh-optc.htm#Cn">C-n</a>' and '<a href="qh-optc.htm#An">A-n</a>'
may merge too many facets. Since redundant vertices are not
removed effectively, facets become increasingly wide. </p>
<p>Option 'Qx' may report a wide facet. With 'Qx', coplanar
facets are not merged. This can produce a &quot;dent&quot; in an
intermediate hull. If a point is partitioned into a dent and it
is below the surrounding facets but above other facets, one or
more wide facets will occur. In practice, this is unlikely. To
observe this effect, run Qhull with option '<a href="#Q6">Q6</a>'
which doesn't pre-merge concave facets. A concave facet makes a
large dent in the intermediate hull.</p>
<p>Option 'Qx' may set an outer plane below one of the input
points. A coplanar point may be assigned to the wrong facet
because of a &quot;dent&quot; in an intermediate hull. After
constructing the hull, Qhull double checks all outer planes with
qh_check_maxout in <tt>poly2.c </tt>. If a coplanar point is
assigned to the wrong facet, qh_check_maxout may reach a local
maximum instead of locating all coplanar facets. This appears to
be unlikely.</p>
<h3><a href="#qhull">&#187;</a><a name="Qz">Qz - add a
point-at-infinity for Delaunay triangulations</a></h3>
<p>Option 'Qz' adds a point above the paraboloid of lifted sites
for a Delaunay triangulation. It allows the Delaunay
triangulation of cospherical sites. It reduces precision errors
for nearly cospherical sites.</p>
<h3><a href="#qhull">&#187;</a><a name="Q0">Q0 - no merging with C-0
and Qx</a></h3>
<p>Turn off default merge options '<a href="qh-optc.htm#C0">C-0</a>'
and '<a href="#Qx">Qx</a>'. </p>
<p>With 'Q0' and without other pre-merge options, Qhull ignores
precision issues while constructing the convex hull. This may
lead to precision errors. If so, a descriptive warning is
generated. See <a href="qh-impre.htm">Precision issues</a>.</p>
<h3><a href="#qhull">&#187;</a><a name="Q1">Q1 - sort merges by type
instead of angle </a></h3>
<p>Qhull sorts the coplanar facets before picking a subset of the
facets to merge. It merges concave and flipped facets first. Then
it merges facets that meet at a steep angle. With 'Q1', Qhull
sorts merges by type (coplanar, angle coplanar, concave) instead
of by angle. This may make the facets wider. </p>
<h3><a href="#qhull">&#187;</a><a name="Q2">Q2 - merge all non-convex
at once instead of independent sets </a></h3>
<p>With 'Q2', Qhull merges all facets at once instead of
performing merges in independent sets. This may make the facets
wider. </p>
<h3><a href="#qhull">&#187;</a><a name="Q3">Q3 - do not merge
redundant vertices </a></h3>
<p>With 'Q3', Qhull does not remove redundant vertices. In 6-d
and higher, Qhull never removes redundant vertices (since
vertices are highly interconnected). Option 'Q3' may be faster,
but it may result in wider facets. Its effect is easiest to see
in 3-d and 4-d.</p>
<h3><a href="#qhull">&#187;</a><a name="Q4">Q4 - avoid merging </a>old
facets into new facets</h3>
<p>With 'Q4', Qhull avoids merges of an old facet into a new
facet. This sometimes improves facet width and sometimes makes it
worse. </p>
<h3><a href="#qhull">&#187;</a><a name="Q5">Q5 - do not correct outer
planes at end of qhull </a></h3>
<p>When merging facets or approximating a hull, Qhull tests
coplanar points and outer planes after constructing the hull. It
does this by performing a directed search (qh_findbest in <tt>geom.c</tt>).
It includes points that are just inside the hull. </p>
<p>With options 'Q5' or '<a href="qh-optp.htm#Po">Po</a>', Qhull
does not test outer planes. The maximum outer plane is used
instead. Coplanar points ('<a href="#Qc">Qc</a>') are defined by
'<a href="qh-optc.htm#Un">Un</a>'. An input point may be outside
of the maximum outer plane (this appears to be unlikely). An
interior point may be above '<a href="qh-optc.htm#Un">Un</a>'
from a hyperplane.</p>
<p>Option 'Q5' may be used if outer planes are not needed. Outer
planes are needed for options '<a href="qh-opto.htm#s">s</a>', '<a
href="qh-optg.htm#G">G</a>', '<a href="qh-optg.htm#Go">Go </a>',
'<a href="qh-optf.htm#Fs">Fs</a>', '<a href="qh-optf.htm#Fo">Fo</a>',
'<a href="qh-optf.htm#FF">FF</a>', and '<a href="qh-opto.htm#f">f</a>'.</p>
<h3><a href="#qhull">&#187;</a><a name="Q6">Q6 - do not pre-merge
concave or coplanar facets </a></h3>
<p>With 'Q6', Qhull does not pre-merge concave or coplanar
facets. This demonstrates the effect of &quot;dents&quot; when
using '<a href="#Qx">Qx</a>'. </p>
<h3><a href="#qhull">&#187;</a><a name="Q7">Q7 - depth-first
processing instead of breadth-first </a></h3>
<p>With 'Q7', Qhull processes facets in depth-first order instead
of breadth-first order. This may increase the locality of
reference in low dimensions. If so, Qhull may be able to use
virtual memory effectively. </p>
<p>In 5-d and higher, many facets are visible from each
unprocessed point. So each iteration may access a large
proportion of allocated memory. This makes virtual memory
ineffectual. Once real memory is used up, Qhull will spend most
of its time waiting for I/O.</p>
<p>Under 'Q7', Qhull runs slower and the facets may be wider. </p>
<h3><a href="#qhull">&#187;</a><a name="Q8">Q8 - ignore near-interior
points </a></h3>
<p>With 'Q8' and merging, Qhull does not process interior points
that are near to a facet (as defined by qh_RATIOnearInside in
user.h). This avoids partitioning steps. It may miss a coplanar
point when adjusting outer hulls in qh_check_maxout(). The best
value for qh_RATIOnearInside is not known. Options 'Q8 <a
href="#Qc">Qc</a>' may be sufficient. </p>
<h3><a href="#qhull">&#187;</a><a name="Q9">Q9 - process furthest of
furthest points </a></h3>
<p>With 'Q9', Qhull processes the furthest point of all outside
sets. This may reduce precision problems. The furthest point of
all outside sets is not necessarily the furthest point from the
convex hull.</p>
<h3><a href="#qhull">&#187;</a><a name="Q10">Q10 - no special processing
for narrow distributions</a></h3>
<p>With 'Q10', Qhull does not special-case narrow distributions.
See <a href=qh-impre.htm#limit>Limitations of merged facets</a> for
more information.
<h3><a href="#qhull">&#187;</a><a name="Q11">Q11 - copy normals and recompute
centrums for
tricoplanar facets</a></h3>
Option '<a href="#Qt">Qt</a>' triangulates non-simplicial facets
into "tricoplanar" facets.
Normally tricoplanar facets share the same normal, centrum, and
Voronoi vertex. They can not be merged or replaced. With
option 'Q11', Qhull duplicates the normal and Voronoi vertex.
It recomputes the centrum.
<p>Use 'Q11' if you use the Qhull library to add points
incrementally and call qh_triangulate() after each point.
Otherwise, Qhull will report an error when it tries to
merge and replace a tricoplanar facet.
<p>With sufficient merging and new points, option 'Q11' may
lead to precision problems such
as duplicate ridges and concave facets. For example, if qh_triangulate()
is added to qh_addpoint(), RBOX 1000 s W1e-12 t1001813667 P0 | QHULL d Q11 Tv,
reports an error due to a duplicate ridge.
<h3><a href="#qhull">&#187;</a><a name="Q12">Q12 - do not error
on wide merge due to duplicate ridge and nearly coincident points</a></h3>
<p>In 3-d and higher Delaunay Triangulations or 4-d and higher convex hulls, multiple,
nearly coincident points may lead to very wide facets. An error is reported if a
merge across a duplicate ridge would increase the facet width by 100x or more.
<p>Use option 'Q12' to log a warning instead of throwing an error.
<p>For Delaunay triangulations, a bounding box may alleviate this error (e.g., <tt>rbox 500 C1,1E-13 t c G1 | qhull d</tt>).
This avoids the ill-defined edge between upper and lower convex hulls.
The problem will be fixed in a future release of Qhull.
<p>To demonstrate the problem, use rbox option 'Cn,r,m' to generate nearly coincident points.
For more information, see "Nearly coincident points on an edge"
in <a href="qh-impre.htm#limit"</a>Nearly coincident points on an edge</a>.
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,278 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Qhull trace options (T)</title>
</head>
<body>
<!-- Navigation links -->
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/delaunay.html"><img
src="qh--dt.gif" alt="[delaunay]" align="middle" width="100"
height="100"></a> Qhull trace options (T)</h1>
This section lists the trace options for Qhull. These options are
indicated by 'T' followed by a letter.
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="index.htm#TOC">&#187;</a> <a href="qh-quick.htm#programs">Programs</a>
<a name="trace">&#149;</a> <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<h2>Trace options</h2>
<dl compact>
<dt>&nbsp;</dt>
<dd><b>General</b></dd>
<dt><a href="#Tz">Tz</a></dt>
<dd>output error information to stdout instead of stderr</dd>
<dt><a href="#TI">TI file</a></dt>
<dd>input data from a file</dd>
<dt><a href="#TO">TO file</a></dt>
<dd>output results to a file</dd>
<dt><a href="#Ts">Ts</a></dt>
<dd>print statistics</dd>
<dt><a href="#TFn">TFn</a></dt>
<dd>report progress whenever n or more facets created</dd>
<dt><a href="#TRn">TRn</a></dt>
<dd>rerun qhull n times</dd>
<dt><a href="#Tv">Tv</a></dt>
<dd>verify result: structure, convexity, and point inclusion</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Debugging</b></dd>
<dt><a href="#Tc">Tc</a></dt>
<dd>check frequently during execution</dd>
<dt><a href="#TVn2">TVn</a></dt>
<dd>stop qhull after adding point n </dd>
<dt><a href="#TCn">TCn</a></dt>
<dd>stop qhull after building cone for point n</dd>
<dt><a href="#TVn">TV-n</a></dt>
<dd>stop qhull before adding point n</dd>
<dt><a href="#Tn">T4</a></dt>
<dd>trace at level n, 4=all, 5=mem/gauss, -1= events</dd>
<dt><a href="#TWn">TWn</a></dt>
<dd>trace merge facets when width &gt; n</dd>
<dt><a href="#TMn">TMn</a></dt>
<dd>turn on tracing at merge n</dd>
<dt><a href="#TPn">TPn</a></dt>
<dd>turn on tracing when point n added to hull</dd>
</dl>
<hr>
<h3><a href="#trace">&#187;</a><a name="Tc">Tc - check frequently
during execution </a></h3>
<p>Qhull includes frequent checks of its data structures. Option
'Tc' will catch most inconsistency errors. It is slow and should
not be used for production runs. Option '<a href="#Tv">Tv</a>'
performs the same checks after the hull is constructed.</p>
<h3><a href="#trace">&#187;</a><a name="TCn">TCn - stop qhull after
building cone for point n</a></h3>
<p>Qhull builds a cone from the point to its horizon facets.
Option 'TCn' stops Qhull just after building the cone. The output
for '<a href="qh-opto.htm#f">f</a>' includes the cone and the old
hull.'. </p>
<h3><a href="#trace">&#187;</a><a name="TFn">TFn - report summary
whenever n or more facets created </a></h3>
<p>Option 'TFn' reports progress whenever more than n facets are
created. The test occurs just before adding a new point to the
hull. During post-merging, 'TFn' reports progress after more than
<i>n/2</i> merges. </p>
<h3><a href="#trace">&#187;</a><a name="TI">TI file - input data from file</a></h3>
<p>Input data from 'file' instead of stdin. The filename may not
contain spaces or use single quotes.
You may use I/O redirection
instead (e.g., 'rbox 10 | qdelaunay >results').</P>
<h3><a href="#trace">&#187;</a><a name="TMn">TMn - turn on tracing at
merge n </a></h3>
<p>Turn on tracing at n'th merge. </p>
<h3><a href="#trace">&#187;</a><a name="Tn">Tn - trace at level n</a></h3>
<p>Qhull includes full execution tracing. 'T-1' traces events.
'T1' traces the overall execution of the program. 'T2' and 'T3'
trace overall execution and geometric and topological events.
'T4' traces the algorithm. 'T5' includes information about memory
allocation and Gaussian elimination. 'T1' is useful for logging
progress of Qhull in high dimensions.</p>
<p>Option 'Tn' can produce large amounts of output. Use options '<a
href="#TPn">TPn</a>', '<a href="#TWn">TWn</a>', and '<a href="#TMn">TMn</a>' to selectively
turn on tracing. Since all errors report the last processed
point, option '<a href="#TPn">TPn</a>' is particularly useful.</p>
<p>Different executions of the same program may produce different
traces and different results. The reason is that Qhull uses hashing
to match ridges of non-simplicial facets. For performance reasons,
the hash computation uses
memory addresses which may change across executions.
<h3><a href="#trace">&#187;</a><a name="TO">TO file - output results to file</a></h3>
<p>Redirect stdout to 'file'. The filename may be enclosed in
single quotes. Unix and Windows NT users may use I/O redirection
instead (e.g., 'rbox 10 | qdelaunay >results').</P>
<p>
Windows95 users should always use 'TO file'. If they use I/O redirection,
error output is not sent to the console. Qhull uses single quotes instead
of double quotes because a missing double quote can
freeze Windows95 (e.g., do not run, rbox 10 | qhull TO &quot;x)</p>
<p>
<h3><a href="#trace">&#187;</a><a name="TPn">TPn - turn on tracing
when point n added to hull </a></h3>
<p>Option 'TPn' turns on tracing when point n is added to
the hull. It also traces partitions of point n. This option
reduces the output size when tracing. It is the normal
method to determine the cause of a Qhull error. All Qhull errors
report the last point added.
<p>Use options 'TPn <a href="qh-optt.htm#TVn">TVn</a>' to
trace the addition of point n to the convex hull and stop when done.</p>
<p>If used with option '<a href="qh-optt.htm#TWn">TWn</a>',
'TPn' turns off tracing after adding point n to the hull.
Use options 'TPn TWn' to
trace the addition of point n to the convex hull, partitions
of point n, and wide merges.</p>
<h3><a href="#trace">&#187;</a><a name="TRn">TRn - rerun qhull n times</a></h3>
<p>Option 'TRn' reruns Qhull n times. It is usually used
with '<a href="qh-optq.htm#QJn">QJn</a>' to determine the probability
that a given joggle will fail. The summary
('<a href="qh-opto.htm#s">s</a>') lists the failure
rate and the precision errors that occurred.
Option '<a href="#Ts">Ts</a>' will report statistics for
all of the runs. Trace and output options only apply to the last
run. An event trace, '<a href="#Tn">T-1</a>' reports events for all runs.
<p>Tracing applies to the last run of Qhull. If an error
is reported, the options list the run number as "_run".
To trace this run, set 'TRn' to the same value.</p>
<h3><a href="#trace">&#187;</a><a name="Ts">Ts - print statistics </a></h3>
<p>Option 'Ts' collects statistics and prints them to stderr. For
Delaunay triangulations, the angle statistics are restricted to
the lower or upper envelope.</p>
<h3><a href="#trace">&#187;</a><a name="Tv">Tv - verify result:
structure, convexity, and point inclusion </a></h3>
<p>Option 'Tv' checks the topological structure, convexity, and
point inclusion. If precision problems occurred, facet convexity
is tested whether or not 'Tv' is selected. Option 'Tv' does not
check point inclusion if forcing output with '<a
href="qh-optp.htm#Po">Po</a>', or if '<a href="qh-optq.htm#Q5">Q5</a>'
is set. </p>
<p>The convex hull of a set of points is the smallest polytope
that includes the points. Option 'Tv' tests point inclusion.
Qhull verifies that all points are below all outer planes
(facet-&gt;maxoutside). Point inclusion is exhaustive if merging
or if the facet-point product is small enough; otherwise Qhull
verifies each point with a directed search (qh_findbest). To
force an exhaustive test when using option '<a
href="qh-optc.htm#C0">C-0</a>' (default), use 'C-1e-30' instead. </p>
<p>Point inclusion testing occurs after producing output. It
prints a message to stderr unless option '<a
href="qh-optp.htm#Pp">Pp</a>' is used. This allows the user to
interrupt Qhull without changing the output. </p>
<p>With '<a href=qvoronoi.htm>qvoronoi</a> <a href="qh-optf.htm#Fi2">Fi</a>'
and '<a href=qvoronoi.htm>qvoronoi</a> <a href="qh-optf.htm#Fo2">Fo</a>',
option 'Tv' collects statistics that verify all Voronoi vertices lie
on the separating hyperplane, and for bounded regions, all
separating hyperplanes are perpendicular bisectors.
<h3><a href="#trace">&#187;</a><a name="TVn">TV-n - stop qhull before
adding point n</a></h3>
<p>Qhull adds one point at a time to the convex hull. See <a
href="qh-eg.htm#how">how Qhull adds a point</a>. Option 'TV-n'
stops Qhull just before adding a new point. Output shows the hull
at this time.</p>
<h3><a href="#trace">&#187;</a><a name="TVn2">TVn - stop qhull after
adding point n</a></h3>
<p>Option 'TVn' stops Qhull after it has added point n. Output
shows the hull at this time.</p>
<h3><a href="#trace">&#187;</a><a name="TWn">TWn - trace merge facets
when width &gt; n </a></h3>
<p>Along with TMn, this option allows the user to determine the
cause of a wide merge.</p>
<h3><a href="#trace">&#187;</a><a name="Tz">Tz - send all output to
stdout </a></h3>
<p>Redirect stderr to stdout. </p>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,495 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Qhull quick reference</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOC"><b>Up:</b></a> <a href="http://www.qhull.org">Home
page for Qhull</a> <br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a> <br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="qh-code.htm#TOC">Qhull internals</a><br>
<b>To:</b> <a href="../src/libqhull/index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="../src/libqhull/index.htm#TOC">Qhull files</a><br>
<b>To:</b> <a href="../src/libqhull/qh-geom.htm">Geom</a> &#149; <a href="../src/libqhull/qh-globa.htm">Global</a>
&#149; <a href="../src/libqhull/qh-io.htm">Io</a> &#149; <a href="../src/libqhull/qh-mem.htm">Mem</a>
&#149; <a href="../src/libqhull/qh-merge.htm">Merge</a> &#149; <a href="../src/libqhull/qh-poly.htm">Poly</a>
&#149; <a href="../src/libqhull/qh-qhull.htm">Qhull</a> &#149; <a href="../src/libqhull/qh-set.htm">Set</a>
&#149; <a href="../src/libqhull/qh-stat.htm">Stat</a> &#149; <a href="../src/libqhull/qh-user.htm">User</a>
</p>
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/cone.html"><img
src="qh--cone.gif" alt="[cone]" align="middle" width="100"
height="100"></a> Qhull quick reference</h1>
This section lists all programs and options in Qhull.
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<p>
<a name="programs">&nbsp;</a>
<hr>
<b>Qhull programs</b>
<p><a href="#TOC">&#187;</a> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<dl>
<dt><a href="qconvex.htm">qconvex</a> -- convex hull</dt>
<dd><a href="qconvex.htm#synopsis">sy</a>nopsis &#149; <a
href="qconvex.htm#input">in</a>put &#149; <a
href="qconvex.htm#outputs">ou</a>tputs &#149; <a
href="qconvex.htm#controls">co</a>ntrols &#149; <a
href="qconvex.htm#graphics">gr</a>aphics &#149; <a
href="qconvex.htm#notes">no</a>tes &#149; <a
href="qconvex.htm#conventions">co</a>nventions &#149; <a
href="qconvex.htm#options">op</a>tions</dd>
<dt>&nbsp;</dt>
<dt><a href="qdelaun.htm">qdelaunay</a> -- Delaunay triangulation</dt>
<dd><a href="qdelaun.htm#synopsis">sy</a>nopsis &#149; <a
href="qdelaun.htm#input">in</a>put &#149; <a
href="qdelaun.htm#outputs">ou</a>tputs &#149; <a
href="qdelaun.htm#controls">co</a>ntrols &#149; <a
href="qdelaun.htm#graphics">gr</a>aphics &#149; <a
href="qdelaun.htm#notes">no</a>tes &#149; <a
href="qdelaun.htm#conventions">co</a>nventions &#149; <a
href="qdelaun.htm#options">op</a>tions</dd>
<dt>&nbsp;</dt>
<dt><a href="qdelau_f.htm">qdelaunay Qu</a> -- furthest-site Delaunay triangulation</dt>
<dd><a href="qdelau_f.htm#synopsis">sy</a>nopsis &#149; <a
href="qdelau_f.htm#input">in</a>put &#149; <a
href="qdelau_f.htm#outputs">ou</a>tputs &#149; <a
href="qdelau_f.htm#controls">co</a>ntrols &#149; <a
href="qdelau_f.htm#graphics">gr</a>aphics &#149; <a
href="qdelau_f.htm#notes">no</a>tes &#149; <a
href="qdelau_f.htm#conventions">co</a>nventions &#149; <a
href="qdelau_f.htm#options">op</a>tions</dd>
<dt>&nbsp;</dt>
<dt><a href="qhalf.htm">qhalf</a> -- halfspace intersection about a point</dt>
<dd><a href="qhalf.htm#synopsis">sy</a>nopsis &#149; <a
href="qhalf.htm#input">in</a>put &#149; <a
href="qhalf.htm#outputs">ou</a>tputs &#149; <a
href="qhalf.htm#controls">co</a>ntrols &#149; <a
href="qhalf.htm#graphics">gr</a>aphics &#149; <a
href="qhalf.htm#notes">no</a>tes &#149; <a
href="qhalf.htm#conventions">co</a>nventions &#149; <a
href="qhalf.htm#options">op</a>tions</dd>
<dt>&nbsp;</dt>
<dt><a href="qvoronoi.htm">qvoronoi</a> -- Voronoi diagram</dt>
<dd><a href="qvoronoi.htm#synopsis">sy</a>nopsis &#149; <a
href="qvoronoi.htm#input">in</a>put &#149; <a
href="qvoronoi.htm#outputs">ou</a>tputs &#149;
<a href="qvoronoi.htm#controls">co</a>ntrols &#149; <a
href="qvoronoi.htm#graphics">gr</a>aphics &#149; <a
href="qvoronoi.htm#notes">no</a>tes &#149; <a
href="qvoronoi.htm#conventions">co</a>nventions &#149; <a
href="qvoronoi.htm#options">op</a>tions</dd>
<dt>&nbsp;</dt>
<dt><a href="qvoron_f.htm">qvoronoi Qu</a> -- furthest-site Voronoi diagram</dt>
<dd><a href="qvoron_f.htm#synopsis">sy</a>nopsis &#149; <a
href="qvoron_f.htm#input">in</a>put &#149; <a
href="qvoron_f.htm#outputs">ou</a>tputs &#149; <a
href="qvoron_f.htm#controls">co</a>ntrols &#149; <a
href="qvoron_f.htm#graphics">gr</a>aphics &#149; <a
href="qvoron_f.htm#notes">no</a>tes &#149; <a
href="qvoron_f.htm#conventions">co</a>nventions &#149; <a
href="qvoron_f.htm#options">op</a>tions</dd>
<dt>&nbsp;</dt>
<dt><a href="rbox.htm">rbox</a> -- generate point distributions for qhull</dt>
<dd><a href="rbox.htm#synopsis">sy</a>nopsis &#149; <a
href="rbox.htm#outputs">ou</a>tputs &#149; <a
href="rbox.htm#examples">ex</a>amples &#149; <a
href="rbox.htm#notes">no</a>tes &#149; <a
href="rbox.htm#options">op</a>tions</dd>
<dt>&nbsp;</dt>
<dt><a href="qhull.htm">qhull</a> -- convex hull and related structures</dt>
<dd><a href="qhull.htm#synopsis">sy</a>nopsis &#149; <a
href="qhull.htm#input">in</a>put &#149; <a
href="qhull.htm#outputs">ou</a>tputs &#149; <a
href="qhull.htm#controls">co</a>ntrols &#149; <a
href="qhull.htm#options">op</a>tions</dd>
</dl>
<a name="options">&nbsp;</a>
<hr>
<b>Qhull options</b>
<p><a href="#TOC">&#187;</a> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a></p>
<p><table>
<!-- Note: keep all lines the same for easy reorganization -->
<tr>
<td><nobr>'<a href=qh-optf.htm#Fa>Fa</a>'
Farea
</nobr></td><td><nobr>'<a href=qh-optf.htm#Fa>FA</a>'
FArea-total
</nobr></td><td><nobr>'<a href=qh-optf.htm#Fc>Fc</a>'
Fcoplanars
</nobr></td><td><nobr>'<a href=qh-optf.htm#FC>FC</a>'
FCentrums
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optf.htm#Fd>Fd</a>'
Fd-cdd-in
</nobr></td><td><nobr>'<a href=qh-optf.htm#FD>FD</a>'
FD-cdd-out
</nobr></td><td><nobr>'<a href=qh-optf.htm#FF>FF</a>'
FF-dump-xridge
</nobr></td><td><nobr>'<a href=qh-optf.htm#Fi>Fi</a>'
Finner
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optf.htm#Fi2>Fi</a>'
Finner_bounded
</nobr></td><td><nobr>'<a href=qh-optf.htm#FI>FI</a>'
FIDs
</nobr></td><td><nobr>'<a href=qh-optf.htm#Fm>Fm</a>'
Fmerges
</nobr></td><td><nobr>'<a href=qh-optf.htm#FM>FM</a>'
FMaple
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optf.htm#Fn>Fn</a>'
Fneighbors
</nobr></td><td><nobr>'<a href=qh-optf.htm#FN>FN</a>'
FNeigh-vertex
</nobr></td><td><nobr>'<a href=qh-optf.htm#Fo>Fo</a>'
Fouter
</nobr></td><td><nobr>'<a href=qh-optf.htm#Fo2>Fo</a>'
Fouter_unbounded
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optf.htm#FO>FO</a>'
FOptions
</nobr></td><td><nobr>'<a href=qh-optf.htm#Fp>Fp</a>'
Fpoint-intersect
</nobr></td><td><nobr>'<a href=qh-optf.htm#FP>FP</a>'
FPoint_near
</nobr></td><td><nobr>'<a href=qh-optf.htm#FQ>FQ</a>'
FQhull
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optf.htm#Fs>Fs</a>'
Fsummary
</nobr></td><td><nobr>'<a href=qh-optf.htm#FS>FS</a>'
FSize
</nobr></td><td><nobr>'<a href=qh-optf.htm#Ft>Ft</a>'
Ftriangles
</nobr></td><td><nobr>'<a href=qh-optf.htm#Fv>Fv</a>'
Fvertices
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optf.htm#Fv2>Fv</a>'
Fvoronoi
</nobr></td><td><nobr>'<a href=qh-optf.htm#FV>FV</a>'
FVertex-ave
</nobr></td><td><nobr>'<a href=qh-optf.htm#Fx>Fx</a>'
Fxtremes
</nobr></td><td colspan=2><nobr>
<a href=qh-impre.htm#joggle>Merged facets or joggled input</a>
</nobr></td></tr>
<tr><td>&nbsp;</td></tr><tr>
<td><nobr>'<a href=qh-optp.htm#PAn>PAn</a>'
PArea-keep
</nobr></td><td><nobr>'<a href=qh-optp.htm#Pdk>Pdk:n</a>'
Pdrop_low
</nobr></td><td><nobr>'<a href=qh-optp.htm#PDk>PDk:n</a>'
Pdrop_high
</nobr></td><td><nobr>'<a href=qh-optp.htm#Pg>Pg</a>'
Pgood
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optp.htm#PFn>PFn</a>'
PFacet_area_keep
</nobr></td><td><nobr>'<a href=qh-optp.htm#PG>PG</a>'
PGood_neighbors
</nobr></td><td><nobr>'<a href=qh-optp.htm#PMn>PMn</a>'
PMerge-keep
</nobr></td><td><nobr>'<a href=qh-optp.htm#Po>Po</a>'
Poutput_forced
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optp.htm#Po2>Po</a>'
Poutput_error
</nobr></td><td><nobr>'<a href=qh-optp.htm#Pp>Pp</a>'
Pprecision_not
</nobr></td></tr>
<tr><td>&nbsp;</td></tr><tr>
<td><nobr>'<a href=qhull.htm#outputs>d</a>'
delaunay
</nobr></td><td><nobr>'<a href=qhull.htm#outputs>v</a>'
voronoi
</nobr></td><td><nobr>'<a href=qh-optg.htm>G</a>'
Geomview
</nobr></td><td><nobr>'<a href=qhull.htm#outputs>H</a>'
Halfspace
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-opto.htm#f>f</a>'
facet_dump
</nobr></td><td><nobr>'<a href=qh-opto.htm#i>i</a>'
incidences
</nobr></td><td><nobr>'<a href=qh-opto.htm#m>m</a>'
mathematica
</nobr></td><td><nobr>'<a href=qh-opto.htm#n>n</a>'
normals
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-opto.htm#o>o</a>'
OFF_format
</nobr></td><td><nobr>'<a href=qh-opto.htm#p>p</a>'
points
</nobr></td><td><nobr>'<a href=qh-opto.htm#s>s</a>'
summary
</nobr></td></tr>
<tr><td>&nbsp;</td></tr><tr>
<td><nobr>'<a href=qh-optg.htm#Gv>Gv</a>'
Gvertices
</nobr></td><td><nobr>'<a href=qh-optg.htm#Gp>Gp</a>'
Gpoints
</nobr></td><td><nobr>'<a href=qh-optg.htm#Ga>Ga</a>'
Gall_points
</nobr></td><td><nobr>'<a href=qh-optg.htm#Gn>Gn</a>'
Gno_planes
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optg.htm#Gi>Gi</a>'
Ginner
</nobr></td><td><nobr>'<a href=qh-optg.htm#Gc>Gc</a>'
Gcentrums
</nobr></td><td><nobr>'<a href=qh-optg.htm#Gh>Gh</a>'
Ghyperplanes
</nobr></td><td><nobr>'<a href=qh-optg.htm#Gr>Gr</a>'
Gridges
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optg.htm#Go>Go</a>'
Gouter
</nobr></td><td><nobr>'<a href=qh-optg.htm#GDn>GDn</a>'
GDrop_dim
</nobr></td><td><nobr>'<a href=qh-optg.htm#Gt>Gt</a>'
Gtransparent
</nobr></td></tr>
<tr><td>&nbsp;</td></tr><tr>
<td><nobr>'<a href=qh-optt.htm#Tn>T4</a>'
T4_trace
</nobr></td><td><nobr>'<a href=qh-optt.htm#Tc>Tc</a>'
Tcheck_often
</nobr></td><td><nobr>'<a href=qh-optt.htm#Ts>Ts</a>'
Tstatistics
</nobr></td><td><nobr>'<a href=qh-optt.htm#Tv>Tv</a>'
Tverify
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optt.htm#Tz>Tz</a>'
Tz_stdout
</nobr></td><td><nobr>'<a href=qh-optt.htm#TFn>TFn</a>'
TFacet_log
<td><nobr>'<a href=qh-optt.htm#TI>TI file</a>'
TInput_file
</nobr></td><td><nobr>'<a href=qh-optt.htm#TPn>TPn</a>'
TPoint_trace
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optt.htm#TMn>TMn</a>'
TMerge_trace
</nobr></td><td><nobr>'<a href=qh-optt.htm#TO>TO file</a>'
TOutput_file
</nobr></td><td><nobr>'<a href=qh-optt.htm#TRn>TRn</a>'
TRerun
</nobr></td><td><nobr>'<a href=qh-optt.htm#TWn>TWn</a>'
TWide_trace
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optt.htm#TVn>TV-n</a>'
TVertex_stop_before
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optt.htm#TVn2>TVn</a>'
TVertex_stop_after
</nobr></td><td><nobr>'<a href=qh-optt.htm#TCn>TCn</a>'
TCone_stop_after
</nobr></td></tr>
<tr><td>&nbsp;</td></tr><tr>
<td><nobr>'<a href=qh-optc.htm#An>A-n</a>'
Angle_max_pre
</nobr></td><td><nobr>'<a href=qh-optc.htm#An2>An</a>'
Angle_max_post
</nobr></td><td><nobr>'<a href=qh-optc.htm#C0>C-0</a>'
Centrum_roundoff
</nobr></td><td><nobr>'<a href=qh-optc.htm#Cn>C-n</a>'
Centrum_size_pre
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optc.htm#Cn2>Cn</a>'
Centrum_size_post
</nobr></td><td><nobr>'<a href=qh-optc.htm#En>En</a>'
Error_round
</nobr></td><td><nobr>'<a href=qh-optc.htm#Rn>Rn</a>'
Random_dist
</nobr></td><td><nobr>'<a href=qh-optc.htm#Vn>Vn</a>'
Visible_min
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optc.htm#Un>Un</a>'
Ucoplanar_max
</nobr></td><td><nobr>'<a href=qh-optc.htm#Wn>Wn</a>'
Wide_outside
</nobr></td></tr>
<tr><td>&nbsp;</td></tr><tr>
<td><nobr>'<a href=qh-optq.htm#Qbk>Qbk:n</a>'
Qbound_low
</nobr></td><td><nobr>'<a href=qh-optq.htm#QBk>QBk:n</a>'
QBound_high
</nobr></td><td><nobr>'<a href=qh-optq.htm#Qb0>Qbk:0Bk:0</a>'
Qbound_drop
</nobr></td><td><nobr>'<a href=qh-optq.htm#QbB>QbB</a>'
QbB-scale-box
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optq.htm#Qbb>Qbb</a>'
Qbb-scale-last
</nobr></td><td><nobr>'<a href=qh-optq.htm#Qc>Qc</a>'
Qcoplanar
</nobr></td><td><nobr>'<a href=qh-optq.htm#Qf>Qf</a>'
Qfurthest
</nobr></td><td><nobr>'<a href=qh-optq.htm#Qg>Qg</a>'
Qgood_only
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optq.htm#QGn>QGn</a>'
QGood_point
</nobr></td><td><nobr>'<a href=qh-optq.htm#Qi>Qi</a>'
Qinterior
</nobr></td><td><nobr>'<a href=qh-optq.htm#Qm>Qm</a>'
Qmax_out
</nobr></td><td><nobr>'<a href=qh-optq.htm#QJn>QJn</a>'
QJoggle
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optq.htm#Qr>Qr</a>'
Qrandom
</nobr></td><td><nobr>'<a href=qh-optq.htm#QRn>QRn</a>'
QRotate
</nobr></td><td><nobr>'<a href=qh-optq.htm#Qs>Qs</a>'
Qsearch_1st
</nobr></td><td><nobr>'<a href=qh-optq.htm#Qt>Qt</a>'
Qtriangulate
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optq.htm#Qu>Qu</a>'
QupperDelaunay
</nobr><td><nobr>'<a href=qh-optq.htm#QVn>QVn</a>'
QVertex_good
</nobr></td><td><nobr>'<a href=qh-optq.htm#Qv>Qv</a>'
Qvneighbors
</nobr></td><td><nobr>'<a href=qh-optq.htm#Qx>Qx</a>'
Qxact_merge
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optq.htm#Qz>Qz</a>'
Qzinfinite
</nobr></td></tr>
<tr><td>&nbsp;</td></tr><tr>
<td><nobr>'<a href=qh-optq.htm#Q0>Q0</a>'
Q0_no_premerge
</nobr></td><td><nobr>'<a href=qh-optq.htm#Q1>Q1</a>'
Q1_no_angle
</nobr></td><td><nobr>'<a href=qh-optq.htm#Q2>Q2</a>'
Q2_no_independ
</nobr></td><td><nobr>'<a href=qh-optq.htm#Q3>Q3</a>'
Q3_no_redundant
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optq.htm#Q4>Q4</a>'
Q4_no_old
</nobr></td><td><nobr>'<a href=qh-optq.htm#Q5>Q5</a>'
Q5_no_check_out
</nobr></td><td><nobr>'<a href=qh-optq.htm#Q6>Q6</a>'
Q6_no_concave
</nobr></td><td><nobr>'<a href=qh-optq.htm#Q7>Q7</a>'
Q7_depth_first
</nobr></td></tr><tr>
<td><nobr>'<a href=qh-optq.htm#Q8>Q8</a>'
Q8_no_near_in
</nobr></td><td><nobr>'<a href=qh-optq.htm#Q9>Q9</a>'
Q9_pick_furthest
</nobr></td><td><nobr>'<a href=qh-optq.htm#Q10>Q10</a>'
Q10_no_narrow
</nobr></td><td><nobr>'<a href=qh-optq.htm#Q11>Q11</a>'
Q11_trinormals
</td></tr></table>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home
page for Qhull</a> <br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a> <br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="qh-code.htm#TOC">Qhull internals</a><br>
<b>To:</b> <a href="../src/libqhull/index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="../src/libqhull/index.htm#TOC">Qhull files</a><br>
<b>To:</b> <a href="../src/libqhull/qh-geom.htm">Geom</a> &#149; <a href="../src/libqhull/qh-globa.htm">Global</a>
&#149; <a href="../src/libqhull/qh-io.htm">Io</a> &#149; <a href="../src/libqhull/qh-mem.htm">Mem</a>
&#149; <a href="../src/libqhull/qh-merge.htm">Merge</a> &#149; <a href="../src/libqhull/qh-poly.htm">Poly</a>
&#149; <a href="../src/libqhull/qh-qhull.htm">Qhull</a> &#149; <a href="../src/libqhull/qh-set.htm">Set</a>
&#149; <a href="../src/libqhull/qh-stat.htm">Stat</a> &#149; <a href="../src/libqhull/qh-user.htm">User</a><br>
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

626
xs/src/qhull/html/qhalf.htm Normal file
View File

@ -0,0 +1,626 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>qhalf -- halfspace intersection about a point</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up</b></a><b>:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis
&#149; <a href="#input">in</a>put &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#controls">co</a>ntrols &#149; <a href="#graphics">gr</a>aphics
&#149; <a href="#notes">no</a>tes &#149; <a href="#conventions">co</a>nventions
&#149; <a href="#options">op</a>tions
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/half.html"><img
src="qh--half.gif" alt="[halfspace]" align="middle" width="100"
height="100"></a>qhalf -- halfspace intersection about a point</h1>
<p>The intersection of a set of halfspaces is a polytope. The
polytope may be unbounded. See Preparata &amp; Shamos [<a
href="index.htm#pre-sha85">'85</a>] for a discussion. In low
dimensions, halfspace intersection may be used for linear
programming.
<blockquote>
<dl compact>
<dt><p><b>Example:</b> rbox c | qconvex <a href="qh-optf.htm#FQ">FQ</a> <a href="qh-optf.htm#FV">FV</a>
<a href="qh-opto.htm#n">n</a> | qhalf <a
href="qh-optf.htm#Fp">Fp</a></dt>
<dd>Print the intersection of the facets of a cube. <tt>rbox c</tt>
generates the vertices of a cube. <tt>qconvex FV n</tt> returns of average
of the cube's vertices (in this case, the origin) and the halfspaces
that define the cube. <tt>qhalf Fp</tt> computes the intersection of
the halfspaces about the origin. The intersection is the vertices
of the original cube.</dd>
<dt><p><b>Example:</b> rbox c d G0.55 | qconvex <a href="qh-optf.htm#FQ">FQ</a> <a href="qh-optf.htm#FV">FV</a>
<a href="qh-opto.htm#n">n</a> | qhalf <a
href="qh-optf.htm#Fp">Fp</a></dt>
<dd>Print the intersection of the facets of a cube and a diamond. There
are 24 facets and 14 intersection points. Four facets define each diamond
vertex. Six facets define each cube vertex.
</dd>
<dt><p><b>Example:</b> rbox c d G0.55 | qconvex <a href="qh-optf.htm#FQ">FQ</a> <a href="qh-optf.htm#FV">FV</a>
<a href="qh-opto.htm#n">n</a> | qhalf <a
href="qh-optf.htm#Fp">Fp</a>
<a href="qh-optq.htm#Qt">Qt</a></dt>
<dd>Same as above except triangulate before computing
the intersection points. Three facets define each intersection
point. There are two duplicates of the diamond and four duplicates of the cube.
</dd>
<dt><p><b>Example:</b> rbox 10 s t10 | qconvex <a href="qh-optf.htm#FQ">FQ</a> <a href="qh-optf.htm#FV">FV</a>
<a href="qh-opto.htm#n">n</a> | qhalf <a
href="qh-optf.htm#Fp">Fp</a> <a
href="qh-optf.htm#Fn">Fn</a></dt>
<dd>Print the intersection of the facets of the convex hull of 10 cospherical points.
Include the intersection points and the neighboring intersections.
As in the previous examples, the intersection points are nearly the same as the
original input points.
</dd>
</dl>
</blockquote>
<p>In Qhull, a <i>halfspace</i> is defined by the points on or below a hyperplane.
The distance of each point to the hyperplane is less than or equal to zero.
<p>Qhull computes a halfspace intersection by the geometric
duality between points and halfspaces.
See <a href="qh-eg.htm#half">halfspace examples</a>,
<a href="#notes">qhalf notes</a>, and
option 'p' of <a href="#outputs">qhalf outputs</a>. </p>
<p>Qhalf's <a href="#outputs">outputs</a> are the intersection
points (<a href="qh-optf.htm#Fp">Fp</a>) and
the neighboring intersection points (<a href="qh-optf.htm#Fn">Fn</a>).
For random inputs, halfspace
intersections are usually defined by more than <i>d</i> halfspaces. See the sphere example.
<p>You can try triangulated output ('<a href="qh-optq.htm#Qt">Qt</a>') and joggled input ('<a href="qh-optq.htm#QJn">QJ</a>').
It demonstrates that triangulated output is more accurate than joggled input.
<p>If you use '<a href="qh-optq.htm#Qt">Qt</a>' (triangulated output), all
halfspace intersections are simplicial (e.g., three halfspaces per
intersection in 3-d). In 3-d, if more than three halfspaces intersect
at the same point, triangulated output will produce
duplicate intersections, one for each additional halfspace. See the third example, or
add 'Qt' to the sphere example.</p>
<p>If you use '<a href="qh-optq.htm#QJn">QJ</a>' (joggled input), all halfspace
intersections are simplicial. This may lead to nearly identical
intersections. For example, either replace 'Qt' with 'QJ' above, or add
'QJ' to the sphere example.
See <a
href="qh-impre.htm#joggle">Merged facets or joggled input</a>. </p>
<p>The 'qhalf' program is equivalent to
'<a href=qhull.htm#outputs>qhull H</a>' in 2-d to 4-d, and
'<a href=qhull.htm#outputs>qhull H</a> <a href=qh-optq.htm#Qx>Qx</a>'
in 5-d and higher. It disables the following Qhull
<a href=qh-quick.htm#options>options</a>: <i>d n v Qbb QbB Qf Qg Qm
Qr QR Qv Qx Qz TR E V Fa FA FC FD FS Ft FV Gt Q0,etc</i>.
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<h3><a href="#TOP">&#187;</a><a name="synopsis">qhalf synopsis</a></h3>
<pre>
qhalf- halfspace intersection about a point.
input (stdin): [dim, 1, interior point]
dim+1, n
halfspace coefficients + offset
comments start with a non-numeric character
options (qhalf.htm):
Hn,n - specify coordinates of interior point
Qt - triangulated output
QJ - joggle input instead of merging facets
Tv - verify result: structure, convexity, and redundancy
. - concise list of all options
- - one-line description of all options
output options (subset):
s - summary of results (default)
Fp - intersection coordinates
Fv - non-redundant halfspaces incident to each intersection
Fx - non-redundant halfspaces
o - OFF file format (dual convex hull)
G - Geomview output (dual convex hull)
m - Mathematica output (dual convex hull)
QVn - print intersections for halfspace n, -n if not
TO file - output results to file, may be enclosed in single quotes
examples:
rbox d | qconvex n | qhalf s H0,0,0 Fp
rbox c | qconvex FV n | qhalf s i
rbox c | qconvex FV n | qhalf s o
</pre>
<h3><a href="#TOP">&#187;</a><a name="input">qhalf input</a></h3>
<blockquote>
<p>The input data on <tt>stdin</tt> consists of:</p>
<ul>
<li>[optional] interior point
<ul>
<li>dimension
<li>1
<li>coordinates of interior point
</ul>
<li>dimension + 1
<li>number of halfspaces</li>
<li>halfspace coefficients followed by offset</li>
</ul>
<p>Use I/O redirection (e.g., qhalf &lt; data.txt), a pipe (e.g., rbox c | qconvex FV n | qhalf),
or the '<a href=qh-optt.htm#TI>TI</a>' option (e.g., qhalf TI data.txt).
<p>Qhull needs an interior point to compute the halfspace
intersection. An interior point is clearly inside all of the halfspaces.
A point is <i>inside</i> a halfspace if its distance to the corresponding hyperplane is negative.
<p>The interior point may be listed at the beginning of the input (as shown above).
If not, option
'Hn,n' defines the interior point as
[n,n,0,...] where <em>0</em> is the default coordinate (e.g.,
'H0' is the origin). Use linear programming if you do not know
the interior point (see <a href="#notes">halfspace notes</a>),</p>
<p>The input to qhalf is a set of halfspaces that are defined by their hyperplanes.
Each halfspace is defined by
<em>d</em> coefficients followed by a signed offset. This defines
a linear inequality. The coefficients define a vector that is
normal to the halfspace.
The vector may have any length. If it
has length one, the offset is the distance from the origin to the
halfspace's boundary. Points in the halfspace have a negative distance to the hyperplane.
The distance from the interior point to each
halfspace is likewise negative.</p>
<p>The halfspace format is the same as Qhull's output options '<a
href="qh-opto.htm#n">n</a>', '<a href="qh-optf.htm#Fo">Fo</a>',
and '<a href="qh-optf.htm#Fi">Fi</a>'. Use option '<a
href="qh-optf.htm#Fd">Fd</a>' to use cdd format for the
halfspaces.</p>
<p>For example, here is the input for computing the intersection
of halfplanes that form a cube.</p>
<blockquote>
<p>rbox c | qconvex FQ FV n TO data </p>
<pre>
RBOX c | QCONVEX FQ FV n
3 1
0 0 0
4
6
0 0 -1 -0.5
0 -1 0 -0.5
1 0 0 -0.5
-1 0 0 -0.5
0 1 0 -0.5
0 0 1 -0.5
</pre>
<p>qhalf s Fp &lt; data </p>
<pre>
Halfspace intersection by the convex hull of 6 points in 3-d:
Number of halfspaces: 6
Number of non-redundant halfspaces: 6
Number of intersection points: 8
Statistics for: RBOX c | QCONVEX FQ FV n | QHALF s Fp
Number of points processed: 6
Number of hyperplanes created: 11
Number of distance tests for qhull: 11
Number of merged facets: 1
Number of distance tests for merging: 45
CPU seconds to compute hull (after input): 0
3
3
8
-0.5 0.5 0.5
0.5 0.5 0.5
-0.5 0.5 -0.5
0.5 0.5 -0.5
0.5 -0.5 0.5
-0.5 -0.5 0.5
-0.5 -0.5 -0.5
0.5 -0.5 -0.5
</pre>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="outputs">qhalf outputs</a></h3>
<blockquote>
<p>The following options control the output for halfspace
intersection.</p>
<blockquote>
<dl compact>
<dt>&nbsp;</dt>
<dd><b>Intersections</b></dd>
<dt><a href="qh-optf.htm#FN">FN</a></dt>
<dd>list intersection points for each non-redundant
halfspace. The first line
is the number of non-redundant halfspaces. Each remaining
lines starts with the number of intersection points. For the cube
example, each halfspace has four intersection points.</dd>
<dt><a href="qh-optf.htm#Fn">Fn</a></dt>
<dd>list neighboring intersections for each intersection point. The first line
is the number of intersection points. Each remaining line
starts with the number of neighboring intersections. For the cube
example, each intersection point has three neighboring intersections.
<p>
In 3-d, a non-simplicial intersection has more than three neighboring
intersections. For random data (e.g., the sphere example), non-simplicial intersections are the norm.
Option '<a href="qh-optq.htm#Qt">Qt</a>' produces three
neighboring intersections per intersection by duplicating the intersection
points. Option <a href="qh-optq.htm#QJn">QJ</a>' produces three
neighboring intersections per intersection by joggling the hyperplanes and
hence their intersections.
</dd>
<dt><a href="qh-optf.htm#Fp">Fp</a></dt>
<dd>print intersection coordinates. The first line is the dimension and the
second line is the number of intersection points. The following lines are the
coordinates of each intersection.</dd>
<dt><a href="qh-optf.htm#FI">FI</a></dt>
<dd>list intersection IDs. The first line is the number of
intersections. The IDs follow, one per line.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Halfspaces</b></dd>
<dt><a href="qh-optf.htm#Fx">Fx</a></dt>
<dd>list non-redundant halfspaces. The first line is the number of
non-redundant halfspaces. The other lines list one halfspace per line.
A halfspace is <i>non-redundant</i> if it
defines a facet of the intersection. Redundant halfspaces are ignored. For
the cube example, all of the halfspaces are non-redundant.
</dd>
<dt><a href="qh-optf.htm#Fv">Fv</a></dt>
<dd>list non-redundant halfspaces incident to each intersection point.
The first line is the number of
non-redundant halfspaces. Each remaining line starts with the number
of non-redundant halfspaces. For the
cube example, each intersection is incident to three halfspaces.</dd>
<dt><a href="qh-opto.htm#i">i</a></dt>
<dd>list non-redundant halfspaces incident to each intersection point. The first
line is the number of intersection points. Each remaining line
lists the incident, non-redundant halfspaces. For the
cube example, each intersection is incident to three halfspaces.
</dd>
<dt><a href="qh-optf.htm#Fc">Fc</a></dt>
<dd>list coplanar halfspaces for each intersection point. The first line is
the number of intersection points. Each remaining line starts with
the number of coplanar halfspaces. A coplanar halfspace is listed for
one intersection point even though it is coplanar to multiple intersection
points.</dd>
<dt><a href="qh-optq.htm#Qc">Qi</a> <a href="qh-optf.htm#Fc">Fc</a></dt>
<dd>list redundant halfspaces for each intersection point. The first line is
the number of intersection points. Each remaining line starts with
the number of redundant halfspaces. Use options '<a href="qh-optq.htm#Qc">Qc</a> Qi Fc' to list
coplanar and redundant halfspaces.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>General</b></dd>
<dt><a href="qh-opto.htm#s">s</a></dt>
<dd>print summary for the halfspace intersection. Use '<a
href="qh-optf.htm#Fs">Fs</a>' if you need numeric data.</dd>
<dt><a href="qh-opto.htm#o">o</a></dt>
<dd>print vertices and facets of the dual convex hull. The
first line is the dimension. The second line is the number of
vertices, facets, and ridges. The vertex
coordinates are next, followed by the facets, one per line.</dd>
<dt><a href="qh-opto.htm#p">p</a></dt>
<dd>print vertex coordinates of the dual convex hull. Each vertex corresponds
to a non-redundant halfspace. Its coordinates are the negative of the hyperplane's coefficients
divided by the offset plus the inner product of the coefficients and
the interior point (-c/(b+a.p).
Options 'p <a href="qh-optq.htm#Qc">Qc</a>' includes coplanar halfspaces.
Options 'p <a href="qh-optq.htm#Qi">Qi</a>' includes redundant halfspaces.</dd>
<dt><a href="qh-opto.htm#m">m</a></dt>
<dd>Mathematica output for the dual convex hull in 2-d or 3-d.</dd>
<dt><a href="qh-optf.htm#FM">FM</a></dt>
<dd>Maple output for the dual convex hull in 2-d or 3-d.</dd>
<dt><a href="qh-optg.htm#G">G</a></dt>
<dd>Geomview output for the dual convex hull in 2-d, 3-d, or 4-d.</dd>
</dl>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="controls">qhalf controls</a></h3>
<blockquote>
<p>These options provide additional control:</p>
<blockquote>
<dl compact>
<dt><a href="qh-optq.htm#Qt">Qt</a></dt>
<dd>triangulated output. If a 3-d intersection is defined by more than
three hyperplanes, Qhull produces duplicate intersections -- one for
each extra hyperplane.</dd>
<dt><a href="qh-optq.htm#QJn">QJ</a></dt>
<dd>joggle the input instead of merging facets. In 3-d, this guarantees that
each intersection is defined by three hyperplanes.</dd>
<dt><a href="qh-opto.htm#f">f </a></dt>
<dd>facet dump. Print the data structure for each intersection (i.e.,
facet)</dd>
<dt><a href="qh-optt.htm#TFn">TFn</a></dt>
<dd>report summary after constructing <em>n</em>
intersections</dd>
<dt><a href="qh-optq.htm#QVn">QVn</a></dt>
<dd>select intersection points for halfspace <em>n</em>
(marked 'good')</dd>
<dt><a href="qh-optq.htm#QGn">QGn</a></dt>
<dd>select intersection points that are visible to halfspace <em>n</em>
(marked 'good'). Use <em>-n</em> for the remainder.</dd>
<dt><a href="qh-optq.htm#Qb0">Qbk:0Bk:0</a></dt>
<dd>remove the k-th coordinate from the input. This computes the
halfspace intersection in one lower dimension.</dd>
<dt><a href="qh-optt.htm#Tv">Tv</a></dt>
<dd>verify result</dd>
<dt><a href="qh-optt.htm#TO">TI file</a></dt>
<dd>input data from file. The filename may not use spaces or quotes.</dd>
<dt><a href="qh-optt.htm#TO">TO file</a></dt>
<dd>output results to file. Use single quotes if the filename
contains spaces (e.g., <tt>TO 'file with spaces.txt'</tt></dd>
<dt><a href="qh-optq.htm#Qs">Qs</a></dt>
<dd>search all points for the initial simplex. If Qhull can
not construct an initial simplex, it reports a
descriptive message. Usually, the point set is degenerate and one
or more dimensions should be removed ('<a href="qh-optq.htm#Qb0">Qbk:0Bk:0</a>').
If not, use option 'Qs'. It performs an exhaustive search for the
best initial simplex. This is expensive is high dimensions.</dd>
</dl>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="graphics">qhalf graphics</a></h3>
<blockquote>
<p>To view the results with Geomview, compute the convex hull of
the intersection points ('qhull FQ H0 Fp | qhull G'). See <a
href="qh-eg.htm#half">Halfspace examples</a>.</p>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="notes">qhalf notes</a></h3>
<blockquote>
<p>See <a href="qh-impre.htm#halfspace">halfspace intersection</a> for precision issues related to qhalf.</p>
<p>If you do not know an interior point for the halfspaces, use
linear programming to find one. Assume, <em>n</em> halfspaces
defined by: <em>aj*x1+bj*x2+cj*x3+dj&lt;=0, j=1..n</em>. Perform
the following linear program: </p>
<blockquote>
<p>max(x5) aj*x1+bj*x2+cj*x3+dj*x4+x5&lt;=0, j=1..n</p>
</blockquote>
<p>Then, if <em>[x1,x2,x3,x4,x5]</em> is an optimal solution with
<em>x4&gt;0</em> and <em>x5&gt;0</em> we get: </p>
<blockquote>
<p>aj*(x1/x4)+bj*(x2/x4)+cj*(x3/x4)+dj&lt;=(-x5/x4) j=1..n and (-x5/x4)&lt;0,
</p>
</blockquote>
<p>and conclude that the point <em>[x1/x4,x2/x4,x3/x4]</em> is in
the interior of all the halfspaces. Since <em>x5</em> is
optimal, this point is &quot;way in&quot; the interior (good
for precision errors).</p>
<p>After finding an interior point, the rest of the intersection
algorithm is from Preparata &amp; Shamos [<a
href="index.htm#pre-sha85">'85</a>, p. 316, &quot;A simple case
...&quot;]. Translate the halfspaces so that the interior point
is the origin. Calculate the dual polytope. The dual polytope is
the convex hull of the vertices dual to the original faces in
regard to the unit sphere (i.e., halfspaces at distance <em>d</em>
from the origin are dual to vertices at distance <em>1/d</em>).
Then calculate the resulting polytope, which is the dual of the
dual polytope, and translate the origin back to the interior
point [S. Spitz, S. Teller, D. Strawn].</p>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="conventions">qhalf
conventions</a></h3>
<blockquote>
<p>The following terminology is used for halfspace intersection
in Qhull. This is the hardest structure to understand. The
underlying structure is a convex hull with one vertex per
non-redundant halfspace. See <a href="#conventions">convex hull
conventions</a> and <a href="index.htm#structure">Qhull's data structures</a>.</p>
<ul>
<li><em>interior point</em> - a point in the intersection of
the halfspaces. Qhull needs an interior point to compute
the intersection. See <a href="#input">halfspace input</a>.</li>
<li><em>halfspace</em> - <em>d</em> coordinates for the
normal and a signed offset. The distance to an interior
point is negative.</li>
<li><em>non-redundant halfspace</em> - a halfspace that
defines an output facet</li>
<li><em>vertex</em> - a dual vertex in the convex hull
corresponding to a non-redundant halfspace</li>
<li><em>coplanar point</em> - the dual point corresponding to
a similar halfspace</li>
<li><em>interior point</em> - the dual point corresponding to
a redundant halfspace</li>
<li><em>intersection point</em>- the intersection of <em>d</em>
or more non-redundant halfspaces</li>
<li><em>facet</em> - a dual facet in the convex hull
corresponding to an intersection point</li>
<li><em>non-simplicial facet</em> - more than <em>d</em>
halfspaces intersect at a point</li>
<li><em>good facet</em> - an intersection point that
satisfies restriction '<a href="qh-optq.htm#QVn">QVn</a>',
etc.</li>
</ul>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="options">qhalf options</a></h3>
<pre>
qhalf- compute the intersection of halfspaces about a point
http://www.qhull.org
input (stdin):
optional interior point: dimension, 1, coordinates
first lines: dimension+1 and number of halfspaces
other lines: halfspace coefficients followed by offset
comments: start with a non-numeric character
options:
Hn,n - specify coordinates of interior point
Qt - triangulated ouput
QJ - joggle input instead of merging facets
Qc - keep coplanar halfspaces
Qi - keep other redundant halfspaces
Qhull control options:
QJn - randomly joggle input in range [-n,n]
Qbk:0Bk:0 - remove k-th coordinate from input
Qs - search all halfspaces for the initial simplex
QGn - print intersection if redundant to halfspace n, -n for not
QVn - print intersections for halfspace n, -n if not
Trace options:
T4 - trace at level n, 4=all, 5=mem/gauss, -1= events
Tc - check frequently during execution
Ts - print statistics
Tv - verify result: structure, convexity, and redundancy
Tz - send all output to stdout
TFn - report summary when n or more facets created
TI file - input data from file, no spaces or single quotes
TO file - output results to file, may be enclosed in single quotes
TPn - turn on tracing when halfspace n added to intersection
TMn - turn on tracing at merge n
TWn - trace merge facets when width > n
TVn - stop qhull after adding halfspace n, -n for before (see TCn)
TCn - stop qhull after building cone for halfspace n (see TVn)
Precision options:
Cn - radius of centrum (roundoff added). Merge facets if non-convex
An - cosine of maximum angle. Merge facets if cosine > n or non-convex
C-0 roundoff, A-0.99/C-0.01 pre-merge, A0.99/C0.01 post-merge
Rn - randomly perturb computations by a factor of [1-n,1+n]
Un - max distance below plane for a new, coplanar halfspace
Wn - min facet width for outside halfspace (before roundoff)
Output formats (may be combined; if none, produces a summary to stdout):
f - facet dump
G - Geomview output (dual convex hull)
i - non-redundant halfspaces incident to each intersection
m - Mathematica output (dual convex hull)
o - OFF format (dual convex hull: dimension, points, and facets)
p - vertex coordinates of dual convex hull (coplanars if 'Qc' or 'Qi')
s - summary (stderr)
More formats:
Fc - count plus redundant halfspaces for each intersection
- Qc (default) for coplanar and Qi for other redundant
Fd - use cdd format for input (homogeneous with offset first)
FF - facet dump without ridges
FI - ID of each intersection
Fm - merge count for each intersection (511 max)
FM - Maple output (dual convex hull)
Fn - count plus neighboring intersections for each intersection
FN - count plus intersections for each non-redundant halfspace
FO - options and precision constants
Fp - dim, count, and intersection coordinates
FP - nearest halfspace and distance for each redundant halfspace
FQ - command used for qhalf
Fs - summary: #int (8), dim, #halfspaces, #non-redundant, #intersections
for output: #non-redundant, #intersections, #coplanar
halfspaces, #non-simplicial intersections
#real (2), max outer plane, min vertex
Fv - count plus non-redundant halfspaces for each intersection
Fx - non-redundant halfspaces
Geomview output (2-d, 3-d and 4-d; dual convex hull)
Ga - all points (i.e., transformed halfspaces) as dots
Gp - coplanar points and vertices as radii
Gv - vertices (i.e., non-redundant halfspaces) as spheres
Gi - inner planes (i.e., halfspace intersections) only
Gn - no planes
Go - outer planes only
Gc - centrums
Gh - hyperplane intersections
Gr - ridges
GDn - drop dimension n in 3-d and 4-d output
Print options:
PAn - keep n largest facets (i.e., intersections) by area
Pdk:n- drop facet if normal[k] &lt;= n (default 0.0)
PDk:n- drop facet if normal[k] >= n
Pg - print good facets (needs 'QGn' or 'QVn')
PFn - keep facets whose area is at least n
PG - print neighbors of good facets
PMn - keep n facets with most merges
Po - force output. If error, output neighborhood of facet
Pp - do not report precision problems
. - list of all options
- - one line descriptions of all options
</pre>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis
&#149; <a href="#input">in</a>put &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#controls">co</a>ntrols &#149; <a href="#graphics">gr</a>aphics
&#149; <a href="#notes">no</a>tes &#149; <a href="#conventions">co</a>nventions
&#149; <a href="#options">op</a>tions
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,214 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../../road-faq/xsl/road-faq.xsl"?>
<rf:topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.roadintranet.org/road-faq-1 /road/road-faq/xsl/road-faq.xsd"
xmlns:rf="http://schemas.roadintranet.org/road-faq-1"
title=" C++ interface to Qhull"
file="qhull-cpp.xml"
fileid="$Id: //main/2015/qhull/html/qhull-cpp.xml#2 $$Change: 2027 $"
fileChange="$DateTime: 2015/11/09 23:18:11 $$Author: bbarber $">
<div><h4>Qhull C++ -- C++ interface to Qhull</h4></div>
<rf:copyright>
<a href="../cpp/COPYING.txt">Copyright</a> (c) 2009-2015, C.B. Barber
</rf:copyright>
<rf:section id="cpp-cpp-links" title="Useful Links for Qhull C++">
<div>
<p> This draft
document records some of the design decisions for Qhull C++. Convert it to HTML by road-faq.xsl from <a href="http://www.qhull.org/road/road-faq/road-faq.html">road-faq</a>.
Please send comments and suggestions to <a
href="mailto:bradb@shore.net">bradb@shore.net</a>
</p>
</div>
<div class="twocol">
<div class="col leftcol">
Help
<ul><li>
</li><li>
</li><li>
</li></ul>
</div>
<div class="col rightcol">
<ul><li>
</li><li>
</li></ul>
</div>
</div>
<div>
. <!-- clear the two column display -->
</div>
</rf:section>
<rf:section id="qhull-api" title="Qhull's collection classes">
<rf:item id="collection-api" title="API for Qhull collections" date="Feb 2009" author="bbarber">
Qhull's collection APIs are modeled on Qt's collection API (QList, QVector, QHash) w/o QT_STRICT_ITERATORS. They support STL and Qt programming.
<p>Some of Qhull's collection classes derive from STL classes. If so,
please avoid additional STL functions and operators added by inheritance.
These collection classes may be rewritten to derive from Qt classes instead.
See Road's <rf:iref item="cpp-collection-api"/>.
</p>
Qhull's collection API (where applicable). For documentation, see Qt's QList, QMap, QListIterator, QMapIterator, QMutableListIterator, and QMutableMapIterator
<ul><li>
STL types [list, qlinkedlist, qlist, qvector, vector] -- const_iterator, iterator
</li><li>
STL types describing iterators [list, qlinkedlist, qlist, qvector, vector] -- const_pointer, const_reference, difference_type,
pointer, reference, size_type, value_type.
Pointer and reference types not defined if unavailable (not needed for &lt;algorithm&gt;)
</li><li>
const_iterator, iterator types -- difference_type, iterator_category, pointer, reference, value_type
</li><li>
Qt types [qlinkedlist, qlist, qvector] -- ConstIterator, Iterator, QhullclassIterator, MutableQhullclassIterator.
Qt's foreach requires const_iterator.
</li><li>
Types for sets/maps [hash_map, QHash] -- key_compare, key_type, mapped_type
</li><li>
Constructor -- default constructor, copy constructor, assignment operator, destructor
</li><li>
Conversion -- to/from/as corresponding C, STL, and Qt constructs. Include toQList and toStdVector (may be filtered, e.g., QhullFacetSet).
Do not define fromStdList and fromQList if container is not reference counted (i.e., acts like a value)
</li><li>
Get/set -- configuration options for class
</li><li>
STL-style iterator - begin, constBegin, constEnd, end, key, value, =, *, [], ->, ++, --, +, -, ==, !=, &lt;,
&lt;=, &gt;, &gt;=, const_iterator(iterator), iterator COMPARE const_iterator.
An iterator is an abstraction of a pointer. It is not aware of its container.
</li><li>
Java-style iterator [qiterator.h] - countRemaining, findNext, findPrevious, hasNext, hasPrevious, next, peekNext, peekPrevious, previous, toBack, toFront, = Coordinates
</li><li>
Mutable Java-style iterator adds - insert, remove, setValue, value
</li><li>
Element access -- back, first, front, last
</li><li>
Element access w/ index -- [], at (const&amp; only), constData, data, mid, value
</li><li>
Read-only - (int)count, empty, isEmpty, (size_t)size. Count() and size() may be filtered. If so, they may be zero when !empty().
</li><li>
Read-only for sets/maps - capacity, key, keys, reserve, resize, values
</li><li>
Operator - ==, !=, +, +=, &lt;&lt;
</li><li>
Read-write -- append, clear, erase, insert, move, prepend, pop_back, pop_front, push_back, push_front, removeAll, removeAt, removeFirst, removeLast, replace,
swap, takeAt, takeFirst, takeLast
</li><li>
Read-write for sets/maps -- insertMulti, squeeze, take, unite
</li><li>
Search -- contains(const T &amp;), count(const T &amp;), indexOf, lastIndexOf
</li><li>
Search for sets/maps -- constFind, lowerBound, upperBound
</li><li>
Stream I/O -- stream &lt;&lt;
</li></ul>
STL list and vector -- For unfiltered access to each element.
<ul><li>
<a href="http://stdcxx.apache.org/doc/stdlibug/16-3.html">Apache: Creating your own containers</a> -- requirements for STL containers. Iterators should define the types from 'iterator_traits'.
</li><li>
STL types -- allocator_type, const_iterator, const_pointer, const_reference, const_reverse_iterator, difference_type, iterator, iterator_category, pointer, reference, reverse_iterator, size_type, value_type
</li><li>
STL constructors -- MyType(), MyType(count), MyType(count, value), MyType(first, last),
MyType(MyType&amp;),
</li><li>
STL getter/setters -- at (random_access only), back, begin, capacity, end, front, rbegin, rend, size, max_size
</li><li>
STL predicates -- empty
</li><li>
STL iterator types -- const_pointer, const_reference, difference_type, iterator_category, pointer, reference, value_type
</li><li>
STL iterator operators -- *, -&lt;, ++, --, +=, -=, +, -, [], ==, !=, &lt;, &gt;, &gt;=, &lt;=
</li><li>
STL operators -- =, [] (random_access only), ==, !=, &lt;, &gt;, &lt;=, &gt;=
</li><li>
STL modifiers -- assign, clear, erase, insert, pop_back, push_back, reserve, resize, swap
</li><li>
</li></ul>
Qt Qlist -- For unfiltered access to each element
<ul><li>
</li><li>
Additional Qt types -- ConstIterator, Iterator, QListIterator, QMutableListIterator
</li><li>
Additional Qt get/set -- constBegin, constEnd, count, first, last, value (random_access only)
</li><li>
Additional Qt predicates -- isEmpty
</li><li>
Additional Qt -- mid (random_access only)
</li><li>
Additional Qt search -- contains, count(T&amp;), indexOf (random_access only), lastIndeOf (random_access only)
</li><li>
Additional Qt modifiers -- append, insert(index,value) (random_access only), move (random_access only), pop_front, prepend, push_front, removeAll, removeAt (random_access only), removeFirst, removeLast, replace, swap by index, takeAt, takeFirst, takeLast
</li><li>
Additional Qt operators -- +, &lt;&lt;, +=,
stream &lt;&lt; and &gt;&gt;
</li><li>
Unsupported types by Qt -- allocator_type, const_reverse_iterator, reverse_iterator
</li><li>
Unsupported accessors by Qt -- max_size, rbegin, rend
</li><li>
Unsupported constructors by Qt -- multi-value constructors
</li><li>
unsupported modifiers by Qt -- assign, muli-value inserts, STL's swaps
</li><li>
</li></ul>
STL map and Qt QMap. These use nearly the same API as list and vector classes. They add the following.
<ul><li>
STL types -- key_compare, key_type, mapped_type
</li><li>
STL search -- equal_range, find, lower_bound, upper_bound
</li><li>
Qt removes -- equal_range, key_compare
</li><li>
Qt renames -- lowerBound, upperBound
</li><li>
Qt adds -- constFind, insertMulti, key, keys, take, uniqueKeys, unite, values
</li><li>
Not applicable to map and QMap -- at, back, pop_back, pop_front, push_back, push_front, swap
</li><li>
Not applicable to QMap -- append, first, last, lastIndexOf, mid, move, prepend, removeAll, removeAt, removeFirst, removeLast, replace, squeeze, takeAt, takeFirst, takeLast
</li><li>
Not applicable to map -- assign
</li></ul>
Qt QHash. STL extensions provide similar classes, e.g., Microsoft's stdext::hash_set. THey are nearly the same as QMap
<ul><li>
</li><li>
</li><li>
Not applicable to Qhash -- lowerBound, unite, upperBound,
</li><li>
Qt adds -- squeeze
</li></ul>
</rf:item>
<rf:item id="class-api" title="API for Qhull collections" date="Feb 2009" author="bbarber">
<ul><li>
check... -- Throw error on failure
</li><li>
try... -- Return false on failure. Do not throw errors.
</li><li>
...Temporarily -- lifetime depends on source. e.g., toByteArrayTemporarily
</li><li>
...p -- indicates pointer-to.
</li><li>
end... -- points to one beyond the last available
</li><li>
private functions -- No syntactic indication. They may become public later on.
</li><li>
Error messages -- Preceed error messages with the name of the class throwing the error (e.g. "ClassName: ..."). If this is an internal error, use "ClassName inconsistent: ..."
</li><li>
parameter order -- qhRunId, dimension, coordinates, count.
</li><li>
toClass -- Convert into a Class object (makes a deep copy)
</li><li>
qRunId -- Requires Qh installed. Some routines allow 0 for limited info (e.g., operator&lt;&lt;)
</li><li>
Disable methods in derived classes -- If the default constructor, copy constructor, or copy assignment is disabled, it should be also disabled in derived classes (better error messages).
</li><li>
Constructor order -- default constructor, other constructors, copy constructor, copy assignment, destructor
</li></ul>
</rf:item>
</rf:section>
</rf:topic>

473
xs/src/qhull/html/qhull.htm Normal file
View File

@ -0,0 +1,473 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>qhull -- convex hull and related structures</title>
</head>
<body>
<!-- Navigation links -->
<p><b><a name="TOP">Up</a></b><b>:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis &#149; <a href="#input">in</a>put
&#149; <a href="#outputs">ou</a>tputs &#149; <a href="#controls">co</a>ntrols
&#149; <a href="#options">op</a>tions
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/cone.html"><img
src="qh--cone.gif" alt="[cone]" align="middle" width="100"
height="100"></a>qhull -- convex hull and related structures</h1>
<p>The convex hull of a set of points is the smallest convex set
containing the points. The Delaunay triangulation and furthest-site
Delaunay triangulation are equivalent to a convex hull in one
higher dimension. Halfspace intersection about a point is
equivalent to a convex hull by polar duality.
<p>The <tt>qhull</tt> program provides options to build these
structures and to experiment with the process. Use the
<a href=qconvex.htm>qconvex</a>,
<a href=qdelaun.htm>qdelaunay</a>, <a href=qhalf.htm>qhalf</a>,
and <a href=qvoronoi.htm>qvoronoi</a> programs
to build specific structures. You may use <tt>qhull</tt> instead.
It takes the same options and uses the same code.
<blockquote>
<dl>
<dt><b>Example:</b> rbox 1000 D3 | qhull
<a href="qh-optc.htm#Cn">C-1e-4</a>
<a href="qh-optf.htm#FO">FO</a>
<a href="qh-optt.htm#Ts">Ts</a>
</dt>
<dd>Compute the 3-d convex hull of 1000 random
points.
Centrums must be 10^-4 below neighboring
hyperplanes. Print the options and precision constants.
When done, print statistics. These options may be
used with any of the Qhull programs.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox 1000 D3 | qhull <a href=qhull.htm#outputs>d</a>
<a href="qh-optq.htm#Qbb">Qbb</a>
<a href="qh-optc.htm#Rn">R1e-4</a>
<a href="qh-optq.htm#Q0">Q0</a></dt>
<dd>Compute the 3-d Delaunay triangulation of 1000 random
points. Randomly perturb all calculations by
[0.9999,1.0001]. Do not correct precision problems.
This leads to serious precision errors.</dd>
</dl>
</blockquote>
<p>Use the following equivalences when calling <tt>qhull</tt> in 2-d to 4-d (a 3-d
Delaunay triangulation is a 4-d convex hull):
<blockquote>
<ul>
<li>
<a href="qconvex.htm">qconvex</a> == qhull
<li>
<a href=qdelaun.htm>qdelaunay</a> == qhull d <a href="qh-optq.htm#Qbb">Qbb</a>
<li>
<a href=qhalf.htm>qhalf</a> == qhull H
<li>
<a href=qvoronoi.htm>qvoronoi</a> == qhull v <a href="qh-optq.htm#Qbb">Qbb</a>
</ul>
</blockquote>
<p>Use the following equivalences when calling <tt>qhull</tt> in 5-d and higher (a 4-d
Delaunay triangulation is a 5-d convex hull):
<blockquote>
<ul>
<li>
<a href="qconvex.htm">qconvex</a> == qhull <a href="qh-optq.htm#Qx">Qx</a>
<li>
<a href=qdelaun.htm>qdelaunay</a> == qhull d <a href="qh-optq.htm#Qbb">Qbb</a> <a href="qh-optq.htm#Qx">Qx</a>
<li>
<a href=qhalf.htm>qhalf</a> == qhull H <a href="qh-optq.htm#Qx">Qx</a>
<li>
<a href=qvoronoi.htm>qvoronoi</a> == qhull v <a href="qh-optq.htm#Qbb">Qbb</a> <a href="qh-optq.htm#Qx">Qx</a>
</ul>
</blockquote>
<p>By default, Qhull merges coplanar facets. For example, the convex
hull of a cube's vertices has six facets.
<p>If you use '<a href="qh-optq.htm#Qt">Qt</a>' (triangulated output),
all facets will be simplicial (e.g., triangles in 2-d). For the cube
example, it will have 12 facets. Some facets may be
degenerate and have zero area.
<p>If you use '<a href="qh-optq.htm#QJn">QJ</a>' (joggled input),
all facets will be simplicial. The corresponding vertices will be
slightly perturbed. Joggled input is less accurate that triangulated
output.See <a
href="qh-impre.htm#joggle">Merged facets or joggled input</a>. </p>
<p>The output for 4-d convex hulls may be confusing if the convex
hull contains non-simplicial facets (e.g., a hypercube). See
<a href=qh-faq.htm#extra>Why
are there extra points in a 4-d or higher convex hull?</a><br>
</p>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<h3><a href="#TOP">&#187;</a><a name="synopsis">qhull synopsis</a></h3>
<pre>
qhull- compute convex hulls and related structures.
input (stdin): dimension, n, point coordinates
comments start with a non-numeric character
halfspace: use dim+1 and put offsets after coefficients
options (qh-quick.htm):
d - Delaunay triangulation by lifting points to a paraboloid
d Qu - furthest-site Delaunay triangulation (upper convex hull)
v - Voronoi diagram as the dual of the Delaunay triangulation
v Qu - furthest-site Voronoi diagram
H1,1 - Halfspace intersection about [1,1,0,...] via polar duality
Qt - triangulated output
QJ - joggle input instead of merging facets
Tv - verify result: structure, convexity, and point inclusion
. - concise list of all options
- - one-line description of all options
Output options (subset):
s - summary of results (default)
i - vertices incident to each facet
n - normals with offsets
p - vertex coordinates (if 'Qc', includes coplanar points)
if 'v', Voronoi vertices
Fp - halfspace intersections
Fx - extreme points (convex hull vertices)
FA - compute total area and volume
o - OFF format (if 'v', outputs Voronoi regions)
G - Geomview output (2-d, 3-d and 4-d)
m - Mathematica output (2-d and 3-d)
QVn - print facets that include point n, -n if not
TO file- output results to file, may be enclosed in single quotes
examples:
rbox c d D2 | qhull Qc s f Fx | more rbox 1000 s | qhull Tv s FA
rbox 10 D2 | qhull d QJ s i TO result rbox 10 D2 | qhull v Qbb Qt p
rbox 10 D2 | qhull d Qu QJ m rbox 10 D2 | qhull v Qu QJ o
rbox c | qhull n rbox c | qhull FV n | qhull H Fp
rbox d D12 | qhull QR0 FA rbox c D7 | qhull FA TF1000
rbox y 1000 W0 | qhull rbox 10 | qhull v QJ o Fv
</pre>
<h3><a href="#TOP">&#187;</a><a name="input">qhull input</a></h3>
<blockquote>
<p>The input data on <tt>stdin</tt> consists of:</p>
<ul>
<li>dimension
<li>number of points</li>
<li>point coordinates</li>
</ul>
<p>Use I/O redirection (e.g., qhull &lt; data.txt), a pipe (e.g., rbox 10 | qhull),
or the '<a href=qh-optt.htm#TI>TI</a>' option (e.g., qhull TI data.txt).
<p>Comments start with a non-numeric character. Error reporting is
simpler if there is one point per line. Dimension
and number of points may be reversed. For halfspace intersection,
an interior point may be prepended (see <a href=qhalf.htm#input>qhalf input</a>).
<p>Here is the input for computing the convex
hull of the unit cube. The output is the normals, one
per facet.</p>
<blockquote>
<p>rbox c &gt; data </p>
<pre>
3 RBOX c
8
-0.5 -0.5 -0.5
-0.5 -0.5 0.5
-0.5 0.5 -0.5
-0.5 0.5 0.5
0.5 -0.5 -0.5
0.5 -0.5 0.5
0.5 0.5 -0.5
0.5 0.5 0.5
</pre>
<p>qhull s n &lt; data</p>
<pre>
Convex hull of 8 points in 3-d:
Number of vertices: 8
Number of facets: 6
Number of non-simplicial facets: 6
Statistics for: RBOX c | QHULL s n
Number of points processed: 8
Number of hyperplanes created: 11
Number of distance tests for qhull: 35
Number of merged facets: 6
Number of distance tests for merging: 84
CPU seconds to compute hull (after input): 0.081
4
6
0 0 -1 -0.5
0 -1 0 -0.5
1 0 0 -0.5
-1 0 0 -0.5
0 1 0 -0.5
0 0 1 -0.5
</pre>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="outputs">qhull outputs</a></h3>
<blockquote>
<p>These options control the output of qhull. They may be used
individually or together.</p>
<blockquote>
<dl compact>
<dt>&nbsp;</dt>
<dd><b>General</b></dd>
<dt><a>qhull</a></dt>
<dd>compute the convex hull of the input points.
See <a href=qconvex.htm>qconvex</a>.</dd>
<dt><a name="d">qhull d Qbb</a></dt>
<dd>compute the Delaunay triangulation by lifting the points
to a paraboloid. Use option '<a href="qh-optq.htm#Qbb">Qbb</a>'
to scale the paraboloid and improve numeric precision.
See <a href=qdelaun.htm>qdelaunay</a>.</dd>
<dt><a name="v">qhull v Qbb</a></dt>
<dd>compute the Voronoi diagram by computing the Delaunay
triangulation. Use option '<a href="qh-optq.htm#Qbb">Qbb</a>'
to scale the paraboloid and improve numeric precision.
See <a href=qvoronoi.htm>qvoronoi</a>.</dd>
<dt><a name="H">qhull H</a></dt>
<dd>compute the halfspace intersection about a point via polar
duality. The point is below the hyperplane that defines the halfspace.
See <a href=qhalf.htm>qhalf</a>.</dd>
</dl>
</blockquote>
<p>For a full list of output options see
<blockquote>
<ul>
<li><a href="qh-opto.htm#output">Output</a> formats</li>
<li><a href="qh-optf.htm#format">Additional</a> I/O
formats</li>
<li><a href="qh-optg.htm#geomview">Geomview</a>
output options</li>
<li><a href="qh-optp.htm#print">Print</a> options</li>
</ul>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="controls">qhull controls</a></h3>
<blockquote>
<p>For a full list of control options see
<blockquote>
<ul>
<li><a href="qh-optq.htm#qhull">Qhull</a> control
options</li>
<li><a href="qh-optc.htm#prec">Precision</a> options</li>
<li><a href="qh-optt.htm#trace">Trace</a> options</li>
</ul>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="options">qhull options</a></h3>
<pre>
qhull- compute convex hulls and related structures.
http://www.qhull.org
input (stdin):
first lines: dimension and number of points (or vice-versa).
other lines: point coordinates, best if one point per line
comments: start with a non-numeric character
halfspaces: use dim plus one and put offset after coefficients.
May be preceded by a single interior point ('H').
options:
d - Delaunay triangulation by lifting points to a paraboloid
d Qu - furthest-site Delaunay triangulation (upper convex hull)
v - Voronoi diagram (dual of the Delaunay triangulation)
v Qu - furthest-site Voronoi diagram
Hn,n,... - halfspace intersection about point [n,n,0,...]
Qt - triangulated output
QJ - joggle input instead of merging facets
Qc - keep coplanar points with nearest facet
Qi - keep interior points with nearest facet
Qhull control options:
Qbk:n - scale coord k so that low bound is n
QBk:n - scale coord k so that upper bound is n (QBk is 0.5)
QbB - scale input to unit cube centered at the origin
Qbb - scale last coordinate to [0,m] for Delaunay triangulations
Qbk:0Bk:0 - remove k-th coordinate from input
QJn - randomly joggle input in range [-n,n]
QRn - random rotation (n=seed, n=0 time, n=-1 time/no rotate)
Qf - partition point to furthest outside facet
Qg - only build good facets (needs 'QGn', 'QVn', or 'PdD')
Qm - only process points that would increase max_outside
Qr - process random outside points instead of furthest ones
Qs - search all points for the initial simplex
Qu - for 'd' or 'v', compute upper hull without point at-infinity
returns furthest-site Delaunay triangulation
Qv - test vertex neighbors for convexity
Qx - exact pre-merges (skips coplanar and anglomaniacs facets)
Qz - add point-at-infinity to Delaunay triangulation
QGn - good facet if visible from point n, -n for not visible
QVn - good facet if it includes point n, -n if not
Q0 - turn off default p remerge with 'C-0'/'Qx'
Q1 - sort merges by type instead of angle
Q2 - merge all non-convex at once instead of independent sets
Q3 - do not merge redundant vertices
Q4 - avoid old>new merges
Q5 - do not correct outer planes at end of qhull
Q6 - do not pre-merge concave or coplanar facets
Q7 - depth-first processing instead of breadth-first
Q8 - do not process near-inside points
Q9 - process furthest of furthest points
Q10 - no special processing for narrow distributions
Q11 - copy normals and recompute centrums for tricoplanar facets
Q12 - do not error on wide merge due to duplicate ridge and nearly coincident points
Towpaths Trace options:
T4 - trace at level n, 4=all, 5=mem/gauss, -1= events
Tc - check frequently during execution
Ts - print statistics
Tv - verify result: structure, convexity, and point inclusion
Tz - send all output to stdout
TFn - report summary when n or more facets created
TI file - input data from file, no spaces or single quotes
TO file - output results to file, may be enclosed in single quotes
TPn - turn on tracing when point n added to hull
TMn - turn on tracing at merge n
TWn - trace merge facets when width > n
TRn - rerun qhull n times. Use with 'QJn'
TVn - stop qhull after adding point n, -n for before (see TCn)
TCn - stop qhull after building cone for point n (see TVn)
Precision options:
Cn - radius of centrum (roundoff added). Merge facets if non-convex
An - cosine of maximum angle. Merge facets if cosine > n or non-convex
C-0 roundoff, A-0.99/C-0.01 pre-merge, A0.99/C0.01 post-merge
En - max roundoff error for distance computation
Rn - randomly perturb computations by a factor of [1-n,1+n]
Vn - min distance above plane for a visible facet (default 3C-n or En)
Un - max distance below plane for a new, coplanar point (default Vn)
Wn - min facet width for outside point (before roundoff, default 2Vn)
Output formats (may be combined; if none, produces a summary to stdout):
f - facet dump
G - Geomview output (see below)
i - vertices incident to each facet
m - Mathematica output (2-d and 3-d)
o - OFF format (dim, points and facets; Voronoi regions)
n - normals with offsets
p - vertex coordinates or Voronoi vertices (coplanar points if 'Qc')
s - summary (stderr)
More formats:
Fa - area for each facet
FA - compute total area and volume for option 's'
Fc - count plus coplanar points for each facet
use 'Qc' (default) for coplanar and 'Qi' for interior
FC - centrum or Voronoi center for each facet
Fd - use cdd format for input (homogeneous with offset first)
FD - use cdd format for numeric output (offset first)
FF - facet dump without ridges
Fi - inner plane for each facet
for 'v', separating hyperplanes for bounded Voronoi regions
FI - ID of each facet
Fm - merge count for each facet (511 max)
FM - Maple output (2-d and 3-d)
Fn - count plus neighboring facets for each facet
FN - count plus neighboring facets for each point
Fo - outer plane (or max_outside) for each facet
for 'v', separating hyperplanes for unbounded Voronoi regions
FO - options and precision constants
Fp - dim, count, and intersection coordinates (halfspace only)
FP - nearest vertex and distance for each coplanar point
FQ - command used for qhull
Fs - summary: #int (8), dimension, #points, tot vertices, tot facets,
output: #vertices, #facets, #coplanars, #nonsimplicial
#real (2), max outer plane, min vertex
FS - sizes: #int (0)
#real(2) tot area, tot volume
Ft - triangulation with centrums for non-simplicial facets (OFF format)
Fv - count plus vertices for each facet
for 'v', Voronoi diagram as Voronoi vertices for pairs of sites
FV - average of vertices (a feasible point for 'H')
Fx - extreme points (in order for 2-d)
Geomview options (2-d, 3-d, and 4-d; 2-d Voronoi)
Ga - all points as dots
Gp - coplanar points and vertices as radii
Gv - vertices as spheres
Gi - inner planes only
Gn - no planes
Go - outer planes only
Gc - centrums
Gh - hyperplane intersections
Gr - ridges
GDn - drop dimension n in 3-d and 4-d output
Gt - for 3-d 'd', transparent outer ridges
Print options:
PAn - keep n largest facets by area
Pdk:n - drop facet if normal[k] &lt;= n (default 0.0)
PDk:n - drop facet if normal[k] >= n
Pg - print good facets (needs 'QGn' or 'QVn')
PFn - keep facets whose area is at least n
PG - print neighbors of good facets
PMn - keep n facets with most merges
Po - force output. If error, output neighborhood of facet
Pp - do not report precision problems
. - list of all options
- - one line descriptions of all options
</pre>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis &#149; <a href="#input">in</a>put
&#149; <a href="#outputs">ou</a>tputs &#149; <a href="#controls">co</a>ntrols
&#149; <a href="#options">op</a>tions
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

1008
xs/src/qhull/html/qhull.man Normal file

File diff suppressed because it is too large Load Diff

1263
xs/src/qhull/html/qhull.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,396 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>qvoronoi Qu -- furthest-site Voronoi diagram</title>
</head>
<body>
<!-- Navigation links -->
<a name="TOP"><b>Up</b></a><b>:</b>
<a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis
&#149; <a href="#input">in</a>put &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#controls">co</a>ntrols &#149; <a href="#graphics">gr</a>aphics
&#149; <a href="#notes">no</a>tes &#149; <a href="#conventions">co</a>nventions
&#149; <a href="#options">op</a>tions
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/delaunay.html"><img
src="qh--dt.gif" alt="[delaunay]" align="middle" width="100"
height="100"></a>qvoronoi Qu -- furthest-site Voronoi diagram</h1>
<p>The furthest-site Voronoi diagram is the furthest-neighbor map for a set of
points. Each region contains those points that are further
from one input site than any other input site. See the
survey article by Aurenhammer [<a href="index.htm#aure91">'91</a>]
and the brief introduction by O'Rourke [<a
href="index.htm#orou94">'94</a>]. The furthest-site Voronoi diagram is the dual of the <a
href="qdelau_f.htm">furthest-site Delaunay triangulation</a>.
</p>
<blockquote>
<dl>
<dt><b>Example:</b> rbox 10 D2 | qvoronoi <a
href="qh-optq.htm#Qu">Qu</a> <a href="qh-opto.htm#s">s</a>
<a href="qh-opto.htm#o">o</a> <a href="qh-optt.htm#TO">TO
result</a></dt>
<dd>Compute the 2-d, furthest-site Voronoi diagram of 10
random points. Write a summary to the console and the Voronoi
regions and vertices to 'result'. The first vertex of the
result indicates unbounded regions. Almost all regions
are unbounded.</dd>
</dl>
<dl>
<dt><b>Example:</b> rbox r y c G1 D2 | qvoronoi <a
href="qh-optq.htm#Qu">Qu</a>
<a href="qh-opto.htm#s">s</a>
<a href="qh-optf.htm#Fn">Fn</a> <a href="qh-optt.htm#TO">TO
result</a></dt>
<dd>Compute the 2-d furthest-site Voronoi diagram of a square
and a small triangle. Write a summary to the console and the Voronoi
vertices for each input site to 'result'.
The origin is the only furthest-site Voronoi vertex. The
negative indices indicate vertices-at-infinity.</dd>
</dl>
</blockquote>
<p>
Qhull computes the furthest-site Voronoi diagram via the <a href="qdelau_f.htm">
furthest-site Delaunay triangulation</a>.
Each furthest-site Voronoi vertex is the circumcenter of an upper
facet of the Delaunay triangulation. Each furthest-site Voronoi
region corresponds to a vertex of the Delaunay triangulation
(i.e., an input site).</p>
<p>See <a href="http://www.qhull.org/html/qh-faq.htm#TOC">Qhull FAQ</a> - Delaunay and
Voronoi diagram questions.</p>
<p>The 'qvonoroi' program is equivalent to
'<a href=qhull.htm#outputs>qhull v</a> <a href=qh-optq.htm#Qbb>Qbb</a>' in 2-d to 3-d, and
'<a href=qhull.htm#outputs>qhull v</a> <a href=qh-optq.htm#Qbb>Qbb</a> <a href=qh-optq.htm#Qx>Qx</a>'
in 4-d and higher. It disables the following Qhull
<a href=qh-quick.htm#options>options</a>: <i>d n m v H U Qb
QB Qc Qf Qg Qi Qm Qr QR Qv Qx TR E V Fa FA FC Fp FS Ft FV Gt Q0,etc</i>.
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<h3><a href="#TOP">&#187;</a><a name="synopsis">furthest-site qvoronoi synopsis</a></h3>
<blockquote>
See <a href="qvoronoi.htm#synopsis">qvoronoi synopsis</a>. The same
program is used for both constructions. Use option '<a href="qh-optq.htm#Qu">Qu</a>'
for furthest-site Voronoi diagrams.
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="input">furthest-site qvoronoi
input</a></h3>
<blockquote>
<p>The input data on <tt>stdin</tt> consists of:</p>
<ul>
<li>dimension
<li>number of points</li>
<li>point coordinates</li>
</ul>
<p>Use I/O redirection (e.g., qvoronoi Qu &lt; data.txt), a pipe (e.g., rbox 10 | qvoronoi Qu),
or the '<a href=qh-optt.htm#TI>TI</a>' option (e.g., qvoronoi TI data.txt Qu).
<p>For example, this is a square containing four random points.
Its furthest-site Voronoi diagram has on vertex and four unbounded,
separating hyperplanes (i.e., the coordinate axes)
<p>
<blockquote>
<tt>rbox c 4 D2 &gt; data</tt>
<blockquote><pre>
2 RBOX c 4 D2
8
-0.4999921736307369 -0.3684622117955817
0.2556053225468894 -0.0413498678629751
0.0327672376602583 -0.2810408135699488
-0.452955383763607 0.17886471718444
-0.5 -0.5
-0.5 0.5
0.5 -0.5
0.5 0.5
</pre></blockquote>
<p><tt>qvoronoi Qu s Fo &lt; data</tt>
<blockquote><pre>
Furthest-site Voronoi vertices by the convex hull of 8 points in 3-d:
Number of Voronoi regions: 8
Number of Voronoi vertices: 1
Number of non-simplicial Voronoi vertices: 1
Statistics for: RBOX c 4 D2 | QVORONOI Qu s Fo
Number of points processed: 8
Number of hyperplanes created: 20
Number of facets in hull: 11
Number of distance tests for qhull: 34
Number of merged facets: 1
Number of distance tests for merging: 107
CPU seconds to compute hull (after input): 0
4
5 4 5 0 1 0
5 4 6 1 0 0
5 5 7 1 0 0
5 6 7 0 1 0
</pre></blockquote>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a> <a name="outputs">furthest-site qvoronoi
outputs</a></h3>
<blockquote>
<p>These options control the output of furthest-site Voronoi diagrams.</p>
<blockquote>
<dl compact>
<dt>&nbsp;</dt>
<dd><b>furthest-site Voronoi vertices</b></dd>
<dt><a href="qh-opto.htm#p">p</a></dt>
<dd>print the coordinates of the furthest-site Voronoi vertices. The first line
is the dimension. The second line is the number of vertices. Each
remaining line is a furthest-site Voronoi vertex. The points-in-square example
has one furthest-site Voronoi vertex at the origin.</dd>
<dt><a href="qh-optf.htm#Fn">Fn</a></dt>
<dd>list the neighboring furthest-site Voronoi vertices for each furthest-site Voronoi
vertex. The first line is the number of Voronoi vertices. Each
remaining line starts with the number of neighboring vertices. Negative indices (e.g., <em>-1</em>) indicate vertices
outside of the Voronoi diagram. In the points-in-square example, the
Voronoi vertex at the origin has four neighbors-at-infinity.</dd>
<dt><a href="qh-optf.htm#FN">FN</a></dt>
<dd>list the furthest-site Voronoi vertices for each furthest-site Voronoi region. The first line is
the number of Voronoi regions. Each remaining line starts with the
number of Voronoi vertices. Negative indices (e.g., <em>-1</em>) indicate vertices
outside of the Voronoi diagram.
In the points-in-square example, all regions share the Voronoi vertex
at the origin.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>furthest-site Voronoi regions</b></dd>
<dt><a href="qh-opto.htm#o">o</a></dt>
<dd>print the furthest-site Voronoi regions in OFF format. The first line is the
dimension. The second line is the number of vertices, the number
of input sites, and "1". The third line represents the vertex-at-infinity.
Its coordinates are "-10.101". The next lines are the coordinates
of the furthest-site Voronoi vertices. Each remaining line starts with the number
of Voronoi vertices in a Voronoi region. In 2-d, the vertices are
listed in adjacency order (unoriented). In 3-d and higher, the
vertices are listed in numeric order. In the points-in-square
example, each unbounded region includes the Voronoi vertex at
the origin. Lines consisting of <em>0</em> indicate
interior input sites. </dd>
<dt><a href="qh-optf.htm#Fi2">Fi</a></dt>
<dd>print separating hyperplanes for inner, bounded furthest-site Voronoi
regions. The first number is the number of separating
hyperplanes. Each remaining line starts with <i>3+dim</i>. The
next two numbers are adjacent input sites. The next <i>dim</i>
numbers are the coefficients of the separating hyperplane. The
last number is its offset. The are no bounded, separating hyperplanes
for the points-in-square example.</dd>
<dt><a href="qh-optf.htm#Fo2">Fo</a></dt>
<dd>print separating hyperplanes for outer, unbounded furthest-site Voronoi
regions. The first number is the number of separating
hyperplanes. Each remaining line starts with <i>3+dim</i>. The
next two numbers are adjacent input sites on the convex hull. The
next <i>dim</i>
numbers are the coefficients of the separating hyperplane. The
last number is its offset. The points-in-square example has four
unbounded, separating hyperplanes.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Input sites</b></dd>
<dt><a href="qh-optf.htm#Fv2">Fv</a></dt>
<dd>list ridges of furthest-site Voronoi vertices for pairs of input sites. The
first line is the number of ridges. Each remaining line starts with
two plus the number of Voronoi vertices in the ridge. The next
two numbers are two adjacent input sites. The remaining numbers list
the Voronoi vertices. As with option 'o', a <em>0</em> indicates
the vertex-at-infinity
and an unbounded, separating hyperplane.
The perpendicular bisector (separating hyperplane)
of the input sites is a flat through these vertices.
In the points-in-square example, the ridge for each edge of the square
is unbounded.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>General</b></dd>
<dt><a href="qh-opto.htm#s">s</a></dt>
<dd>print summary of the furthest-site Voronoi diagram. Use '<a
href="qh-optf.htm#Fs">Fs</a>' for numeric data.</dd>
<dt><a href="qh-opto.htm#i">i</a></dt>
<dd>list input sites for each <a href=qdelau_f.htm>furthest-site Delaunay region</a>. Use option '<a href="qh-optp.htm#Pp">Pp</a>'
to avoid the warning. The first line is the number of regions. The
remaining lines list the input sites for each region. The regions are
oriented. In the points-in-square example, the square region has four
input sites. In 3-d and higher, report cospherical sites by adding extra points.
</dd>
<dt><a href="qh-optg.htm#G">G</a></dt>
<dd>Geomview output for 2-d furthest-site Voronoi diagrams.</dd>
</dl>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a> <a name="controls">furthest-site qvoronoi
controls</a></h3>
<blockquote>
<p>These options provide additional control:</p>
<blockquote>
<dl compact>
<dt><a href="qh-optq.htm#Qu">Qu</a></dt>
<dd>must be used.</dd>
<dt><a href="qh-optq.htm#QVn">QVn</a></dt>
<dd>select furthest-site Voronoi vertices for input site <em>n</em> </dd>
<dt><a href="qh-optt.htm#Tv">Tv</a></dt>
<dd>verify result</dd>
<dt><a href="qh-optt.htm#TO">TI file</a></dt>
<dd>input data from file. The filename may not use spaces or quotes.</dd>
<dt><a href="qh-optt.htm#TO">TO file</a></dt>
<dd>output results to file. Use single quotes if the filename
contains spaces (e.g., <tt>TO 'file with spaces.txt'</tt></dd>
<dt><a href="qh-optt.htm#TFn">TFn</a></dt>
<dd>report progress after constructing <em>n</em> facets</dd>
<dt><a href="qh-optp.htm#PDk">PDk:1</a></dt>
<dd>include upper and lower facets in the output. Set <em>k</em>
to the last dimension (e.g., 'PD2:1' for 2-d inputs). </dd>
<dt><a href="qh-opto.htm#f">f </a></dt>
<dd>facet dump. Print the data structure for each facet (i.e.,
furthest-site Voronoi vertex).</dd>
</dl>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a> <a name="graphics">furthest-site qvoronoi
graphics</a></h3>
<blockquote>
<p>In 2-d, Geomview output ('<a href="qh-optg.htm#G">G</a>')
displays a furthest-site Voronoi diagram with extra edges to
close the unbounded furthest-site Voronoi regions. All regions
will be unbounded. Since the points-in-box example has only
one furthest-site Voronoi vertex, the Geomview output is one
point.</p>
<p>See the <a href="qh-eg.htm#delaunay">Delaunay and Voronoi
examples</a> for a 2-d example. Turn off normalization (on
Geomview's 'obscure' menu) when comparing the furthest-site
Voronoi diagram with the corresponding Voronoi diagram. </p>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="notes">furthest-site qvoronoi
notes</a></h3>
<blockquote>
<p>See <a href="qvoronoi.htm#notes">Voronoi notes</a>.</p>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="conventions">furthest-site qvoronoi conventions</a></h3>
<blockquote>
<p>The following terminology is used for furthest-site Voronoi
diagrams in Qhull. The underlying structure is a furthest-site
Delaunay triangulation from a convex hull in one higher
dimension. Upper facets of the Delaunay triangulation correspond
to vertices of the furthest-site Voronoi diagram. Vertices of the
furthest-site Delaunay triangulation correspond to input sites.
They also define regions of the furthest-site Voronoi diagram.
All vertices are extreme points of the input sites. See <a
href="qconvex.htm#conventions">qconvex conventions</a>, <a
href="qdelau_f.htm#conventions">furthest-site delaunay
conventions</a>, and <a href="index.htm#structure">Qhull's data structures</a>.</p>
<ul>
<li><em>input site</em> - a point in the input (one dimension
lower than a point on the convex hull)</li>
<li><em>point</em> - a point has <i>d+1</i> coordinates. The
last coordinate is the sum of the squares of the input
site's coordinates</li>
<li><em>vertex</em> - a point on the upper facets of the
paraboloid. It corresponds to a unique input site. </li>
<li><em>furthest-site Delaunay facet</em> - an upper facet of the
paraboloid. The last coefficient of its normal is
clearly positive.</li>
<li><em>furthest-site Voronoi vertex</em> - the circumcenter
of a furthest-site Delaunay facet</li>
<li><em>furthest-site Voronoi region</em> - the region of
Euclidean space further from an input site than any other
input site. Qhull lists the furthest-site Voronoi
vertices that define each furthest-site Voronoi region.</li>
<li><em>furthest-site Voronoi diagram</em> - the graph of the
furthest-site Voronoi regions with the ridges (edges)
between the regions.</li>
<li><em>infinity vertex</em> - the Voronoi vertex for
unbounded furthest-site Voronoi regions in '<a
href="qh-opto.htm#o">o</a>' output format. Its
coordinates are <em>-10.101</em>.</li>
<li><em>good facet</em> - an furthest-site Voronoi vertex with
optional restrictions by '<a href="qh-optq.htm#QVn">QVn</a>',
etc.</li>
</ul>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="options">furthest-site qvoronoi options</a></h3>
<blockquote>
See <a href="qvoronoi.htm#options">qvoronoi options</a>. The same
program is used for both constructions. Use option '<a href="qh-optq.htm#Qu">Qu</a>'
for furthest-site Voronoi diagrams.
</blockquote>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis
&#149; <a href="#input">in</a>put &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#controls">co</a>ntrols &#149; <a href="#graphics">gr</a>aphics
&#149; <a href="#notes">no</a>tes &#149; <a href="#conventions">co</a>nventions
&#149; <a href="#options">op</a>tions
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,667 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>qvoronoi -- Voronoi diagram</title>
</head>
<body>
<!-- Navigation links -->
<a name="TOP"><b>Up</b></a><b>:</b>
<a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis
&#149; <a href="#input">in</a>put &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#controls">co</a>ntrols &#149; <a href="#graphics">gr</a>aphics
&#149; <a href="#notes">no</a>tes &#149; <a href="#conventions">co</a>nventions
&#149; <a href="#options">op</a>tions
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.archinect.com/gallery/displayimage.php?pos=-4658"><img
src="normal_voronoi_knauss_oesterle.jpg" alt="[voronoi]" align="middle"
height="100"></a>qvoronoi -- Voronoi diagram</h1>
<p>The Voronoi diagram is the nearest-neighbor map for a set of
points. Each region contains those points that are nearer
one input site than any other input site. It has many useful properties and applications. See the
survey article by Aurenhammer [<a href="index.htm#aure91">'91</a>]
and the detailed introduction by O'Rourke [<a
href="index.htm#orou94">'94</a>]. The Voronoi diagram is the
dual of the <a href=qdelaun.htm>Delaunay triangulation</a>. </p>
<blockquote>
<dl>
<dt><b>Example:</b> rbox 10 D3 | qvoronoi <a href="qh-opto.htm#s">s</a>
<a href="qh-opto.htm#o">o</a> <a href="qh-optt.htm#TO">TO
result</a></dt>
<dd>Compute the 3-d Voronoi diagram of 10 random points. Write a
summary to the console and the Voronoi vertices and
regions to 'result'. The first vertex of the result
indicates unbounded regions.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox r y c G0.1 D2 | qvoronoi
<a href="qh-opto.htm#s">s</a>
<a href="qh-opto.htm#o">o</a> <a href="qh-optt.htm#TO">TO
result</a></dt>
<dd>Compute the 2-d Voronoi diagram of a triangle and a small
square. Write a
summary to the console and Voronoi vertices and regions
to 'result'. Report a single Voronoi vertex for
cocircular input sites. The first vertex of the result
indicates unbounded regions. The origin is the Voronoi
vertex for the square.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox r y c G0.1 D2 | qvoronoi <a href="qh-optf.htm#Fv2">Fv</a>
<a href="qh-optt.htm#TO">TO result</a></dt>
<dd>Compute the 2-d Voronoi diagram of a triangle and a small
square. Write a
summary to the console and the Voronoi ridges to
'result'. Each ridge is the perpendicular bisector of a
pair of input sites. Vertex &quot;0&quot; indicates
unbounded ridges. Vertex &quot;8&quot; is the Voronoi
vertex for the square.</dd>
<dt>&nbsp;</dt>
<dt><b>Example:</b> rbox r y c G0.1 D2 | qvoronoi <a href="qh-optf.htm#Fi2">Fi</a></dt>
<dd>Print the bounded, separating hyperplanes for the 2-d Voronoi diagram of a
triangle and a small
square. Note the four hyperplanes (i.e., lines) for Voronoi vertex
&quot;8&quot;. It is at the origin.
</dd>
</dl>
</blockquote>
<p>Qhull computes the Voronoi diagram via the <a href="qdelaun.htm">Delaunay
triangulation</a>. Each Voronoi
vertex is the circumcenter of a facet of the Delaunay
triangulation. Each Voronoi region corresponds to a vertex (i.e., input site) of the
Delaunay triangulation. </p>
<p>Qhull outputs the Voronoi vertices for each Voronoi region. With
option '<a href="qh-optf.htm#Fv2">Fv</a>',
it lists all ridges of the Voronoi diagram with the corresponding
pairs of input sites. With
options '<a href="qh-optf.htm#Fi2">Fi</a>' and '<a href="qh-optf.htm#Fo2">Fo</a>',
it lists the bounded and unbounded separating hyperplanes.
You can also output a single Voronoi region
for further processing [see <a href="#graphics">graphics</a>].</p>
<p>Use option '<a href="qh-optq.htm#Qz">Qz</a>' if the input is circular, cospherical, or
nearly so. It improves precision by adding a point "at infinity," above the corresponding paraboloid.
<p>See <a href="http://www.qhull.org/html/qh-faq.htm#TOC">Qhull FAQ</a> - Delaunay and
Voronoi diagram questions.</p>
<p>The 'qvonoroi' program is equivalent to
'<a href=qhull.htm#outputs>qhull v</a> <a href=qh-optq.htm#Qbb>Qbb</a>' in 2-d to 3-d, and
'<a href=qhull.htm#outputs>qhull v</a> <a href=qh-optq.htm#Qbb>Qbb</a> <a href=qh-optq.htm#Qx>Qx</a>'
in 4-d and higher. It disables the following Qhull
<a href=qh-quick.htm#options>options</a>: <i>d n v Qbb QbB Qf Qg Qm
Qr QR Qv Qx Qz TR E V Fa FA FC FD FS Ft FV Gt Q0,etc</i>.
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<p>Voronoi image by KOOK Architecture, Silvan Oesterle and Michael Knauss.
<hr>
<h3><a href="#TOP">&#187;</a><a name="synopsis">qvoronoi synopsis</a></h3>
<pre>
qvoronoi- compute the Voronoi diagram.
input (stdin): dimension, number of points, point coordinates
comments start with a non-numeric character
options (qh-voron.htm):
Qu - compute furthest-site Voronoi diagram
Tv - verify result: structure, convexity, and in-circle test
. - concise list of all options
- - one-line description of all options
output options (subset):
s - summary of results (default)
p - Voronoi vertices
o - OFF file format (dim, Voronoi vertices, and Voronoi regions)
FN - count and Voronoi vertices for each Voronoi region
Fv - Voronoi diagram as Voronoi vertices between adjacent input sites
Fi - separating hyperplanes for bounded regions, 'Fo' for unbounded
G - Geomview output (2-d only)
QVn - Voronoi vertices for input point n, -n if not
TO file- output results to file, may be enclosed in single quotes
examples:
rbox c P0 D2 | qvoronoi s o rbox c P0 D2 | qvoronoi Fi
rbox c P0 D2 | qvoronoi Fo rbox c P0 D2 | qvoronoi Fv
rbox c P0 D2 | qvoronoi s Qu Fv rbox c P0 D2 | qvoronoi Qu Fo
rbox c G1 d D2 | qvoronoi s p rbox c P0 D2 | qvoronoi s Fv QV0
</pre>
<h3><a href="#TOP">&#187;</a><a name="input">qvoronoi input</a></h3>
<blockquote>
The input data on <tt>stdin</tt> consists of:
<ul>
<li>dimension
<li>number of points</li>
<li>point coordinates</li>
</ul>
<p>Use I/O redirection (e.g., qvoronoi &lt; data.txt), a pipe (e.g., rbox 10 | qvoronoi),
or the '<a href=qh-optt.htm#TI>TI</a>' option (e.g., qvoronoi TI data.txt).
<p>For example, this is four cocircular points inside a square. Their Voronoi
diagram has nine vertices and eight regions. Notice the Voronoi vertex
at the origin, and the Voronoi vertices (on each axis) for the four
sides of the square.
<p>
<blockquote>
<tt>rbox s 4 W0 c G1 D2 &gt; data</tt>
<blockquote><pre>
2 RBOX s 4 W0 c D2
8
-0.4941988586954018 -0.07594397977563715
-0.06448037284989526 0.4958248496365813
0.4911154367094632 0.09383830681375946
-0.348353580869097 -0.3586778257652367
-1 -1
-1 1
1 -1
1 1
</pre></blockquote>
<p><tt>qvoronoi s p &lt; data</tt>
<blockquote><pre>
Voronoi diagram by the convex hull of 8 points in 3-d:
Number of Voronoi regions: 8
Number of Voronoi vertices: 9
Number of non-simplicial Voronoi vertices: 1
Statistics for: RBOX s 4 W0 c D2 | QVORONOI s p
Number of points processed: 8
Number of hyperplanes created: 18
Number of facets in hull: 10
Number of distance tests for qhull: 33
Number of merged facets: 2
Number of distance tests for merging: 102
CPU seconds to compute hull (after input): 0.094
2
9
4.217546450968612e-17 1.735507986399734
-8.402566836762659e-17 -1.364368854147395
0.3447488772716865 -0.6395484723719818
1.719446929853986 2.136555906154247e-17
0.4967882915039657 0.68662371396699
-1.729928876283549 1.343733067524222e-17
-0.8906163241424728 -0.4594150543829102
-0.6656840313875723 0.5003013793414868
-7.318364664277155e-19 -1.188217818408333e-16
</pre></blockquote>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a> <a name="outputs">qvoronoi
outputs</a></h3>
<blockquote>
<p>These options control the output of Voronoi diagrams.</p>
<blockquote>
<dl compact>
<dt>&nbsp;</dt>
<dd><b>Voronoi vertices</b></dd>
<dt><a href="qh-opto.htm#p">p</a></dt>
<dd>print the coordinates of the Voronoi vertices. The first line
is the dimension. The second line is the number of vertices. Each
remaining line is a Voronoi vertex.</dd>
<dt><a href="qh-optf.htm#Fn">Fn</a></dt>
<dd>list the neighboring Voronoi vertices for each Voronoi
vertex. The first line is the number of Voronoi vertices. Each
remaining line starts with the number of neighboring vertices.
Negative vertices (e.g., <em>-1</em>) indicate vertices
outside of the Voronoi diagram.
In the circle-in-box example, the
Voronoi vertex at the origin has four neighbors.</dd>
<dt><a href="qh-optf.htm#FN">FN</a></dt>
<dd>list the Voronoi vertices for each Voronoi region. The first line is
the number of Voronoi regions. Each remaining line starts with the
number of Voronoi vertices. Negative indices (e.g., <em>-1</em>) indicate vertices
outside of the Voronoi diagram.
In the circle-in-box example, the four bounded regions are defined by four
Voronoi vertices.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Voronoi regions</b></dd>
<dt><a href="qh-opto.htm#o">o</a></dt>
<dd>print the Voronoi regions in OFF format. The first line is the
dimension. The second line is the number of vertices, the number
of input sites, and "1". The third line represents the vertex-at-infinity.
Its coordinates are "-10.101". The next lines are the coordinates
of the Voronoi vertices. Each remaining line starts with the number
of Voronoi vertices in a Voronoi region. In 2-d, the vertices are
listed in adjacency order (unoriented). In 3-d and higher, the
vertices are listed in numeric order. In the circle-in-square
example, each bounded region includes the Voronoi vertex at
the origin. Lines consisting of <em>0</em> indicate
coplanar input sites or '<a href="qh-optq.htm#Qz">Qz</a>'. </dd>
<dt><a href="qh-optf.htm#Fi2">Fi</a></dt>
<dd>print separating hyperplanes for inner, bounded Voronoi
regions. The first number is the number of separating
hyperplanes. Each remaining line starts with <i>3+dim</i>. The
next two numbers are adjacent input sites. The next <i>dim</i>
numbers are the coefficients of the separating hyperplane. The
last number is its offset. Use '<a href="qh-optt.htm#Tv">Tv</a>' to verify that the
hyperplanes are perpendicular bisectors. It will list relevant
statistics to stderr. </dd>
<dt><a href="qh-optf.htm#Fo2">Fo</a></dt>
<dd>print separating hyperplanes for outer, unbounded Voronoi
regions. The first number is the number of separating
hyperplanes. Each remaining line starts with <i>3+dim</i>. The
next two numbers are adjacent input sites on the convex hull. The
next <i>dim</i>
numbers are the coefficients of the separating hyperplane. The
last number is its offset. Use '<a href="qh-optt.htm#Tv">Tv</a>' to verify that the
hyperplanes are perpendicular bisectors. It will list relevant
statistics to stderr,</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>Input sites</b></dd>
<dt><a href="qh-optf.htm#Fv2">Fv</a></dt>
<dd>list ridges of Voronoi vertices for pairs of input sites. The
first line is the number of ridges. Each remaining line starts with
two plus the number of Voronoi vertices in the ridge. The next
two numbers are two adjacent input sites. The remaining numbers list
the Voronoi vertices. As with option 'o', a <em>0</em> indicates
the vertex-at-infinity
and an unbounded, separating hyperplane.
The perpendicular bisector (separating hyperplane)
of the input sites is a flat through these vertices.
In the circle-in-square example, the ridge for each edge of the square
is unbounded.</dd>
<dt><a href="qh-optf.htm#Fc">Fc</a></dt>
<dd>list coincident input sites for each Voronoi vertex.
The first line is the number of vertices. The remaining lines start with
the number of coincident sites and deleted vertices. Deleted vertices
indicate highly degenerate input (see'<a href="qh-optf.htm#Fs">Fs</a>').
A coincident site is assigned to one Voronoi
vertex. Do not use '<a href="qh-optq.htm#QJn">QJ</a>' with 'Fc'; the joggle will separate
coincident sites.</dd>
<dt><a href="qh-optf.htm#FP">FP</a></dt>
<dd>print coincident input sites with distance to
nearest site (i.e., vertex). The first line is the
number of coincident sites. Each remaining line starts with the point ID of
an input site, followed by the point ID of a coincident point, its vertex, and distance.
Includes deleted vertices which
indicate highly degenerate input (see'<a href="qh-optf.htm#Fs">Fs</a>').
Do not use '<a href="qh-optq.htm#QJn">QJ</a>' with 'FP'; the joggle will separate
coincident sites.</dd>
<dt>&nbsp;</dt>
<dt>&nbsp;</dt>
<dd><b>General</b></dd>
<dt><a href="qh-opto.htm#s">s</a></dt>
<dd>print summary of the Voronoi diagram. Use '<a
href="qh-optf.htm#Fs">Fs</a>' for numeric data.</dd>
<dt><a href="qh-opto.htm#i">i</a></dt>
<dd>list input sites for each <a href=qdelaun.htm>Delaunay region</a>. Use option '<a href="qh-optp.htm#Pp">Pp</a>'
to avoid the warning. The first line is the number of regions. The
remaining lines list the input sites for each region. The regions are
oriented. In the circle-in-square example, the cocircular region has four
edges. In 3-d and higher, report cospherical sites by adding extra points.
</dd>
<dt><a href="qh-optg.htm#G">G</a></dt>
<dd>Geomview output for 2-d Voronoi diagrams.</dd>
</dl>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a> <a name="controls">qvoronoi
controls</a></h3>
<blockquote>
<p>These options provide additional control:</p>
<blockquote>
<dl compact>
<dt><a href="qh-optq.htm#Qu">Qu</a></dt>
<dd>compute the <a href="qvoron_f.htm">furthest-site Voronoi diagram</a>.</dd>
<dt><a href="qh-optq.htm#QVn">QVn</a></dt>
<dd>select Voronoi vertices for input site <em>n</em> </dd>
<dt><a href="qh-optq.htm#Qz">Qz</a></dt>
<dd>add a point above the paraboloid to reduce precision
errors. Use it for nearly cocircular/cospherical input
(e.g., 'rbox c | qvoronoi Qz').</dd>
<dt><a href="qh-optt.htm#Tv">Tv</a></dt>
<dd>verify result</dd>
<dt><a href="qh-optt.htm#TO">TI file</a></dt>
<dd>input data from file. The filename may not use spaces or quotes.</dd>
<dt><a href="qh-optt.htm#TO">TO file</a></dt>
<dd>output results to file. Use single quotes if the filename
contains spaces (e.g., <tt>TO 'file with spaces.txt'</tt></dd>
<dt><a href="qh-optt.htm#TFn">TFn</a></dt>
<dd>report progress after constructing <em>n</em> facets</dd>
<dt><a href="qh-optp.htm#PDk">PDk:1</a></dt>
<dd>include upper and lower facets in the output. Set <em>k</em>
to the last dimension (e.g., 'PD2:1' for 2-d inputs). </dd>
<dt><a href="qh-opto.htm#f">f </a></dt>
<dd>facet dump. Print the data structure for each facet (i.e.,
Voronoi vertex).</dd>
</dl>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a> <a name="graphics">qvoronoi
graphics</a></h3>
<blockquote>
<p>In 2-d, Geomview output ('<a href="qh-optg.htm#G">G</a>')
displays a Voronoi diagram with extra edges to close the
unbounded Voronoi regions. To view the unbounded rays, enclose
the input points in a square.</p>
<p>You can also view <i>individual</i> Voronoi regions in 3-d. To
view the Voronoi region for site 3 in Geomview, execute</p>
<blockquote>
<p>qvoronoi &lt;data <a href="qh-optq.htm#QVn">QV3</a> <a
href="qh-opto.htm#p">p</a> | qconvex s G &gt;output</p>
</blockquote>
<p>The <tt>qvoronoi</tt> command returns the Voronoi vertices
for input site 3. The <tt>qconvex</tt> command computes their convex hull.
This is the Voronoi region for input site 3. Its
hyperplane normals (qconvex 'n') are the same as the separating hyperplanes
from options '<a href="qh-optf.htm#Fi">Fi</a>'
and '<a href="qh-optf.htm#Fo">Fo</a>' (up to roundoff error).
<p>See the <a href="qh-eg.htm#delaunay">Delaunay and Voronoi
examples</a> for 2-d and 3-d examples. Turn off normalization (on
Geomview's 'obscure' menu) when comparing the Voronoi diagram
with the corresponding Delaunay triangulation. </p>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="notes">qvoronoi
notes</a></h3>
<blockquote>
<p>You can simplify the Voronoi diagram by enclosing the input
sites in a large square or cube. This is particularly recommended
for cocircular or cospherical input data.</p>
<p>See <a href="#graphics">Voronoi graphics</a> for computing
the convex hull of a Voronoi region. </p>
<p>Voronoi diagrams do not include facets that are
coplanar with the convex hull of the input sites. A facet is
coplanar if the last coefficient of its normal is
nearly zero (see <a href="../src/user.h#ZEROdelaunay">qh_ZEROdelaunay</a>).
<p>Unbounded regions can be confusing. For example, '<tt>rbox c |
qvoronoi Qz o</tt>' produces the Voronoi regions for the vertices
of a cube centered at the origin. All regions are unbounded. The
output is </p>
<blockquote>
<pre>3
2 9 1
-10.101 -10.101 -10.101
0 0 0
2 0 1
2 0 1
2 0 1
2 0 1
2 0 1
2 0 1
2 0 1
2 0 1
0
</pre>
</blockquote>
<p>The first line is the dimension. The second line is the number
of vertices and the number of regions. There is one region per
input point plus a region for the point-at-infinity added by
option '<a href="qh-optq.htm#Qz">Qz</a>'. The next two lines
lists the Voronoi vertices. The first vertex is the infinity
vertex. It is indicate by the coordinates <em>-10.101</em>. The
second vertex is the origin. The next nine lines list the
regions. Each region lists two vertices -- the infinity vertex
and the origin. The last line is &quot;0&quot; because no region
is associated with the point-at-infinity. A &quot;0&quot; would
also be listed for nearly incident input sites. </p>
<p>To use option '<a href="qh-optf.htm#Fv">Fv</a>', add an
interior point. For example, </p>
<blockquote>
<pre>
rbox c P0 | qvoronoi Fv
20
5 0 7 1 3 5
5 0 3 1 4 5
5 0 5 1 2 3
5 0 1 1 2 4
5 0 6 2 3 6
5 0 2 2 4 6
5 0 4 4 5 6
5 0 8 5 3 6
5 1 2 0 2 4
5 1 3 0 1 4
5 1 5 0 1 2
5 2 4 0 4 6
5 2 6 0 2 6
5 3 4 0 4 5
5 3 7 0 1 5
5 4 8 0 6 5
5 5 6 0 2 3
5 5 7 0 1 3
5 6 8 0 6 3
5 7 8 0 3 5
</pre>
</blockquote>
<p>The output consists of 20 ridges and each ridge lists a pair
of input sites and a triplet of Voronoi vertices. The first eight
ridges connect the origin ('P0'). The remainder list the edges of
the cube. Each edge generates an unbounded ray through the
midpoint. The corresponding separating planes ('Fo') follow each
pair of coordinate axes. </p>
<p>Options '<a href="qh-optq.htm#Qt">Qt</a>' (triangulated output)
and '<a href="qh-optq.htm#QJn">QJ</a>' (joggled input) are deprecated. They may produce
unexpected results. If you use these options, cocircular and cospherical input sites will
produce duplicate or nearly duplicate Voronoi vertices. See also <a
href="qh-impre.htm#joggle">Merged facets or joggled input</a>. </p>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="conventions">qvoronoi conventions</a></h3>
<blockquote>
<p>The following terminology is used for Voronoi diagrams in
Qhull. The underlying structure is a Delaunay triangulation from
a convex hull in one higher dimension. Facets of the Delaunay
triangulation correspond to vertices of the Voronoi diagram.
Vertices of the Delaunay triangulation correspond to input sites.
They also correspond to regions of the Voronoi diagram. See <a
href="qconvex.htm#conventions">convex hull conventions</a>, <a
href="qdelaun.htm#conventions">Delaunay conventions</a>, and
<a href="index.htm#structure">Qhull's data structures</a>.</p>
<blockquote>
<ul>
<li><em>input site</em> - a point in the input (one dimension
lower than a point on the convex hull)</li>
<li><em>point</em> - a point has <i>d+1</i> coordinates. The
last coordinate is the sum of the squares of the input
site's coordinates</li>
<li><em>coplanar point</em> - a <em>nearly incident</em>
input site</li>
<li><em>vertex</em> - a point on the paraboloid. It
corresponds to a unique input site. </li>
<li><em>point-at-infinity</em> - a point added above the
paraboloid by option '<a href="qh-optq.htm#Qz">Qz</a>'</li>
<li><em>Delaunay facet</em> - a lower facet of the
paraboloid. The last coefficient of its normal is
clearly negative.</li>
<li><em>Voronoi vertex</em> - the circumcenter of a Delaunay
facet</li>
<li><em>Voronoi region</em> - the Voronoi vertices for an
input site. The region of Euclidean space nearest to an
input site.</li>
<li><em>Voronoi diagram</em> - the graph of the Voronoi
regions. It includes the ridges (i.e., edges) between the
regions.</li>
<li><em>vertex-at-infinity</em> - the Voronoi vertex that
indicates unbounded Voronoi regions in '<a
href="qh-opto.htm#o">o</a>' output format. Its
coordinates are <em>-10.101</em>.</li>
<li><em>good facet</em> - a Voronoi vertex with optional
restrictions by '<a href="qh-optq.htm#QVn">QVn</a>', etc.</li>
</ul>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="options">qvoronoi options</a></h3>
<pre>
qvoronoi- compute the Voronoi diagram
http://www.qhull.org
input (stdin):
first lines: dimension and number of points (or vice-versa).
other lines: point coordinates, best if one point per line
comments: start with a non-numeric character
options:
Qu - compute furthest-site Voronoi diagram
Qhull control options:
QJn - randomly joggle input in range [-n,n]
Qs - search all points for the initial simplex
Qz - add point-at-infinity to Voronoi diagram
QGn - Voronoi vertices if visible from point n, -n if not
QVn - Voronoi vertices for input point n, -n if not
Trace options:
T4 - trace at level n, 4=all, 5=mem/gauss, -1= events
Tc - check frequently during execution
Ts - statistics
Tv - verify result: structure, convexity, and in-circle test
Tz - send all output to stdout
TFn - report summary when n or more facets created
TI file - input data from file, no spaces or single quotes
TO file - output results to file, may be enclosed in single quotes
TPn - turn on tracing when point n added to hull
TMn - turn on tracing at merge n
TWn - trace merge facets when width > n
TVn - stop qhull after adding point n, -n for before (see TCn)
TCn - stop qhull after building cone for point n (see TVn)
Precision options:
Cn - radius of centrum (roundoff added). Merge facets if non-convex
An - cosine of maximum angle. Merge facets if cosine > n or non-convex
C-0 roundoff, A-0.99/C-0.01 pre-merge, A0.99/C0.01 post-merge
Rn - randomly perturb computations by a factor of [1-n,1+n]
Wn - min facet width for non-coincident point (before roundoff)
Output formats (may be combined; if none, produces a summary to stdout):
s - summary to stderr
p - Voronoi vertices
o - OFF format (dim, Voronoi vertices, and Voronoi regions)
i - Delaunay regions (use 'Pp' to avoid warning)
f - facet dump
More formats:
Fc - count plus coincident points (by Voronoi vertex)
Fd - use cdd format for input (homogeneous with offset first)
FD - use cdd format for output (offset first)
FF - facet dump without ridges
Fi - separating hyperplanes for bounded Voronoi regions
FI - ID for each Voronoi vertex
Fm - merge count for each Voronoi vertex (511 max)
Fn - count plus neighboring Voronoi vertices for each Voronoi vertex
FN - count and Voronoi vertices for each Voronoi region
Fo - separating hyperplanes for unbounded Voronoi regions
FO - options and precision constants
FP - nearest point and distance for each coincident point
FQ - command used for qvoronoi
Fs - summary: #int (8), dimension, #points, tot vertices, tot facets,
for output: #Voronoi regions, #Voronoi vertices,
#coincident points, #non-simplicial regions
#real (2), max outer plane and min vertex
Fv - Voronoi diagram as Voronoi vertices between adjacent input sites
Fx - extreme points of Delaunay triangulation (on convex hull)
Geomview options (2-d only)
Ga - all points as dots
Gp - coplanar points and vertices as radii
Gv - vertices as spheres
Gi - inner planes only
Gn - no planes
Go - outer planes only
Gc - centrums
Gh - hyperplane intersections
Gr - ridges
GDn - drop dimension n in 3-d and 4-d output
Print options:
PAn - keep n largest Voronoi vertices by 'area'
Pdk:n - drop facet if normal[k] &lt;= n (default 0.0)
PDk:n - drop facet if normal[k] >= n
Pg - print good Voronoi vertices (needs 'QGn' or 'QVn')
PFn - keep Voronoi vertices whose 'area' is at least n
PG - print neighbors of good Voronoi vertices
PMn - keep n Voronoi vertices with most merges
Po - force output. If error, output neighborhood of facet
Pp - do not report precision problems
. - list of all options
- - one line descriptions of all options
</pre>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis
&#149; <a href="#input">in</a>put &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#controls">co</a>ntrols &#149; <a href="#graphics">gr</a>aphics
&#149; <a href="#notes">no</a>tes &#149; <a href="#conventions">co</a>nventions
&#149; <a href="#options">op</a>tions
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

277
xs/src/qhull/html/rbox.htm Normal file
View File

@ -0,0 +1,277 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>rbox -- generate point distributions</title>
</head>
<body>
<!-- Navigation links -->
<p><b><a name="TOP">Up:</a></b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#examples">ex</a>amples &#149; <a href="#notes">no</a>tes
&#149; <a href="#options">op</a>tions
<hr>
<!-- Main text of document -->
<h1><a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/cone.html"><img
src="qh--cone.gif" alt="[CONE]" align="middle" width="100"
height="100"></a>rbox -- generate point distributions</h1>
<blockquote>
rbox generates random or regular points according to the
options given, and outputs the points to stdout. The
points are generated in a cube, unless 's', 'x', or 'y'
are given.
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="synopsis">rbox synopsis</a></h3>
<pre>
rbox- generate various point distributions. Default is random in cube.
args (any order, space separated):
3000 number of random points in cube, lens, spiral, sphere or grid
D3 dimension 3-d
c add a unit cube to the output ('c G2.0' sets size)
d add a unit diamond to the output ('d G2.0' sets size)
l generate a regular 3-d spiral
r generate a regular polygon, ('r s Z1 G0.1' makes a cone)
s generate cospherical points
x generate random points in simplex, may use 'r' or 'Wn'
y same as 'x', plus simplex
Cn,r,m add n nearly coincident points within radius r of m points
Pn,m,r add point [n,m,r] first, pads with 0
Ln lens distribution of radius n. Also 's', 'r', 'G', 'W'.
Mn,m,r lattice (Mesh) rotated by [n,-m,0], [m,n,0], [0,0,r], ...
'27 M1,0,1' is {0,1,2} x {0,1,2} x {0,1,2}. Try 'M3,4 z'.
W0.1 random distribution within 0.1 of the cube's or sphere's surface
Z0.5 s random points in a 0.5 disk projected to a sphere
Z0.5 s G0.6 same as Z0.5 within a 0.6 gap
Bn bounding box coordinates, default 0.5
h output as homogeneous coordinates for cdd
n remove command line from the first line of output
On offset coordinates by n
t use time as the random number seed (default is command line)
tn use n as the random number seed
z print integer coordinates, default 'Bn' is 1e+06
</pre>
<h3><a href="#TOP">&#187;</a><a name="outputs">rbox outputs</a></h3>
<blockquote>
The format of the output is the following: first line contains
the dimension and a comment, second line contains the
number of points, and the following lines contain the points,
one point per line. Points are represented by their coordinate values.
<p>For example, <tt>rbox c 10 D2</tt> generates
<blockquote>
<pre>
2 RBOX c 10 D2
14
-0.4999921736307369 -0.3684622117955817
0.2556053225468894 -0.0413498678629751
0.0327672376602583 -0.2810408135699488
-0.452955383763607 0.17886471718444
0.1792964061529342 0.4346928963760779
-0.1164979223315585 0.01941637230982666
0.3309653464993139 -0.4654278894564396
-0.4465383649305798 0.02970019358182344
0.1711493843897706 -0.4923018137852678
-0.1165843490665633 -0.433157762450313
-0.5 -0.5
-0.5 0.5
0.5 -0.5
0.5 0.5
</pre>
</blockquote>
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="examples">rbox examples</a></h3>
<pre>
rbox 10
10 random points in the unit cube centered at the
origin.
rbox 10 s D2
10 random points on a 2-d circle.
rbox 100 W0
100 random points on the surface of a cube.
rbox 1000 s D4
1000 random points on a 4-d sphere.
rbox c D5 O0.5
a 5-d hypercube with one corner at the origin.
rbox d D10
a 10-d diamond.
rbox x 1000 r W0
100 random points on the surface of a fixed simplex
rbox y D12
a 12-d simplex.
rbox l 10
10 random points along a spiral
rbox l 10 r
10 regular points along a spiral plus two end
points
rbox 1000 L10000 D4 s
1000 random points on the surface of a narrow lens.
rbox 1000 L100000 s G1e-6
1000 random points near the edge of a narrow lens
rbox c G2 d G3
a cube with coordinates +2/-2 and a diamond with
coordinates +3/-3.
rbox 64 M3,4 z
a rotated, {0,1,2,3} x {0,1,2,3} x {0,1,2,3} lat-
tice (Mesh) of integer points.
rbox P0 P0 P0 P0 P0
5 copies of the origin in 3-d. Try 'rbox P0 P0 P0
P0 P0 | qhull QJ'.
r 100 s Z1 G0.1
two cospherical 100-gons plus another cospherical
point.
100 s Z1
a cone of points.
100 s Z1e-7
a narrow cone of points with many precision errors.
</pre>
<h3><a href="#TOP">&#187;</a><a name="notes">rbox notes</a></h3>
<blockquote>
Some combinations of arguments generate odd results.
</blockquote>
<h3><a href="#TOP">&#187;</a><a name="options">rbox options</a></h3>
<pre>
n number of points
Dn dimension n-d (default 3-d)
Bn bounding box coordinates (default 0.5)
l spiral distribution, available only in 3-d
Ln lens distribution of radius n. May be used with
's', 'r', 'G', and 'W'.
Mn,m,r lattice (Mesh) rotated by {[n,-m,0], [m,n,0],
[0,0,r], ...}. Use 'Mm,n' for a rigid rotation
with r = sqrt(n^2+m^2). 'M1,0' is an orthogonal
lattice. For example, '27 M1,0' is {0,1,2} x
{0,1,2} x {0,1,2}.
s cospherical points randomly generated in a cube and
projected to the unit sphere
x simplicial distribution. It is fixed for option
'r'. May be used with 'W'.
y simplicial distribution plus a simplex. Both 'x'
and 'y' generate the same points.
Wn restrict points to distance n of the surface of a
sphere or a cube
c add a unit cube to the output
c Gm add a cube with all combinations of +m and -m to
the output
d add a unit diamond to the output.
d Gm add a diamond made of 0, +m and -m to the output
Cn,r,m add n nearly coincident points within radius r of m points
Pn,m,r add point [n,m,r] to the output first. Pad coordi-
nates with 0.0.
n Remove the command line from the first line of out-
put.
On offset the data by adding n to each coordinate.
t use time in seconds as the random number seed
(default is command line).
tn set the random number seed to n.
z generate integer coordinates. Use 'Bn' to change
the range. The default is 'B1e6' for six-digit
coordinates. In R^4, seven-digit coordinates will
overflow hyperplane normalization.
Zn s restrict points to a disk about the z+ axis and the
sphere (default Z1.0). Includes the opposite pole.
'Z1e-6' generates degenerate points under single
precision.
Zn Gm s
same as Zn with an empty center (default G0.5).
r s D2 generate a regular polygon
r s Z1 G0.1
generate a regular cone
</pre>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual</a>: Table of Contents<br>
<b>To:</b> <a href="qh-quick.htm#programs">Programs</a>
&#149; <a href="qh-quick.htm#options">Options</a>
&#149; <a href="qh-opto.htm#output">Output</a>
&#149; <a href="qh-optf.htm#format">Formats</a>
&#149; <a href="qh-optg.htm#geomview">Geomview</a>
&#149; <a href="qh-optp.htm#print">Print</a>
&#149; <a href="qh-optq.htm#qhull">Qhull</a>
&#149; <a href="qh-optc.htm#prec">Precision</a>
&#149; <a href="qh-optt.htm#trace">Trace</a>
&#149; <a href="../src/libqhull_r/index.htm">Functions</a><br>
<b>To:</b> <a href="#synopsis">sy</a>nopsis &#149; <a href="#outputs">ou</a>tputs
&#149; <a href="#examples">ex</a>amples &#149; <a href="#notes">no</a>tes
&#149; <a href="#options">op</a>tions
<!-- GC common information -->
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="qh--geom.gif"
align="middle" width="40" height="40"></a><i>The Geometry Center
Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
<br>
Created: Sept. 25, 1995 --- <!-- hhmts start --> Last modified: August 12, 1998 <!-- hhmts end --> </p>
</body>
</html>

176
xs/src/qhull/html/rbox.man Normal file
View File

@ -0,0 +1,176 @@
.\" This is the Unix manual page for rbox, written in nroff, the standard
.\" manual formatter for Unix systems. To format it, type
.\"
.\" nroff -man rbox.man
.\"
.\" This will print a formatted copy to standard output. If you want
.\" to ensure that the output is plain ascii, free of any control
.\" characters that nroff uses for underlining etc, pipe the output
.\" through "col -b":
.\"
.\" nroff -man rbox.man | col -b
.\"
.TH rbox 1 "August 10, 1998" "Geometry Center"
.SH NAME
rbox \- generate point distributions for qhull
.SH SYNOPSIS
Command "rbox" (w/o arguments) lists the options.
.SH DESCRIPTION
.PP
rbox generates random or regular points according to the options given, and
outputs
the points to stdout. The points are generated in a cube, unless 's' or 'k'
option is
given. The format of the output is the following: first line
contains the dimension and a comment,
second line contains the number of points, and the
following lines contain the points, one point per line. Points are represented
by their coordinate values.
.SH EXAMPLES
.TP
rbox 10
10 random points in the unit cube centered at the origin.
.TP
rbox 10 s D2
10 random points on a 2\[hy]d circle.
.TP
rbox 100 W0
100 random points on the surface of a cube.
.TP
rbox 1000 s D4
1000 random points on a 4\[hy]d sphere.
.TP
rbox c D5 O0.5
a 5\[hy]d hypercube with one corner at the origin.
.TP
rbox d D10
a 10\[hy]d diamond.
.TP
rbox x 1000 r W0
100 random points on the surface of a fixed simplex
.TP
rbox y D12
a 12\[hy]d simplex.
.TP
rbox l 10
10 random points along a spiral
.TP
rbox l 10 r
10 regular points along a spiral plus two end points
.TP
rbox 1000 L10000 D4 s
1000 random points on the surface of a narrow lens.
.TP
rbox c G2 d G3
a cube with coordinates +2/\-2 and a diamond with coordinates +3/\-3.
.TP
rbox 64 M3,4 z
a rotated, {0,1,2,3} x {0,1,2,3} x {0,1,2,3} lattice (Mesh) of integer
points. 'rbox 64 M1,0' is orthogonal.
.TP
rbox P0 P0 P0 P0 P0
5 copies of the origin in 3\-d. Try 'rbox P0 P0 P0 P0 P0 | qhull QJ'.
.TP
r 100 s Z1 G0.1
two cospherical 100\-gons plus another cospherical point.
.TP
100 s Z1
a cone of points.
.TP
100 s Z1e\-7
a narrow cone of points with many precision errors.
.SH OPTIONS
.TP
n
number of points
.TP
Dn
dimension n\[hy]d (default 3\[hy]d)
.TP
Bn
bounding box coordinates (default 0.5)
.TP
l
spiral distribution, available only in 3\[hy]d
.TP
Ln
lens distribution of radius n. May be used with 's', 'r', 'G', and 'W'.
.TP
Mn,m,r
lattice (Mesh) rotated by {[n,\-m,0], [m,n,0], [0,0,r], ...}.
Use 'Mm,n' for a rigid rotation with r = sqrt(n^2+m^2). 'M1,0' is an
orthogonal lattice. For example, '27 M1,0' is {0,1,2} x {0,1,2} x
{0,1,2}. '27 M3,4 z' is a rotated integer lattice.
.TP
s
cospherical points randomly generated in a cube and projected to the unit sphere
.TP
x
simplicial distribution. It is fixed for option 'r'. May be used with 'W'.
.TP
y
simplicial distribution plus a simplex. Both 'x' and 'y' generate the same points.
.TP
Wn
restrict points to distance n of the surface of a sphere or a cube
.TP
c
add a unit cube to the output
.TP
c Gm
add a cube with all combinations of +m and \-m to the output
.TP
d
add a unit diamond to the output.
.TP
d Gm
add a diamond made of 0, +m and \-m to the output
.TP
Cn,r,m
add n nearly coincident points within radius r of m points
.TP
Pn,m,r
add point [n,m,r] to the output first. Pad coordinates with 0.0.
.TP
n
Remove the command line from the first line of output.
.TP
On
offset the data by adding n to each coordinate.
.TP
t
use time in seconds as the random number seed (default is command line).
.TP
tn
set the random number seed to n.
.TP
z
generate integer coordinates. Use 'Bn' to change the range.
The default is 'B1e6' for six\[hy]digit coordinates. In R^4, seven\[hy]digit
coordinates will overflow hyperplane normalization.
.TP
Zn s
restrict points to a disk about the z+ axis and the sphere (default Z1.0).
Includes the opposite pole. 'Z1e\-6' generates degenerate points under
single precision.
.TP
Zn Gm s
same as Zn with an empty center (default G0.5).
.TP
r s D2
generate a regular polygon
.TP
r s Z1 G0.1
generate a regular cone
.SH BUGS
Some combinations of arguments generate odd results.
Report bugs to qhull_bug@qhull.org, other correspondence to qhull@qhull.org
.SH SEE ALSO
qhull(1)
.SH AUTHOR
.nf
C. Bradford Barber
bradb@shore.net
.fi

195
xs/src/qhull/html/rbox.txt Normal file
View File

@ -0,0 +1,195 @@
rbox(1) rbox(1)
NAME
rbox - generate point distributions for qhull
SYNOPSIS
Command "rbox" (w/o arguments) lists the options.
DESCRIPTION
rbox generates random or regular points according to the
options given, and outputs the points to stdout. The
points are generated in a cube, unless 's' or given. The
format of the output is the following: first line contains
the dimension and a comment, second line contains the num-
ber of points, and the following lines contain the points,
one point per line. Points are represented by their coor-
dinate values.
EXAMPLES
rbox 10
10 random points in the unit cube centered at the
origin.
rbox 10 s D2
10 random points on a 2-d circle.
rbox 100 W0
100 random points on the surface of a cube.
rbox 1000 s D4
1000 random points on a 4-d sphere.
rbox c D5 O0.5
a 5-d hypercube with one corner at the origin.
rbox d D10
a 10-d diamond.
rbox x 1000 r W0
100 random points on the surface of a fixed simplex
rbox y D12
a 12-d simplex.
rbox l 10
10 random points along a spiral
rbox l 10 r
10 regular points along a spiral plus two end
points
rbox 1000 L10000 D4 s
1000 random points on the surface of a narrow lens.
rbox c G2 d G3
a cube with coordinates +2/-2 and a diamond with
Geometry Center August 10, 1998 1
rbox(1) rbox(1)
coordinates +3/-3.
rbox 64 M3,4 z
a rotated, {0,1,2,3} x {0,1,2,3} x {0,1,2,3} lat-
tice (Mesh) of integer points.
rbox P0 P0 P0 P0 P0
5 copies of the origin in 3-d. Try 'rbox P0 P0 P0
P0 P0 | qhull QJ'.
r 100 s Z1 G0.1
two cospherical 100-gons plus another cospherical
point.
100 s Z1
a cone of points.
100 s Z1e-7
a narrow cone of points with many precision errors.
OPTIONS
n number of points
Dn dimension n-d (default 3-d)
Bn bounding box coordinates (default 0.5)
l spiral distribution, available only in 3-d
Ln lens distribution of radius n. May be used with
's', 'r', 'G', and 'W'.
Mn,m,r lattice (Mesh) rotated by {[n,-m,0], [m,n,0],
[0,0,r], ...}. Use 'Mm,n' for a rigid rotation
with r = sqrt(n^2+m^2). 'M1,0' is an orthogonal
lattice. For example, '27 M1,0' is {0,1,2} x
{0,1,2} x {0,1,2}.
s cospherical points randomly generated in a cube and
projected to the unit sphere
x simplicial distribution. It is fixed for option
'r'. May be used with 'W'.
y simplicial distribution plus a simplex. Both 'x'
and 'y' generate the same points.
Wn restrict points to distance n of the surface of a
sphere or a cube
c add a unit cube to the output
c Gm add a cube with all combinations of +m and -m to
the output
Geometry Center August 10, 1998 2
rbox(1) rbox(1)
d add a unit diamond to the output.
d Gm add a diamond made of 0, +m and -m to the output
Cn,r,m add n nearly coincident points within radius r of m points
Pn,m,r add point [n,m,r] to the output first. Pad coordi-
nates with 0.0.
n Remove the command line from the first line of out-
put.
On offset the data by adding n to each coordinate.
t use time in seconds as the random number seed
(default is command line).
tn set the random number seed to n.
z generate integer coordinates. Use 'Bn' to change
the range. The default is 'B1e6' for six-digit
coordinates. In R^4, seven-digit coordinates will
overflow hyperplane normalization.
Zn s restrict points to a disk about the z+ axis and the
sphere (default Z1.0). Includes the opposite pole.
'Z1e-6' generates degenerate points under single
precision.
Zn Gm s
same as Zn with an empty center (default G0.5).
r s D2 generate a regular polygon
r s Z1 G0.1
generate a regular cone
BUGS
Some combinations of arguments generate odd results.
Report bugs to qhull_bug@qhull.org, other correspon-
dence to qhull@qhull.org
SEE ALSO
qhull(1)
AUTHOR
C. Bradford Barber
bradb@shore.net
Geometry Center August 10, 1998 3

284
xs/src/qhull/index.htm Normal file
View File

@ -0,0 +1,284 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Qhull code for Convex Hull, Delaunay Triangulation, Voronoi Diagram, and Halfspace Intersection about a Point</title>
</head>
<body>
<!-- Navigation links -->
<b>URL:</b> <a href="http://www.qhull.org">http://www.qhull.org</a>
<br><b>To:</b>
<a href="http://www.qhull.org/news">News</a>
&#149; <a href="http://www.qhull.org/download">Download</a>
&#149; <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.117.405">CiteSeer</a>
&#149; <a href=http://images.google.com/images?q=qhull&num=100>Images</a>
&#149; <a href="html/index.htm#TOC">Manual</a>
&#149; <a href="http://www.qhull.org/html/qh-faq.htm">FAQ</a>
&#149; <a href="html/qh-quick.htm#programs">Programs</a>
&#149; <a href="html/qh-quick.htm#options">Options</a>
</p>
<hr>
<!-- Main text of document -->
<table>
<tr><td valign=top>
<h1>Qhull</h1>
<a
href="http://www.geom.uiuc.edu/graphics/pix/Special_Topics/Computational_Geometry/cone.html"><img
src="html/qh--cone.gif" alt="[CONE]" align="middle" width="100"
height="100"></a>
</td><td>
Qhull computes the convex hull, Delaunay triangulation, Voronoi diagram,
halfspace intersection about a point, furthest-site Delaunay
triangulation, and furthest-site Voronoi diagram. The source code runs in
2-d, 3-d, 4-d, and higher dimensions. Qhull implements the Quickhull
algorithm for computing the convex hull. It handles roundoff
errors from floating point arithmetic. It computes volumes,
surface areas, and approximations to the convex hull.</p>
<!-- duplicated in index.htm and html/index.htm -->
<p>Qhull does <i>not</i> support triangulation of non-convex surfaces, mesh
generation of non-convex objects, medium-sized inputs in 9-D
and higher, alpha shapes, weighted Voronoi diagrams, Voronoi volumes, or
constrained Delaunay triangulations, </p>
<p>Qhull 2015.2 introduces reentrant Qhull. It allows concurrent Qhull runs and simplifies the C++ interface to Qhull.
If you call Qhull from your program, you should use reentrant Qhull (libqhull_r) instead of qh_QHpointer (libqhull).
If you use Qhull 2003.1. please upgrade or apply <a href="http://www.qhull.org/download/poly.c-qh_gethash.patch">poly.c-qh_gethash.patch</a>.
</p>
</td></tr></table>
<hr>
<form method=get action=http://www.google.com/search>
<input type=hidden name=sitesearch value=www.qhull.org>
<input type=hidden name=num value=100>
<ul>
<li><a href="http://www.qhull.org/news">News</a> and
<a href="http://www.qhull.org/news/qhull-news.html#bugs">Bugs</a>
about Qhull 2015.2 2016/01/18</li>
<li><a href="http://www.qhull.org/download">Download</a> Qhull (<a href="http://www.qhull.org/src/Changes.txt">changes</a>)</li>
<li><a href=http://github.com/qhull/qhull/wiki>GitHub</a> C++ interface to Qhull
<li><a href="html/index.htm">Manual</a> for Qhull and rbox
<li><a href="html/index.htm#geomview">Geomview</a> for 3-D and 4-D visualization of Qhull output
<li><input name=as_q size=10 value="">
<input type="submit" value="Search">
www.qhull.org
<p>
<li><a href="http://www.qhull.org/news/qhull-news.html#users">How</a> is Qhull used?</li>
<li><a href="http://scholar.google.com/scholar?cites=13151392091060773178&as_sdt=40000005">Google Scholar</a>,
<a href="http://libra.msra.cn/Publication/232063/the-quickhull-algorithm-for-convex-hulls">Microsoft Academic</a>,
and <a href="http://citeseerx.ist.psu.edu/showciting?doi=10.1.1.117.405&sort=cite">CiteSeer</a>
references to Qhull
<li>
<a href=http://www.google.com/search?as_q=qhull+-debian+-cvs+-gentoo+-pool+-mirrors&num=100>Google</a> Qhull,
<a href="http://images.google.com/images?q=qhull&num=100">Images</a>,
<a href="http://www.google.com/#q=qhull&tbm=bks">Books</a>,
<a href="http://www.google.com/search?q=qhull&tbm=pts">Patents</a>,
<a href="http://groups.google.com/groups?as_q=qhull&num=100&as_scoring=d">Newsgroups</a>,
<a href="http://www.google.com/search?q=qhull&tbm=blg">Blogs</a>,
and <a href=http://www.googlism.com/who_is/q/qhull/>Who is</a> Qhull?
<p>
<li><a href=http://www.mathworks.com/>MATLAB</a> uses Qhull for their n-d computational geometry functions:
<a href=http://www.mathworks.com/help/techdoc/ref/convhulln.html>convhulln</a>
<a href=http://www.mathworks.com/help/techdoc/ref/delaunayn.html>delaunayn</a>
<a href=http://www.mathworks.com/help/techdoc/ref/griddatan.html>griddatan</a>
<a href=http://www.mathworks.com/help/techdoc/ref/voronoin.html>voronoin</a>.
</li>
<li>The <a href="http://cran.r-project.org/web/packages/geometry/geometry.pdf">geometry</a> package of <a href="http://www.r-project.org/">R</a> provides <a href="http://geometry.r-forge.r-project.org/">Qhull in R</a>.
<li>The <a href="http://packages.debian.org/sid/octave3.2">Debian build</a> of
<a href=http://www.octave.org/>GNU Octave</a> includes Qhull for <a href="http://www.gnu.org/software/octave/doc/interpreter/Geometry.html">computational geometry<a>.
<li><a href=http://www.wolfram.com/products/mathematica/>Mathematica</a>'s Delaunay interface <a href=http://library.wolfram.com/infocenter/MathSource/1160/>qh-math</a>
and <a href="http://portal.uni-freiburg.de/imteksimulation/downloads/ims">QHullInterface</a>
<li>The <a href="http://docs.scipy.org/doc/scipy/reference/tutorial/spatial.html">scipy.spatial</a> of <a href="http://scipy.org/">SciPy</a> is implemented with Qhull. It includes
support for Delaunay triangulations,
</ul>
</form>
<p><b>Introduction</b>
<ul>
<li><a
href="http://www.cs.mcgill.ca/~fukuda/soft/polyfaq/polyfaq.html"
>Fukuda's introduction</a> to convex hulls, Delaunay
triangulations, Voronoi diagrams, and linear programming</li>
<li><a
href="http://www.cse.unsw.edu.au/~lambert/java/3d/hull.html"
>Lambert's Java</a> visualization of convex hull algorithms </li>
<li><a
href="http://www.algorithmic-solutions.info/leda_guide/geometryalgorithms.html"
>LEDA Guide</a> to geometry algorithms
<li><a
href="http://mathworld.wolfram.com/ComputationalGeometry.html"
>MathWorld's</a> Computational Geometry from Wolfram Research
<li><a
href="http://www.cs.sunysb.edu/~algorith/major_section/1.6.shtml"
>Skiena's</a> Computational Geometry from his <i>Algorithm Design Manual</i>.
<li><a
href="http://www.cs.sunysb.edu/~algorith/major_section/1.6.shtml"
>Stony Brook</a> Algorithm Repository, computational geometry</li>
</ul>
<p><b>Qhull Documentation and Support</b>
<ul>
<li><a href="html/index.htm">Manual</a> for Qhull and rbox
<table><tr><td>
<ul>
<li><a href="html/index.htm#description">Description</a> of Qhull
<li><a href="html/qh-impre.htm">Imprecision</a> in Qhull
<li><a href="html/qh-quick.htm#programs">Programs</a> and <a href="html/qh-quick.htm#options">Options</a>
quick reference
<li><a href="html/qconvex.htm">qconvex</a> -- convex hull
<li><a href="html/qdelaun.htm">qdelaunay</a> -- Delaunay triangulation
<li><a href="html/qvoronoi.htm">qvoronoi</a> -- Voronoi diagram
<li><a href="html/qhalf.htm">qhalf</a> -- halfspace intersection about a point
<li><a href="html/rbox.htm">rbox</a> -- generate point distributions
</ul></td><td><ul>
<li><a href="http://www.qhull.org/html/qh-faq.htm">Frequently</a> asked
questions about Qhull</li>
<li><a href="html/index.htm#geomview">Geomview</a> for visualizing Qhull
<li><a href="COPYING.txt">COPYING.txt</a> - copyright notice<br>
<li><a href="REGISTER.txt">REGISTER.txt</a> - registration<br>
<li><a href="README.txt">README.txt</a> - installation
instructions<br>
<li><a href="src/Changes.txt">Changes.txt</a> - change history <br>
<li><a href="html/qh-code.htm">Calling Qhull</a> from your program
<li><a href="src/libqhull_r/index.htm">Reentrant</a> Qhull functions, macros, and data structures with source
</ul>
</td></tr></table>
<li>Send e-mail to <a href=mailto:qhull@qhull.org>qhull@qhull.org</a> </li>
<li>Report bugs to <a
href="mailto:qhull_bug@qhull.org">qhull_bug@qhull.org</a>
</ul>
<p><b>Related URLs</b>
<ul>
<li><a href="http://www.geom.uiuc.edu/software/cglist">Amenta's directory</a> of
computational geometry software </li>
<li><a href=http://www.boost.org/libs/graph/doc/table_of_contents.html>BGL</a>
Boost Graph Library provides C++ classes for graph data structures
and algorithms,
<li><a
href="http://www.netlib.org/voronoi/hull.html">Clarkson's
hull </a>program with exact arithmetic for convex hulls, Delaunay triangulations,
Voronoi volumes, and alpha shapes. </li>
<li><a href="http://compgeom.cs.uiuc.edu/~jeffe/compgeom/compgeom.html">Erickson's
Computational</a> Geometry Pages and
<a href="http://compgeom.cs.uiuc.edu/~jeffe/compgeom/code.html">Software</a>
<li><a
href="http://www.cs.mcgill.ca/~fukuda/soft/cdd_home/cdd.html">Fukuda's
cdd</a> program for halfspace intersection and convex hulls (<a
href="http://www.csb.ethz.ch/tools/polco">Polco/Java</a>)</li>
<li><a href="http://www.inf.ethz.ch/personal/gaertner/miniball.html">Gartner's
Miniball</a> for fast and robust smallest enclosing balls (up to 20-d)
<li><a href=http://www.algorithmic-solutions.com/enleda.htm>Leda</a>
and <a href=http://www.cgal.org/>CGAL</a> libraries for writing computational
geometry programs and other combinatorial algorithms
<li><a href=http://www.mathtools.net/>Mathtools.net</a> of scientific and engineering
software
<li><a href="http://www.imr.sandia.gov/papers/topics.html">Owen's International Meshing</a> Roundtable
<li><a
href="http://www.robertschneiders.de/meshgeneration/meshgeneration.html">Schneiders'
Finite Element</a> Mesh Generation page</li>
<li><a href="http://www.cs.cmu.edu/~quake/triangle.html">Shewchuk's
triangle </a>program for 2-d Delaunay</li>
<li><a href=http://www.voronoi.com>Voronoi Web Site</a> for all things Voronoi
<li>Young's <a href="http://homepage.usask.ca/~ijm451/finite/fe_resources/">Internet Finite Element Resources</a>
<li><a href="http://www.uic.nnov.ru/~zny/skeleton/">Zolotykh's Skeleton</a> generates all extreme rays of a polyhedral cone using the Double Description Method</li>
<li><a href="https://github.com/tomilov/quickhull/blob/master/include/quickhull.hpp">Tomilov's quickhull.hpp</a> (<a href="http://habrahabr.ru/post/245221/">doc-ru</a>) implements the Quickhull algorithm for points in general position.
</ul>
<p><b>FAQs and Newsgroups</b>
<ul>
<li><a
href="http://www.faqs.org/faqs/graphics/algorithms-faq/">FAQ</a>
for computer graphics algorithms
(Exaflop.org: <a href="http://exaflop.org/docs/cgafaq/cga6.html">geometric</a> structures)
</li>
<li><a
href="http://www-unix.mcs.anl.gov/otc/Guide/faq/linear-programming-faq.html">FAQ
</a>for linear programming </li>
<li><a href="news:comp.graphics.algorithms">Newsgroup</a>:
comp.graphics.algorithms </li>
<li><a href="news:comp.soft-sys.matlab">Newsgroup</a>:
comp.soft-sys.matlab</li>
<li><a href="news:sci.math.num-analysis">Newsgroup</a>:
sci.math.num-analysis </li>
<li><a href="news:sci.op-research">Newsgroup</a>:
sci.op-research </li>
</ul>
</blockquote>
<hr>
<p>The program includes options for input transformations,
randomization, tracing, multiple output formats, and execution
statistics. The program can be called from within your
application. </p>
<p>You can view the results in 2-d, 3-d and 4-d with <a
href="http://www.geomview.org">Geomview</a>. An alternative
is <a href=http://www.vtk.org/>VTK</a>.</p>
<p>For an article about Qhull, download from
<a href="http://dl.acm.org/authorize?89250">ACM</a> or <a
href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.117.405">CiteSeer</a>:
</p>
<blockquote>
<p>Barber, C.B., Dobkin, D.P., and Huhdanpaa, H.T., &quot;The
Quickhull algorithm for convex hulls,&quot; <i>ACM Trans. on
Mathematical Software</i>, 22(4):469-483, Dec 1996, http://www.qhull.org</p>
</blockquote>
<p>Abstract: </p>
<blockquote>
<p>The convex hull of a set of points is the smallest convex
set that contains the points. This article presents a
practical convex hull algorithm that combines the
two-dimensional Quickhull Algorithm with the general
dimension Beneath-Beyond Algorithm. It is similar to the
randomized, incremental algorithms for convex hull and
Delaunay triangulation. We provide empirical evidence that
the algorithm runs faster when the input contains non-extreme
points, and that it uses less memory. </p>
<p>Computational geometry algorithms have traditionally
assumed that input sets are well behaved. When an algorithm
is implemented with floating point arithmetic, this
assumption can lead to serious errors. We briefly describe a
solution to this problem when computing the convex hull in
two, three, or four dimensions. The output is a set of
"thick" facets that contain all possible exact convex hulls
of the input. A variation is effective in five or more
dimensions. </p>
</blockquote>
<!-- Navigation links -->
<hr>
<p><b>Up:</b> <a href="http://www.geom.uiuc.edu/software/past-projects.html"><i>Past Software
Projects of the Geometry Center</i></a> <br>
<b>URL:</b> <a href="http://www.qhull.org">http://www.qhull.org</a>
<br><b>To:</b>
<a href="http://www.qhull.org/news">News</a>
&#149; <a href="http://www.qhull.org/download">Download</a>
&#149; <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.117.405">CiteSeer</a>
&#149; <a href=http://images.google.com/images?q=qhull&num=100>Images</a>
&#149; <a href="html/index.htm#TOC">Manual</a>
&#149; <a href="http://www.qhull.org/html/qh-faq.htm">FAQ</a>
&#149; <a href="html/qh-quick.htm#programs">Programs</a>
&#149; <a href="html/qh-quick.htm#options">Options</a>
<!-- GC common information --></p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img src="html/qh--geom.gif" alt="[HOME]"
align="middle"></a> <i>The Geometry Center Home Page</i> </p>
<p>Comments to: <a href="mailto:qhull@qhull.org">qhull@qhull.org</a>
<br>
Created: May 17 1995 --- <!-- hhmts start -->
</body>
</html>

View File

@ -0,0 +1,426 @@
# CMakeLists.txt -- CMake configuration file for qhull, qhull6, and related programs
#
# To install CMake
# Download from http://www.cmake.org/download/
#
# To find the available targets for CMake -G "..."
# cmake --help
#
# To build with MSYS/mingw
# cd build && cmake -G "MSYS Makefiles" .. && cmake ..
# make
# make install
#
# To uninstall on unix or MSYS/mingw
# xargs rm <build/install_manifest.txt
#
# To build Qhull with Visual Studio projects, run cmake twice
# To install bin/doc/include/lib in the current directory
# mkdir -p build-cmake && cd build-cmake && cmake -G "Visual Studio 11 2012" .. && cmake -DCMAKE_INSTALL_PREFIX=.. ..
# mkdir -p build-cmake && cd build-cmake && cmake -G "Visual Studio 11 2012 Win64" .. && cmake -DCMAKE_INSTALL_PREFIX=.. ..
# To install into Program Files/qhull
# mkdir -p build-cmake && cd build-cmake && cmake -G "Visual Studio 11 2012" .. && cmake ..
# mkdir -p build-cmake && cd build-cmake && cmake -G "Visual Studio 11 2012 Win64" .. && cmake ..
# To build for Visual Studio 2005 and install into Program Files/qhull
# mkdir -p build-cmake && cd build-cmake && cmake -G "Visual Studio 8 2005" .. && cmake ..
# mkdir -p build-cmake && cd build-cmake && cmake -G "Visual Studio 8 2005 Win64" .. && cmake ..
# Double click build-cmake/qhull-all.sln
# Build INSTALL to copy files into C:/Program Files/qhull
#
# Additional build targets
# qhullp -- Same as qhull using qh_QHpointer and deprecated libqhull_p
# user_egp -- Same as user_eg using qh_QHpointer and deprecated libqhull_p
#
# Notes on Visual Studio projects
# You may need to copy bin/msvcr80.dll into C:/Program Files/qhull/bin
# If using library debug targets, please rename with '_d' (e.g., qhullstatic_d.lib)
#
# Troubleshooting
# "No CMAKE_C_COMPILER could be found"
# cmake was not able to find the build environment specified (e.g., Visual Studio 11)
#
# To uninstall on Windows
# Delete C:/Program Files/qhull
#
# If creating a qhull package, please include a pkg-config file based on build/qhull*.pc.in
#
# For qhulltest, use the Qt build (src/qhull-all.pro)
#
# Qhull ships with cmake-derived sln and proj files for DevStudio 8 2005
# See eg/make-vcproj.sh
# Change to relative paths
# Remove ZERO_CHECK, ALL_BUILD, and INSTALL projects
# Change targets to bin/ and lib/ directories
# Disable incremental linking and ilk files (LinkIncremental="1")
# Disable Run-Time Type Info (rtti)
# Remove src/libqhullcpp from most of the AdditionalIncludeDirectories
# Remove CMAKE_INTDIR from PreprocessorDefinitions
# Adjust target names and destinations (e.g., lib/libqhullstatic_rd.a)
#
# $Id: //main/2015/qhull/CMakeLists.txt#8 $$Change: 2066 $
# $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $
project(qhull)
cmake_minimum_required(VERSION 2.6)
# Define qhull_VERSION in CMakeLists.txt, Makefile, qhull-exports.def, qhull_p-exports.def, qhull_r-exports.def, qhull-warn.pri
set(qhull_VERSION2 "2015.2 2016/01/18") # not used, See global.c, global_r.c, rbox.c, rbox_r.c
set(qhull_VERSION "7.2.0") # Advance every release
# SOVERSION -- qhull 2003 = empty, 2009 = 5, 2010-2012 = 6, 2015 (reentrant) = 7
set(qhull_SOVERSION 7) # For SOVERSION
include(CMakeModules/CheckLFS.cmake)
option(WITH_LFS "Enable Large File Support" ON)
check_lfs(WITH_LFS)
if(INCLUDE_INSTALL_DIR)
else()
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include)
endif()
if(LIB_INSTALL_DIR)
else()
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
endif()
if(BIN_INSTALL_DIR)
else()
set(BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin)
endif()
if(MAN_INSTALL_DIR)
else()
if(WIN32)
set(MAN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/man/man1)
else()
set(MAN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/man/man1)
endif()
endif()
if(DOC_INSTALL_DIR)
else()
if(WIN32)
set(DOC_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/doc)
else()
set(DOC_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/doc/qhull)
endif()
endif()
message(STATUS)
message(STATUS "========== qhull Build Information ==========")
message(STATUS "Build Version: ${qhull_VERSION}")
message(STATUS "Install Prefix (CMAKE_INSTALL_PREFIX): ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Binary Directory (BIN_INSTALL_DIR): ${BIN_INSTALL_DIR}")
message(STATUS "Library Directory (LIB_INSTALL_DIR): ${LIB_INSTALL_DIR}")
message(STATUS "Include Directory (INCLUDE_INSTALL_DIR): ${INCLUDE_INSTALL_DIR}")
message(STATUS "Documentation Directory (DOC_INSTALL_DIR): ${DOC_INSTALL_DIR}")
message(STATUS "Man Pages Directory (MAN_INSTALL_DIR): ${MAN_INSTALL_DIR}")
message(STATUS "Build Type (CMAKE_BUILD_TYPE): ${CMAKE_BUILD_TYPE}")
message(STATUS "To override these options, add -D{OPTION_NAME}=... to the cmake command")
message(STATUS " Build the debug targets -DCMAKE_BUILD_TYPE=Debug")
message(STATUS)
message(STATUS "To build and install qhull, enter \"make\" and \"make install\"")
message(STATUS "To smoketest qhull, enter \"ctest\"")
message(STATUS)
# ---------------------------------------
# Define library source files and variables
#
# Files for individual targets are defined with the target
# ---------------------------------------
# Order libqhull object files by frequency of execution. Small files at end.
# Non-reentrant Qhull
set(
libqhull_HEADERS
src/libqhull/libqhull.h
src/libqhull/geom.h
src/libqhull/io.h
src/libqhull/mem.h
src/libqhull/merge.h
src/libqhull/poly.h
src/libqhull/qhull_a.h
src/libqhull/qset.h
src/libqhull/random.h
src/libqhull/stat.h
src/libqhull/user.h
)
set(
libqhull_SOURCES
src/libqhull/global.c
src/libqhull/stat.c
src/libqhull/geom2.c
src/libqhull/poly2.c
src/libqhull/merge.c
src/libqhull/libqhull.c
src/libqhull/geom.c
src/libqhull/poly.c
src/libqhull/qset.c
src/libqhull/mem.c
src/libqhull/random.c
src/libqhull/usermem.c
src/libqhull/userprintf.c
src/libqhull/io.c
src/libqhull/user.c
src/libqhull/rboxlib.c
src/libqhull/userprintf_rbox.c
${libqhull_HEADERS}
)
set(
libqhull_DOC
src/libqhull/index.htm
src/libqhull/qh-geom.htm
src/libqhull/qh-globa.htm
src/libqhull/qh-io.htm
src/libqhull/qh-mem.htm
src/libqhull/qh-merge.htm
src/libqhull/qh-poly.htm
src/libqhull/qh-qhull.htm
src/libqhull/qh-set.htm
src/libqhull/qh-stat.htm
src/libqhull/qh-user.htm
src/libqhull/DEPRECATED.txt
)
set(
testqset_HEADERS
src/libqhull/mem.h
src/libqhull/qset.h
)
set(
testqset_SOURCES
src/libqhull/qset.c
src/libqhull/mem.c
src/libqhull/usermem.c
src/testqset/testqset.c
${testqset_HEADERS}
)
# Reeentrant Qhull
set(
libqhullr_HEADERS
src/libqhull_r/libqhull_r.h
src/libqhull_r/geom_r.h
src/libqhull_r/io_r.h
src/libqhull_r/mem_r.h
src/libqhull_r/merge_r.h
src/libqhull_r/poly_r.h
src/libqhull_r/qhull_ra.h
src/libqhull_r/qset_r.h
src/libqhull_r/random_r.h
src/libqhull_r/stat_r.h
src/libqhull_r/user_r.h
)
set(
libqhullr_SOURCES
src/libqhull_r/global_r.c
src/libqhull_r/stat_r.c
src/libqhull_r/geom2_r.c
src/libqhull_r/poly2_r.c
src/libqhull_r/merge_r.c
src/libqhull_r/libqhull_r.c
src/libqhull_r/geom_r.c
src/libqhull_r/poly_r.c
src/libqhull_r/qset_r.c
src/libqhull_r/mem_r.c
src/libqhull_r/random_r.c
src/libqhull_r/usermem_r.c
src/libqhull_r/userprintf_r.c
src/libqhull_r/io_r.c
src/libqhull_r/user_r.c
src/libqhull_r/rboxlib_r.c
src/libqhull_r/userprintf_rbox_r.c
${libqhullr_HEADERS}
)
set(
libqhullr_DOC
src/libqhull_r/index.htm
src/libqhull_r/qh-geom_r.htm
src/libqhull_r/qh-globa_r.htm
src/libqhull_r/qh-io_r.htm
src/libqhull_r/qh-mem_r.htm
src/libqhull_r/qh-merge_r.htm
src/libqhull_r/qh-poly_r.htm
src/libqhull_r/qh-qhull_r.htm
src/libqhull_r/qh-set_r.htm
src/libqhull_r/qh-stat_r.htm
src/libqhull_r/qh-user_r.htm
)
set(
testqsetr_HEADERS
src/libqhull_r/mem_r.h
src/libqhull_r/qset_r.h
)
set(
testqsetr_SOURCES
src/libqhull_r/qset_r.c
src/libqhull_r/mem_r.c
src/libqhull_r/usermem_r.c
src/testqset_r/testqset_r.c
${testqsetr_HEADERS}
)
# C++ interface to reentrant Qhull
set(
libqhullcpp_HEADERS
src/libqhullcpp/Coordinates.h
src/libqhullcpp/functionObjects.h
src/libqhullcpp/PointCoordinates.h
src/libqhullcpp/Qhull.h
src/libqhullcpp/QhullError.h
src/libqhullcpp/QhullFacet.h
src/libqhullcpp/QhullFacetList.h
src/libqhullcpp/QhullFacetSet.h
src/libqhullcpp/QhullHyperplane.h
src/libqhullcpp/QhullIterator.h
src/libqhullcpp/QhullLinkedList.h
src/libqhullcpp/QhullPoint.h
src/libqhullcpp/QhullPoints.h
src/libqhullcpp/QhullPointSet.h
src/libqhullcpp/QhullQh.h
src/libqhullcpp/QhullRidge.h
src/libqhullcpp/QhullSet.h
src/libqhullcpp/QhullSets.h
src/libqhullcpp/QhullStat.h
src/libqhullcpp/QhullVertex.h
src/libqhullcpp/QhullVertexSet.h
src/libqhullcpp/RboxPoints.h
src/libqhullcpp/RoadError.h
src/libqhullcpp/RoadLogEvent.h
src/qhulltest/RoadTest.h
)
set(
libqhullcpp_SOURCES
src/libqhullcpp/Coordinates.cpp
src/libqhullcpp/PointCoordinates.cpp
src/libqhullcpp/Qhull.cpp
src/libqhullcpp/QhullFacet.cpp
src/libqhullcpp/QhullFacetList.cpp
src/libqhullcpp/QhullFacetSet.cpp
src/libqhullcpp/QhullHyperplane.cpp
src/libqhullcpp/QhullPoint.cpp
src/libqhullcpp/QhullPointSet.cpp
src/libqhullcpp/QhullPoints.cpp
src/libqhullcpp/QhullQh.cpp
src/libqhullcpp/QhullRidge.cpp
src/libqhullcpp/QhullSet.cpp
src/libqhullcpp/QhullStat.cpp
src/libqhullcpp/QhullVertex.cpp
src/libqhullcpp/QhullVertexSet.cpp
src/libqhullcpp/RboxPoints.cpp
src/libqhullcpp/RoadError.cpp
src/libqhullcpp/RoadLogEvent.cpp
${libqhullcpp_HEADERS}
)
# Documentation files (index.htm refers to html/...)
set(
doc_FILES
README.txt
REGISTER.txt
Announce.txt
COPYING.txt
index.htm
)
include_directories(${CMAKE_SOURCE_DIR}/src)
if(CMAKE_BUILD_TYPE MATCHES "[dD]ebug")
set(qhull_CPP qhullcpp_d)
set(qhull_SHARED qhull_d)
set(qhull_SHAREDP qhull_pd)
set(qhull_SHAREDR qhull_rd)
set(qhull_STATIC qhullstatic_d)
set(qhull_STATICR qhullstatic_rd)
else()
set(qhull_CPP qhullcpp)
set(qhull_SHARED libqhull) # Temporarily avoid name conflict with qhull executable
set(qhull_SHAREDP qhull_p)
set(qhull_SHAREDR qhull_r)
set(qhull_STATIC qhullstatic)
set(qhull_STATICR qhullstatic_r)
endif()
# ---------------------------------------
# Define static libraries qhullstatic (non-reentrant) and qhullstatic_r (reentrant)
# ---------------------------------------
add_library(${qhull_STATIC} STATIC ${libqhull_SOURCES})
set_target_properties(${qhull_STATIC} PROPERTIES
VERSION ${qhull_VERSION})
add_library(${qhull_STATICR} STATIC ${libqhullr_SOURCES})
set_target_properties(${qhull_STATICR} PROPERTIES
VERSION ${qhull_VERSION})
if(UNIX)
target_link_libraries(${qhull_STATIC} m)
target_link_libraries(${qhull_STATICR} m)
endif(UNIX)
# ---------------------------------------
# Define C++ static library qhullcpp
# Do not create libqhullcpp as a shared library. Qhull C++ classes may change layout and size.
# ---------------------------------------
add_library(${qhull_CPP} STATIC ${libqhullcpp_SOURCES})
set_target_properties(${qhull_CPP} PROPERTIES
VERSION ${qhull_VERSION})
# ---------------------------------------
# Define qhull executables linked to qhullstatic library
# qhull is linked to reentrant qhull (more flexible)
# the others are linked to non-reentrant qhull (somewhat faster)
# ---------------------------------------
set(qhull_SOURCES src/qhull/unix_r.c)
set(rbox_SOURCES src/rbox/rbox.c)
set(qconvex_SOURCES src/qconvex/qconvex.c)
set(qdelaunay_SOURCES src/qdelaunay/qdelaun.c)
set(qvoronoi_SOURCES src/qvoronoi/qvoronoi.c)
set(qhalf_SOURCES src/qhalf/qhalf.c)
add_executable(qhull ${qhull_SOURCES})
target_link_libraries(qhull ${qhull_STATICR})
add_executable(rbox ${rbox_SOURCES})
target_link_libraries(rbox ${qhull_STATIC})
add_executable(qconvex ${qconvex_SOURCES})
target_link_libraries(qconvex ${qhull_STATIC})
add_executable(qdelaunay ${qdelaunay_SOURCES})
target_link_libraries(qdelaunay ${qhull_STATIC})
add_executable(qvoronoi ${qvoronoi_SOURCES})
target_link_libraries(qvoronoi ${qhull_STATIC})
add_executable(qhalf ${qhalf_SOURCES})
target_link_libraries(qhalf ${qhull_STATIC})
# ---------------------------------------
# Define install
# ---------------------------------------
install(TARGETS ${qhull_TARGETS_INSTALL}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
install(FILES ${libqhull_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhull)
install(FILES ${libqhull_DOC} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhull)
install(FILES ${libqhullr_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhull_r)
install(FILES ${libqhullr_DOC} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhull_r)
install(FILES ${libqhullcpp_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhullcpp)
install(FILES html/qhull.man DESTINATION ${MAN_INSTALL_DIR} RENAME qhull.1)
install(FILES html/rbox.man DESTINATION ${MAN_INSTALL_DIR} RENAME rbox.1)
install(FILES ${doc_FILES} DESTINATION ${DOC_INSTALL_DIR})
install(DIRECTORY html/ DESTINATION ${DOC_INSTALL_DIR})

2129
xs/src/qhull/src/Changes.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
qhull/src/libqhull
This directory contains the non-reentrant version of qhull, libqhull.
New code should use the reentrant version of qhull (libqhull_r).
It allows multiple instances of qhull to run at the same time. On
modern architectures, it is nearly as fast as libqhull.
Qhull programs may be built with either library. Each program has a
reentrant version (e.g., qconvex_r.c) and a non-reentrant
version (qconvex.c). The programs, rbox, qconvex, qdelaunay, qhalf,
and qvoronoi, are built with libqhull. The qhull program is built
with libqhull_r.
Qhull's C++ interface requires libqhull_r. If you previously used the
C++ interface, you will need to update your code. See Changes.txt for
suggestions.
The C code in libqhull looks unusual because of the 'qh' macro. The 'qh'
macro controls access to Qhull's global data structure, qhT. If
'qh_QHpointer' is defined, 'qh' is 'qh_qh->' and 'qh_qh' is defined as
'qhT *qh_qh', otherwise 'qh' is 'qh_qh.' and 'qh_qh' is defined as
'qhT qh_qh'.
libqhull will be supported indefinitely. The qh_QHpointer variation
of libqhull will be not be retested each release. It is replaced by
libqhull_r.

View File

@ -0,0 +1,240 @@
# Simple gcc Makefile for non-reentrant qhull and rbox (default gcc/g++)
#
# make help
# See README.txt and ../../Makefile
#
# Variables
# BINDIR directory where to copy executables
# DESTDIR destination directory for 'make install'
# DOCDIR directory where to copy html documentation
# INCDIR directory where to copy headers
# LIBDIR directory where to copy libraries
# MANDIR directory where to copy manual pages
# PRINTMAN command for printing manual pages
# PRINTC command for printing C files
# CC ANSI C or C++ compiler
# CC_OPTS1 options used to compile .c files
# CC_OPTS2 options used to link .o files
# CC_OPTS3 options to build shared libraries
#
# LIBQHULL_OBJS .o files for linking
# LIBQHULL_HDRS .h files for printing
# CFILES .c files for printing
# DOCFILES documentation files
# FILES miscellaneous files for printing
# TFILES .txt versions of html files
# FILES all other files
# LIBQHULL_OBJS specifies the object files of libqhullstatic_r.a
#
# Results
# rbox Generates points sets for qhull, qconvex, etc.
# qhull Computes convex hulls and related structures
# qconvex, qdelaunay, qhalf, qvoronoi
# Specializations of qhull for each geometric structure
# libqhullstatic_r.a Static library for non-reentrant qhull
# testqset_r Standalone test of non-reentrant qset_r.c with mem_r.c
# user_eg An example of using qhull (non-reentrant)
# user_eg2 An example of using qhull (non-reentrant)
#
# Make targets
# make Build results using gcc or another compiler
# make clean Remove object files
# make cleanall Remove generated files
# make doc Print documentation
# make help
# make install Copy qhull, rbox, qhull.1, rbox.1 to BINDIR, MANDIR
# make new Rebuild qhull and rbox from source
# make printall Print all files
# make qtest Quick test of qset, rbox, and qhull
# make test Quck test of qhull, qconvex, etc.
#
# Do not replace tabs with spaces. Needed for build rules
# Unix line endings (\n)
# $Id: //main/2015/qhull/src/libqhull/Makefile#8 $
DESTDIR = /usr/local
BINDIR = $(DESTDIR)/bin
INCDIR = $(DESTDIR)/include
LIBDIR = $(DESTDIR)/lib
DOCDIR = $(DESTDIR)/share/doc/qhull
MANDIR = $(DESTDIR)/share/man/man1
# if you do not have enscript, try a2ps or just use lpr. The files are text.
PRINTMAN = enscript -2rl
PRINTC = enscript -2r
# PRINTMAN = lpr
# PRINTC = lpr
#for Gnu's gcc compiler, -O3 for optimization, -g for debugging, -pg for profiling
# -fpic needed for gcc x86_64-linux-gnu. Not needed for mingw
CC = gcc
CC_OPTS1 = -O3 -ansi -I../../src -fpic $(CC_WARNINGS)
# for Sun's cc compiler, -fast or O2 for optimization, -g for debugging, -Xc for ANSI
#CC = cc
#CC_OPTS1 = -Xc -v -fast -I../../src
# for Silicon Graphics cc compiler, -O2 for optimization, -g for debugging
#CC = cc
#CC_OPTS1 = -ansi -O2 -I../../src
# for Next cc compiler with fat executable
#CC = cc
#CC_OPTS1 = -ansi -O2 -I../../src -arch m68k -arch i386 -arch hppa
# For loader, ld,
CC_OPTS2 = $(CC_OPTS1)
# Default targets for make
all: qhull_links qhull_all qtest
help:
head -n 50 Makefile
clean:
rm -f *.o
# Delete linked files from other directories [qhull_links]
rm -f qconvex.c unix.c qdelaun.c qhalf.c qvoronoi.c rbox.c
rm -f user_eg.c user_eg2.c testqset.c
cleanall: clean
rm -f qconvex qdelaunay qhalf qvoronoi qhull *.exe
rm -f core user_eg user_eg2 testqset libqhullstatic.a
doc:
$(PRINTMAN) $(TXTFILES) $(DOCFILES)
install:
mkdir -p $(BINDIR)
mkdir -p $(DOCDIR)
mkdir -p $(INCDIR)/libqhull
mkdir -p $(MANDIR)
cp -p qconvex qdelaunay qhalf qhull qvoronoi rbox $(BINDIR)
cp -p libqhullstatic.a $(LIBDIR)
cp -p ../../html/qhull.man $(MANDIR)/qhull.1
cp -p ../../html/rbox.man $(MANDIR)/rbox.1
cp -p ../../html/* $(DOCDIR)
cp *.h $(INCDIR)/libqhull
new: cleanall all
printall: doc printh printc printf
printh:
$(PRINTC) $(LIBQHULL_HDRS)
printc:
$(PRINTC) $(CFILES)
# LIBQHULL_OBJS_1 ordered by frequency of execution with small files at end. Better locality.
# Same definitions as ../../Makefile
LIBQHULLS_OBJS_1= global.o stat.o geom2.o poly2.o merge.o \
libqhull.o geom.o poly.o qset.o mem.o random.o
LIBQHULLS_OBJS_2= $(LIBQHULLS_OBJS_1) usermem.o userprintf.o io.o user.o
LIBQHULLS_OBJS= $(LIBQHULLS_OBJS_2) rboxlib.o userprintf_rbox.o
LIBQHULL_HDRS= user.h libqhull.h qhull_a.h geom.h \
io.h mem.h merge.h poly.h random.h \
qset.h stat.h
# CFILES ordered alphabetically after libqhull.c
CFILES= ../qhull/unix.c libqhull.c geom.c geom2.c global.c io.c \
mem.c merge.c poly.c poly2.c random.c rboxlib.c \
qset.c stat.c user.c usermem.c userprintf.c \
../qconvex/qconvex.c ../qdelaunay/qdelaun.c ../qhalf/qhalf.c ../qvoronoi/qvoronoi.c
TXTFILES= ../../Announce.txt ../../REGISTER.txt ../../COPYING.txt ../../README.txt ../Changes.txt
DOCFILES= ../../html/rbox.txt ../../html/qhull.txt
.c.o:
$(CC) -c $(CC_OPTS1) -o $@ $<
# Work around problems with ../ in Red Hat Linux
qhull_links:
# On MINSYS, 'ln -s' may create a copy instead of a symbolic link
[ -f qconvex.c ] || ln -s ../qconvex/qconvex.c
[ -f qdelaun.c ] || ln -s ../qdelaunay/qdelaun.c
[ -f qhalf.c ] || ln -s ../qhalf/qhalf.c
[ -f qvoronoi.c ] || ln -s ../qvoronoi/qvoronoi.c
[ -f rbox.c ] || ln -s ../rbox/rbox.c
[ -f testqset.c ] || ln -s ../testqset/testqset.c
[ -f unix.c ] || ln -s ../qhull/unix.c
[ -f user_eg.c ] || ln -s ../user_eg/user_eg.c
[ -f user_eg2.c ] || ln -s ../user_eg2/user_eg2.c
# compile qhull without using bin/libqhullstatic.a
qhull_all: qconvex.o qdelaun.o qhalf.o qvoronoi.o unix.o user_eg.o user_eg2.o rbox.o testqset.o $(LIBQHULLS_OBJS)
$(CC) -o qconvex $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) qconvex.o
$(CC) -o qdelaunay $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) qdelaun.o
$(CC) -o qhalf $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) qhalf.o
$(CC) -o qvoronoi $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) qvoronoi.o
$(CC) -o qhull $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) unix.o
$(CC) -o rbox $(CC_OPTS2) -lm $(LIBQHULLS_OBJS) rbox.o
$(CC) -o user_eg $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) user_eg.o
$(CC) -o user_eg2 $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_1) user_eg2.o usermem.o userprintf.o io.o
$(CC) -o testqset $(CC_OPTS2) -lm mem.o qset.o usermem.o testqset.o
-ar -rs libqhullstatic.a $(LIBQHULLS_OBJS)
#libqhullstatic.a is not needed for qhull
#If 'ar -rs' fails try using 'ar -s' with 'ranlib'
#ranlib libqhullstatic.a
qtest:
@echo ============================================
@echo == make qtest ==============================
@echo ============================================
@echo -n "== "
@date
@echo
@echo Testing qset.c and mem.c with testqset
./testqset 10000
@echo Run the qhull smoketest
./rbox D4 | ./qhull
@echo ============================================
@echo == To smoketest qhull programs
@echo '== make test'
@echo ============================================
@echo
@echo ============================================
@echo == For all make targets
@echo '== make help'
@echo ============================================
@echo
test: qtest
@echo ==============================
@echo ========= qconvex ============
@echo ==============================
-./rbox 10 | ./qconvex Tv
@echo
@echo ==============================
@echo ========= qdelaunay ==========
@echo ==============================
-./rbox 10 | ./qdelaunay Tv
@echo
@echo ==============================
@echo ========= qhalf ==============
@echo ==============================
-./rbox 10 | ./qconvex FQ FV n Tv | ./qhalf Tv
@echo
@echo ==============================
@echo ========= qvoronoi ===========
@echo ==============================
-./rbox 10 | ./qvoronoi Tv
@echo
@echo ==============================
@echo ========= user_eg ============
@echo == w/o shared library ========
@echo ==============================
-./user_eg
@echo
@echo ==============================
@echo ========= user_eg2 ===========
@echo ==============================
-./user_eg2
@echo
# end of Makefile

View File

@ -0,0 +1,206 @@
#########################################################################
# Borland C++ 4.02 for Win32 and DOS Power Pack #
# Makefile for qhull and rbox #
# #
# make -fMborland all to produce qconvex, qhull, and rbox #
# make -fMborland user_eg to produce user_eg #
# make -fMborland user_eg2 to produce user_eg2 #
# make -fMborland new to rebuild qhull and rbox from source #
# make -fMborland clean to remove object files #
# make -fMborland cleanall to remove all generated files #
# make -fMborland test to test rbox and qhull #
# #
# Author: D. Zwick of Germany, C.B. Barber #
#########################################################################
CC = bcc32 # 32 bit compiler for DOS
# bcc32i - Intel's compiler
LINKER = $(CC) # bcc calls tlink32 with needed options
CFLAGS = -w- -A -O2
# -w- no warnings, bcc doesn't handle assigns in conditions
# -A Ansi standard
# -X no auto-dependency outputs
# -v debugging, use CCOPTS for both
# -O2 optimization
!if $d(_DPMI)
LFLAGS = -WX -w- # -WX loads DPMI library
!else
LFLAGS = -lap -lx -lc
# -lap 32-bit console application
# -lx no map file
# -lc case is significant
!endif
EXERB = rbox
EXEQH = qhull
EXEQC = qconvex
EXEQD = qdelaunay
EXEQV = qvoronoi
EXEQF = qhalf
EXEEG = user_eg
EXEEG2 = user_eg2
TMPFILE = BCC32tmp.cfg
OBJS1 = global.obj stat.obj geom2.obj poly2.obj merge.obj
OBJS2 = libqhull.obj geom.obj poly.obj qset.obj mem.obj
OBJS3 = random.obj usermem.obj userprintf.obj io.obj user.obj
OBJS4 = rboxlib.obj random.obj usermem.obj userprintf_rbox.obj
HFILES1 = libqhull.h stat.h qhull_a.h user.h
# General rules
.c.obj:
$(CC) -c $(CFLAGS) $<
# Default
all: $(EXERB) $(EXEQH) $(EXEQC) $(EXEQD) $(EXEQV) $(EXEQF) test
help:
@echo USAGE:
@echo "make all to produce qhull, rbox, qconvex, qdelaun, qvoronoi, qhalf"
@echo "make user_eg to produce user_eg"
@echo "make user_eg2 to produce user_eg2"
@echo "make new to rebuild qhull and rbox from source"
@echo "make clean to remove object files"
@echo "make cleanall to remove all generated file"
@echo "make test to test rbox and qhull"
@echo OPTIONS (default is 32-bit console app):
@echo "-D_DPMI for C++ 4.01 and DOS Power Pack"
# Executables
$(EXEQH): ..\..\bin\$(EXEQH).exe
@echo Made ..\..\bin\$(EXEQH).exe
unix.obj: ..\qhull\unix.c
..\..\bin\$(EXEQH).exe: unix.obj $(OBJS1) $(OBJS2) $(OBJS3)
@echo unix.obj > $(TMPFILE)
@echo $(OBJS1) >> $(TMPFILE)
@echo $(OBJS2) >> $(TMPFILE)
@echo $(OBJS3) >> $(TMPFILE)
$(LINKER) -e$@ $(CFLAGS) $(LFLAGS) @$(TMPFILE)
$(EXEQC): ..\..\bin\$(EXEQC).exe
@echo Made ..\..\bin\$(EXEQC).exe
qconvex.obj: ..\qconvex\qconvex.c
..\..\bin\$(EXEQC).exe: qconvex.obj $(OBJS1) $(OBJS2) $(OBJS3)
@echo qconvex.obj > $(TMPFILE)
@echo $(OBJS1) >> $(TMPFILE)
@echo $(OBJS2) >> $(TMPFILE)
@echo $(OBJS3) >> $(TMPFILE)
$(LINKER) -e$@ $(CFLAGS) $(LFLAGS) @$(TMPFILE)
$(EXEQD): ..\..\bin\$(EXEQD).exe
@echo Made ..\..\bin\$(EXEQD).exe
qdelaun.obj: ..\qdelaunay\qdelaun.c
..\..\bin\$(EXEQD).exe: qdelaun.obj $(OBJS1) $(OBJS2) $(OBJS3)
@echo qdelaun.obj > $(TMPFILE)
@echo $(OBJS1) >> $(TMPFILE)
@echo $(OBJS2) >> $(TMPFILE)
@echo $(OBJS3) >> $(TMPFILE)
$(LINKER) -e$@ $(CFLAGS) $(LFLAGS) @$(TMPFILE)
$(EXEQV): ..\..\bin\$(EXEQV).exe
@echo Made ..\..\bin\$(EXEQV).exe
qvoronoi.obj: ..\qvoronoi\qvoronoi.c
..\..\bin\$(EXEQV).exe: qvoronoi.obj $(OBJS1) $(OBJS2) $(OBJS3)
@echo qvoronoi.obj > $(TMPFILE)
@echo $(OBJS1) >> $(TMPFILE)
@echo $(OBJS2) >> $(TMPFILE)
@echo $(OBJS3) >> $(TMPFILE)
$(LINKER) -e$@ $(CFLAGS) $(LFLAGS) @$(TMPFILE)
$(EXEQF): ..\..\bin\$(EXEQF).exe
@echo Made ..\..\bin\$(EXEQF).exe
qhalf.obj: ..\qhalf\qhalf.c
..\..\bin\$(EXEQF).exe: qhalf.obj $(OBJS1) $(OBJS2) $(OBJS3)
@echo qhalf.obj > $(TMPFILE)
@echo $(OBJS1) >> $(TMPFILE)
@echo $(OBJS2) >> $(TMPFILE)
@echo $(OBJS3) >> $(TMPFILE)
$(LINKER) -e$@ $(CFLAGS) $(LFLAGS) @$(TMPFILE)
$(EXEEG): ..\..\bin\$(EXEEG).exe
@echo Made ..\..\bin\$(EXEEG).exe
user_eg.obj: ..\user_eg\user_eg.c
..\..\bin\$(EXEEG).exe: user_eg.obj $(OBJS1) $(OBJS2) $(OBJS3)
@echo user_eg.obj > $(TMPFILE)
@echo $(OBJS1) >> $(TMPFILE)
@echo $(OBJS2) >> $(TMPFILE)
@echo $(OBJS3) >> $(TMPFILE)
$(LINKER) -e$@ $(CFLAGS) $(LFLAGS) @$(TMPFILE)
$(EXEEG2): ..\..\bin\$(EXEEG2).exe
@echo Made ..\..\bin\$(EXEEG2).exe
user_eg2.obj: ..\user_eg2\user_eg2.c
..\..\bin\$(EXEEG2).exe: user_eg2.obj $(OBJS1) $(OBJS2) $(OBJS3)
@echo user_eg2.obj > $(TMPFILE)
@echo $(OBJS1) >> $(TMPFILE)
@echo $(OBJS2) >> $(TMPFILE)
@echo $(OBJS3) >> $(TMPFILE)
$(LINKER) -e$@ $(CFLAGS) $(LFLAGS) @$(TMPFILE)
$(EXERB): ..\..\bin\$(EXERB).exe
@echo Made ..\..\bin\$(EXERB).exe
rbox.obj: ..\rbox\rbox.c
..\..\bin\$(EXERB).exe: rbox.obj $(OBJS4)
@echo rbox.obj > $(TMPFILE)
@echo $(OBJS4) >> $(TMPFILE)
$(LINKER) -e$@ $(CFLAGS) $(LFLAGS) @$(TMPFILE)
# Test rbox and qhull
test:
@..\..\bin\rbox D4 > test.x
@..\..\bin\qhull <test.x
@del test.x
# Clean up
clean:
@del *.obj
@del $(TMPFILE)
cleanall: clean
@del ..\..\bin\$(EXERB).exe
@del ..\..\bin\$(EXEQC).exe
@del ..\..\bin\$(EXEQD).exe
@del ..\..\bin\$(EXEQF).exe
@del ..\..\bin\$(EXEQH).exe
@del ..\..\bin\$(EXEQV).exe
@del ..\..\bin\$(EXEEG).exe
@del ..\..\bin\$(EXEEG2).exe
@del ..\q_test.x
@del ..\q_test.log.1
# Clean up and rebuild all
new: cleanall all
# Header file dependencies
libqhull.obj stat.obj user.obj global.obj usermem.obj userprintf.obj: $(HFILES1)
random.obj: libqhull.h random.h
geom.obj geom2.obj: $(HFILES1) geom.h
poly.obj poly2.obj: $(HFILES1) poly.h
io.obj: $(HFILES1) io.h
merge.obj: $(HFILES1) merge.h
mem.obj: mem.h
qset.obj: qset.h mem.h
unix.obj: libqhull.h user.h
qconvex.obj: libqhull.h user.h
qdelaun.obj: libqhull.h user.h
qhalf.obj: libqhull.h user.h
qvoronoi.obj: libqhull.h user.h
rbox.obj: user.h

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,176 @@
/*<html><pre> -<a href="qh-geom.htm"
>-------------------------------</a><a name="TOP">-</a>
geom.h
header file for geometric routines
see qh-geom.htm and geom.c
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull/geom.h#1 $$Change: 1981 $
$DateTime: 2015/09/28 20:26:32 $$Author: bbarber $
*/
#ifndef qhDEFgeom
#define qhDEFgeom 1
#include "libqhull.h"
/* ============ -macros- ======================== */
/*-<a href="qh-geom.htm#TOC"
>--------------------------------</a><a name="fabs_">-</a>
fabs_(a)
returns the absolute value of a
*/
#define fabs_( a ) ((( a ) < 0 ) ? -( a ):( a ))
/*-<a href="qh-geom.htm#TOC"
>--------------------------------</a><a name="fmax_">-</a>
fmax_(a,b)
returns the maximum value of a and b
*/
#define fmax_( a,b ) ( ( a ) < ( b ) ? ( b ) : ( a ) )
/*-<a href="qh-geom.htm#TOC"
>--------------------------------</a><a name="fmin_">-</a>
fmin_(a,b)
returns the minimum value of a and b
*/
#define fmin_( a,b ) ( ( a ) > ( b ) ? ( b ) : ( a ) )
/*-<a href="qh-geom.htm#TOC"
>--------------------------------</a><a name="maximize_">-</a>
maximize_(maxval, val)
set maxval to val if val is greater than maxval
*/
#define maximize_( maxval, val ) { if (( maxval ) < ( val )) ( maxval )= ( val ); }
/*-<a href="qh-geom.htm#TOC"
>--------------------------------</a><a name="minimize_">-</a>
minimize_(minval, val)
set minval to val if val is less than minval
*/
#define minimize_( minval, val ) { if (( minval ) > ( val )) ( minval )= ( val ); }
/*-<a href="qh-geom.htm#TOC"
>--------------------------------</a><a name="det2_">-</a>
det2_(a1, a2,
b1, b2)
compute a 2-d determinate
*/
#define det2_( a1,a2,b1,b2 ) (( a1 )*( b2 ) - ( a2 )*( b1 ))
/*-<a href="qh-geom.htm#TOC"
>--------------------------------</a><a name="det3_">-</a>
det3_(a1, a2, a3,
b1, b2, b3,
c1, c2, c3)
compute a 3-d determinate
*/
#define det3_( a1,a2,a3,b1,b2,b3,c1,c2,c3 ) ( ( a1 )*det2_( b2,b3,c2,c3 ) \
- ( b1 )*det2_( a2,a3,c2,c3 ) + ( c1 )*det2_( a2,a3,b2,b3 ) )
/*-<a href="qh-geom.htm#TOC"
>--------------------------------</a><a name="dX">-</a>
dX( p1, p2 )
dY( p1, p2 )
dZ( p1, p2 )
given two indices into rows[],
compute the difference between X, Y, or Z coordinates
*/
#define dX( p1,p2 ) ( *( rows[p1] ) - *( rows[p2] ))
#define dY( p1,p2 ) ( *( rows[p1]+1 ) - *( rows[p2]+1 ))
#define dZ( p1,p2 ) ( *( rows[p1]+2 ) - *( rows[p2]+2 ))
#define dW( p1,p2 ) ( *( rows[p1]+3 ) - *( rows[p2]+3 ))
/*============= prototypes in alphabetical order, infrequent at end ======= */
void qh_backnormal(realT **rows, int numrow, int numcol, boolT sign, coordT *normal, boolT *nearzero);
void qh_distplane(pointT *point, facetT *facet, realT *dist);
facetT *qh_findbest(pointT *point, facetT *startfacet,
boolT bestoutside, boolT isnewfacets, boolT noupper,
realT *dist, boolT *isoutside, int *numpart);
facetT *qh_findbesthorizon(boolT ischeckmax, pointT *point,
facetT *startfacet, boolT noupper, realT *bestdist, int *numpart);
facetT *qh_findbestnew(pointT *point, facetT *startfacet, realT *dist,
boolT bestoutside, boolT *isoutside, int *numpart);
void qh_gausselim(realT **rows, int numrow, int numcol, boolT *sign, boolT *nearzero);
realT qh_getangle(pointT *vect1, pointT *vect2);
pointT *qh_getcenter(setT *vertices);
pointT *qh_getcentrum(facetT *facet);
realT qh_getdistance(facetT *facet, facetT *neighbor, realT *mindist, realT *maxdist);
void qh_normalize(coordT *normal, int dim, boolT toporient);
void qh_normalize2(coordT *normal, int dim, boolT toporient,
realT *minnorm, boolT *ismin);
pointT *qh_projectpoint(pointT *point, facetT *facet, realT dist);
void qh_setfacetplane(facetT *newfacets);
void qh_sethyperplane_det(int dim, coordT **rows, coordT *point0,
boolT toporient, coordT *normal, realT *offset, boolT *nearzero);
void qh_sethyperplane_gauss(int dim, coordT **rows, pointT *point0,
boolT toporient, coordT *normal, coordT *offset, boolT *nearzero);
boolT qh_sharpnewfacets(void);
/*========= infrequently used code in geom2.c =============*/
coordT *qh_copypoints(coordT *points, int numpoints, int dimension);
void qh_crossproduct(int dim, realT vecA[3], realT vecB[3], realT vecC[3]);
realT qh_determinant(realT **rows, int dim, boolT *nearzero);
realT qh_detjoggle(pointT *points, int numpoints, int dimension);
void qh_detroundoff(void);
realT qh_detsimplex(pointT *apex, setT *points, int dim, boolT *nearzero);
realT qh_distnorm(int dim, pointT *point, pointT *normal, realT *offsetp);
realT qh_distround(int dimension, realT maxabs, realT maxsumabs);
realT qh_divzero(realT numer, realT denom, realT mindenom1, boolT *zerodiv);
realT qh_facetarea(facetT *facet);
realT qh_facetarea_simplex(int dim, coordT *apex, setT *vertices,
vertexT *notvertex, boolT toporient, coordT *normal, realT *offset);
pointT *qh_facetcenter(setT *vertices);
facetT *qh_findgooddist(pointT *point, facetT *facetA, realT *distp, facetT **facetlist);
void qh_getarea(facetT *facetlist);
boolT qh_gram_schmidt(int dim, realT **rows);
boolT qh_inthresholds(coordT *normal, realT *angle);
void qh_joggleinput(void);
realT *qh_maxabsval(realT *normal, int dim);
setT *qh_maxmin(pointT *points, int numpoints, int dimension);
realT qh_maxouter(void);
void qh_maxsimplex(int dim, setT *maxpoints, pointT *points, int numpoints, setT **simplex);
realT qh_minabsval(realT *normal, int dim);
int qh_mindiff(realT *vecA, realT *vecB, int dim);
boolT qh_orientoutside(facetT *facet);
void qh_outerinner(facetT *facet, realT *outerplane, realT *innerplane);
coordT qh_pointdist(pointT *point1, pointT *point2, int dim);
void qh_printmatrix(FILE *fp, const char *string, realT **rows, int numrow, int numcol);
void qh_printpoints(FILE *fp, const char *string, setT *points);
void qh_projectinput(void);
void qh_projectpoints(signed char *project, int n, realT *points,
int numpoints, int dim, realT *newpoints, int newdim);
void qh_rotateinput(realT **rows);
void qh_rotatepoints(realT *points, int numpoints, int dim, realT **rows);
void qh_scaleinput(void);
void qh_scalelast(coordT *points, int numpoints, int dim, coordT low,
coordT high, coordT newhigh);
void qh_scalepoints(pointT *points, int numpoints, int dim,
realT *newlows, realT *newhighs);
boolT qh_sethalfspace(int dim, coordT *coords, coordT **nextp,
coordT *normal, coordT *offset, coordT *feasible);
coordT *qh_sethalfspace_all(int dim, int count, coordT *halfspaces, pointT *feasible);
pointT *qh_voronoi_center(int dim, setT *points);
#endif /* qhDEFgeom */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,264 @@
<!-- Do not edit with Front Page, it adds too many spaces -->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>Qhull functions, macros, and data structures</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code</a><br>
<b>To:</b> <a href="#TOC">Qhull files</a><br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149; <a href="qh-globa.htm">Global</a>
&#149; <a href="qh-io.htm">Io</a> &#149; <a href="qh-mem.htm">Mem</a>
&#149; <a href="qh-merge.htm">Merge</a> &#149; <a href="qh-poly.htm">Poly</a>
&#149; <a href="qh-qhull.htm">Qhull</a> &#149; <a href="qh-set.htm">Set</a>
&#149; <a href="qh-stat.htm">Stat</a> &#149; <a href="qh-user.htm">User</a>
<hr>
<!-- Main text of document. -->
<h1>Qhull functions, macros, and data structures</h1>
<blockquote>
<p>The following sections provide an overview and index to
Qhull's functions, macros, and data structures.
Each section starts with an introduction.
See also <a href=../../html/qh-code.htm#library>Calling
Qhull from C programs</a> and <a href="../../html/qh-code.htm#cpp">Calling Qhull from C++ programs</a>.</p>
<p>Qhull uses the following conventions:</p>
<blockquote>
<ul>
<li>in code, global variables start with &quot;qh &quot;
<li>in documentation, global variables start with 'qh.'
<li>constants start with an upper case word
<li>important globals include an '_'
<li>functions, macros, and constants start with &quot;qh_&quot;</li>
<li>data types end in &quot;T&quot;</li>
<li>macros with arguments end in &quot;_&quot;</li>
<li>iterators are macros that use local variables</li>
<li>iterators for sets start with &quot;FOREACH&quot;</li>
<li>iterators for lists start with &quot;FORALL&quot;</li>
<li>qhull options are in single quotes (e.g., 'Pdn')</li>
<li>lists are sorted alphabetically</li>
<li>preprocessor directives on left margin for older compilers</li>
</ul>
</blockquote>
<p>
When reading the code, please note that the
global data structure, 'qh', is a macro. It
either expands to &quot;qh_qh.&quot; or to
&quot;qh_qh-&gt;&quot;. The later is used for
applications which run concurrent calls to qh_qhull().
<p>
When reading code with an editor, a search for
'<i>&quot;function</i>'
will locate the header of <i>qh_function</i>. A search for '<i>* function</i>'
will locate the tail of <i>qh_function</i>.
<p>A useful starting point is <a href="libqhull.h">libqhull.h</a>. It defines most
of Qhull data structures and top-level functions. Search for <i>'PFn'</i> to
determine the corresponding constant in Qhull. Search for <i>'Fp'</i> to
determine the corresponding <a href="libqhull.h#qh_PRINT">qh_PRINT...</a> constant.
Search <a href="io.c">io.c</a> to learn how the print function is implemented.</p>
<p>If your web browser is configured for .c and .h files, the function, macro, and data type links
go to the corresponding source location. To configure your web browser for .c and .h files.
<ul>
<li>In the Download Preferences or Options panel, add file extensions 'c' and 'h' to mime type 'text/html'.
<li>Opera 12.10
<ol>
<li>In Tools > Preferences > Advanced > Downloads
<li>Uncheck 'Hide file types opened with Opera'
<li>Quick find 'html'
<li>Select 'text/html' > Edit
<li>Add File extensions 'c,h,'
<li>Click 'OK'
</ol>
<li>Internet Explorer -- Mime types are not available from 'Internet Options'. Is there a registry key for these settings?
<li>Firefox -- Mime types are not available from 'Preferences'. Is there an add-on to change the file extensions for a mime type?
<li>Chrome -- Can Chrome be configured?
</ul>
<p>
Please report documentation and link errors
to <a href="mailto:qhull-bug@qhull.org">qhull-bug@qhull.org</a>.
</blockquote>
<p><b>Copyright &copy; 1997-2015 C.B. Barber</b></p>
<hr>
<h2><a href="#TOP">&#187;</a><a name="TOC">Qhull files</a> </h2>
<blockquote>
<p>This sections lists the .c and .h files for Qhull. Please
refer to these files for detailed information.</p>
<blockquote>
<dl>
<dt><a href="../../Makefile"><b>Makefile</b></a><b>, </b><a href="../../CMakeLists.txt"><b>CMakeLists.txt</b></a></dt>
<dd><tt>Makefile</tt> is preconfigured for gcc. <tt>CMakeLists.txt</tt> supports multiple
platforms with <a href=http://www.cmake.org/>CMake</a>.
Qhull includes project files for Visual Studio and Qt.
</dd>
<dt>&nbsp;</dt>
<dt><a href="libqhull.h"><b>libqhull.h</b></a> </dt>
<dd>Include file for the Qhull library (<tt>libqhull.so</tt>, <tt>qhull.dll</tt>, <tt>libqhullstatic.a</tt>).
Data structures are documented under <a href="qh-poly.htm">Poly</a>.
Global variables are documented under <a href="qh-globa.htm">Global</a>.
Other data structures and variables are documented under
<a href="qh-qhull.htm#TOC">Qhull</a> or <a href="qh-geom.htm"><b>Geom</b></a><b>.</b></dd>
<dt>&nbsp;</dt>
<dt><a href="qh-geom.htm"><b>Geom</b></a><b>, </b>
<a href="geom.h"><b>geom.h</b></a><b>, </b>
<a href="geom.c"><b>geom.c</b></a><b>, </b>
<a href="geom2.c"><b>geom2.c</b></a><b>, </b>
<a href="random.c"><b>random.c</b></a><b>, </b>
<a href="random.h"><b>random.h</b></a></dt>
<dd>Geometric routines. These routines implement mathematical
functions such as Gaussian elimination and geometric
routines needed for Qhull. Frequently used routines are
in <tt>geom.c</tt> while infrequent ones are in <tt>geom2.c</tt>.
</dd>
<dt>&nbsp;</dt>
<dt><a href="qh-globa.htm"><b>Global</b></a><b>, </b>
<a href="global.c"><b>global.c</b></a><b>, </b>
<a href="libqhull.h"><b>libqhull.h</b></a> </dt>
<dd>Global routines. Qhull uses a global data structure, <tt>qh</tt>,
to store globally defined constants, lists, sets, and
variables.
<tt>global.c</tt> initializes and frees these
structures. </dd>
<dt>&nbsp;</dt>
<dt><a href="qh-io.htm"><b>Io</b></a><b>, </b><a href="io.h"><b>io.h</b></a><b>,
</b><a href="io.c"><b>io.c</b></a> </dt>
<dd>Input and output routines. Qhull provides a wide range of
input and output options.</dd>
<dt>&nbsp;</dt>
<dt><a href="qh-mem.htm"><b>Mem</b></a><b>, </b>
<a href="mem.h"><b>mem.h</b></a><b>, </b>
<a href="mem.c"><b>mem.c</b></a> </dt>
<dd>Memory routines. Qhull provides memory allocation and
deallocation. It uses quick-fit allocation.</dd>
<dt>&nbsp;</dt>
<dt><a href="qh-merge.htm"><b>Merge</b></a><b>, </b>
<a href="merge.h"><b>merge.h</b></a><b>, </b>
<a href="merge.c"><b>merge.c</b></a> </dt>
<dd>Merge routines. Qhull handles precision problems by
merged facets or joggled input. These routines merge simplicial facets,
merge non-simplicial facets, merge cycles of facets, and
rename redundant vertices.</dd>
<dt>&nbsp;</dt>
<dt><a href="qh-poly.htm"><b>Poly</b></a><b>, </b>
<a href="poly.h"><b>poly.h</b></a><b>, </b>
<a href="poly.c"><b>poly.c</b></a><b>, </b>
<a href="poly2.c"><b>poly2.c</b></a><b>, </b>
<a href="libqhull.h"><b>libqhull.h</b></a> </dt>
<dd>Polyhedral routines. Qhull produces a polyhedron as a
list of facets with vertices, neighbors, ridges, and
geometric information. <tt>libqhull.h</tt> defines the main
data structures. Frequently used routines are in <tt>poly.c</tt>
while infrequent ones are in <tt>poly2.c</tt>.</dd>
<dt>&nbsp;</dt>
<dt><a href="qh-qhull.htm#TOC"><b>Qhull</b></a><b>, </b>
<a href="libqhull.c"><b>libqhull.c</b></a><b>, </b>
<a href="libqhull.h"><b>libqhull.h</b></a><b>, </b>
<a href="qhull_a.h"><b>qhull_a.h</b></a><b>, </b>
<a href="../qhullo/unix.c"><b>unix.c</b></a> <b>, </b>
<a href="../qconvex/qconvex.c"><b>qconvex.c</b></a> <b>, </b>
<a href="../qdelaunay/qdelaun.c"><b>qdelaun.c</b></a> <b>, </b>
<a href="../qhalf/qhalf.c"><b>qhalf.c</b></a> <b>, </b>
<a href="../qvoronoi/qvoronoi.c"><b>qvoronoi.c</b></a> </dt>
<dd>Top-level routines. The Quickhull algorithm is
implemented by <tt>libqhull.c</tt>. <tt>qhull_a.h</tt>
includes all header files. </dd>
<dt>&nbsp;</dt>
<dt><a href="qh-set.htm"><b>Set</b></a><b>, </b>
<a href="qset.h"><b>qset.h</b></a><b>, </b>
<a href="qset.c"><b>qset.c</b></a> </dt>
<dd>Set routines. Qhull implements its data structures as
sets. A set is an array of pointers that is expanded as
needed. This is a separate package that may be used in
other applications. </dd>
<dt>&nbsp;</dt>
<dt><a href="qh-stat.htm"><b>Stat</b></a><b>, </b>
<a href="stat.h"><b>stat.h</b></a><b>, </b>
<a href="stat.c"><b>stat.c</b></a> </dt>
<dd>Statistical routines. Qhull maintains statistics about
its implementation. </dd>
<dt>&nbsp;</dt>
<dt><a href="qh-user.htm"><b>User</b></a><b>, </b>
<a href="user.h"><b>user.h</b></a><b>, </b>
<a href="user.c"><b>user.c</b></a><b>, </b>
<a href="../user_eg/user_eg.c"><b>user_eg.c</b></a><b>, </b>
<a href="../user_eg2/user_eg2.c"><b>user_eg2.c</b></a><b>, </b>
</dt>
<dd>User-defined routines. Qhull allows the user to configure
the code with defined constants and specialized routines.
</dd>
</dl>
</blockquote>
</blockquote>
<p><!-- Navigation links --> </p>
<hr>
<p><b>Up:</b>
<a href="http://www.qhull.org">Home page for
Qhull</a> <br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual: Table of Contents</a> <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
<b>To:</b> <a href="#TOC">Qhull files</a><br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149;
<a href="qh-globa.htm">Global</a> &#149; <a href="qh-io.htm">Io</a>
&#149; <a href="qh-mem.htm">Mem</a> &#149; <a href="qh-merge.htm">Merge</a>
&#149; <a href="qh-poly.htm">Poly</a> &#149; <a href="qh-qhull.htm#TOC">Qhull</a>
&#149; <a href="qh-set.htm">Set</a> &#149; <a href="qh-stat.htm">Stat</a>
&#149; <a href="qh-user.htm">User</a><br>
<p><!-- GC common information --> </p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img
src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
Geometry Center Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,159 @@
/*<html><pre> -<a href="qh-io.htm"
>-------------------------------</a><a name="TOP">-</a>
io.h
declarations of Input/Output functions
see README, libqhull.h and io.c
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull/io.h#1 $$Change: 1981 $
$DateTime: 2015/09/28 20:26:32 $$Author: bbarber $
*/
#ifndef qhDEFio
#define qhDEFio 1
#include "libqhull.h"
/*============ constants and flags ==================*/
/*-<a href="qh-io.htm#TOC"
>--------------------------------</a><a name="qh_MAXfirst">-</a>
qh_MAXfirst
maximum length of first two lines of stdin
*/
#define qh_MAXfirst 200
/*-<a href="qh-io.htm#TOC"
>--------------------------------</a><a name="qh_MINradius">-</a>
qh_MINradius
min radius for Gp and Gv, fraction of maxcoord
*/
#define qh_MINradius 0.02
/*-<a href="qh-io.htm#TOC"
>--------------------------------</a><a name="qh_GEOMepsilon">-</a>
qh_GEOMepsilon
adjust outer planes for 'lines closer' and geomview roundoff.
This prevents bleed through.
*/
#define qh_GEOMepsilon 2e-3
/*-<a href="qh-io.htm#TOC"
>--------------------------------</a><a name="qh_WHITESPACE">-</a>
qh_WHITESPACE
possible values of white space
*/
#define qh_WHITESPACE " \n\t\v\r\f"
/*-<a href="qh-io.htm#TOC"
>--------------------------------</a><a name="RIDGE">-</a>
qh_RIDGE
to select which ridges to print in qh_eachvoronoi
*/
typedef enum
{
qh_RIDGEall = 0, qh_RIDGEinner, qh_RIDGEouter
}
qh_RIDGE;
/*-<a href="qh-io.htm#TOC"
>--------------------------------</a><a name="printvridgeT">-</a>
printvridgeT
prints results of qh_printvdiagram
see:
<a href="io.c#printvridge">qh_printvridge</a> for an example
*/
typedef void (*printvridgeT)(FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded);
/*============== -prototypes in alphabetical order =========*/
void qh_dfacet(unsigned id);
void qh_dvertex(unsigned id);
int qh_compare_facetarea(const void *p1, const void *p2);
int qh_compare_facetmerge(const void *p1, const void *p2);
int qh_compare_facetvisit(const void *p1, const void *p2);
int qh_compare_vertexpoint(const void *p1, const void *p2); /* not used, not in libqhull_r.h */
void qh_copyfilename(char *filename, int size, const char* source, int length);
void qh_countfacets(facetT *facetlist, setT *facets, boolT printall,
int *numfacetsp, int *numsimplicialp, int *totneighborsp,
int *numridgesp, int *numcoplanarsp, int *numnumtricoplanarsp);
pointT *qh_detvnorm(vertexT *vertex, vertexT *vertexA, setT *centers, realT *offsetp);
setT *qh_detvridge(vertexT *vertex);
setT *qh_detvridge3(vertexT *atvertex, vertexT *vertex);
int qh_eachvoronoi(FILE *fp, printvridgeT printvridge, vertexT *atvertex, boolT visitall, qh_RIDGE innerouter, boolT inorder);
int qh_eachvoronoi_all(FILE *fp, printvridgeT printvridge, boolT isUpper, qh_RIDGE innerouter, boolT inorder);
void qh_facet2point(facetT *facet, pointT **point0, pointT **point1, realT *mindist);
setT *qh_facetvertices(facetT *facetlist, setT *facets, boolT allfacets);
void qh_geomplanes(facetT *facet, realT *outerplane, realT *innerplane);
void qh_markkeep(facetT *facetlist);
setT *qh_markvoronoi(facetT *facetlist, setT *facets, boolT printall, boolT *isLowerp, int *numcentersp);
void qh_order_vertexneighbors(vertexT *vertex);
void qh_prepare_output(void);
void qh_printafacet(FILE *fp, qh_PRINT format, facetT *facet, boolT printall);
void qh_printbegin(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
void qh_printcenter(FILE *fp, qh_PRINT format, const char *string, facetT *facet);
void qh_printcentrum(FILE *fp, facetT *facet, realT radius);
void qh_printend(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
void qh_printend4geom(FILE *fp, facetT *facet, int *num, boolT printall);
void qh_printextremes(FILE *fp, facetT *facetlist, setT *facets, boolT printall);
void qh_printextremes_2d(FILE *fp, facetT *facetlist, setT *facets, boolT printall);
void qh_printextremes_d(FILE *fp, facetT *facetlist, setT *facets, boolT printall);
void qh_printfacet(FILE *fp, facetT *facet);
void qh_printfacet2math(FILE *fp, facetT *facet, qh_PRINT format, int notfirst);
void qh_printfacet2geom(FILE *fp, facetT *facet, realT color[3]);
void qh_printfacet2geom_points(FILE *fp, pointT *point1, pointT *point2,
facetT *facet, realT offset, realT color[3]);
void qh_printfacet3math(FILE *fp, facetT *facet, qh_PRINT format, int notfirst);
void qh_printfacet3geom_nonsimplicial(FILE *fp, facetT *facet, realT color[3]);
void qh_printfacet3geom_points(FILE *fp, setT *points, facetT *facet, realT offset, realT color[3]);
void qh_printfacet3geom_simplicial(FILE *fp, facetT *facet, realT color[3]);
void qh_printfacet3vertex(FILE *fp, facetT *facet, qh_PRINT format);
void qh_printfacet4geom_nonsimplicial(FILE *fp, facetT *facet, realT color[3]);
void qh_printfacet4geom_simplicial(FILE *fp, facetT *facet, realT color[3]);
void qh_printfacetNvertex_nonsimplicial(FILE *fp, facetT *facet, int id, qh_PRINT format);
void qh_printfacetNvertex_simplicial(FILE *fp, facetT *facet, qh_PRINT format);
void qh_printfacetheader(FILE *fp, facetT *facet);
void qh_printfacetridges(FILE *fp, facetT *facet);
void qh_printfacets(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
void qh_printhyperplaneintersection(FILE *fp, facetT *facet1, facetT *facet2,
setT *vertices, realT color[3]);
void qh_printneighborhood(FILE *fp, qh_PRINT format, facetT *facetA, facetT *facetB, boolT printall);
void qh_printline3geom(FILE *fp, pointT *pointA, pointT *pointB, realT color[3]);
void qh_printpoint(FILE *fp, const char *string, pointT *point);
void qh_printpointid(FILE *fp, const char *string, int dim, pointT *point, int id);
void qh_printpoint3(FILE *fp, pointT *point);
void qh_printpoints_out(FILE *fp, facetT *facetlist, setT *facets, boolT printall);
void qh_printpointvect(FILE *fp, pointT *point, coordT *normal, pointT *center, realT radius, realT color[3]);
void qh_printpointvect2(FILE *fp, pointT *point, coordT *normal, pointT *center, realT radius);
void qh_printridge(FILE *fp, ridgeT *ridge);
void qh_printspheres(FILE *fp, setT *vertices, realT radius);
void qh_printvdiagram(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
int qh_printvdiagram2(FILE *fp, printvridgeT printvridge, setT *vertices, qh_RIDGE innerouter, boolT inorder);
void qh_printvertex(FILE *fp, vertexT *vertex);
void qh_printvertexlist(FILE *fp, const char* string, facetT *facetlist,
setT *facets, boolT printall);
void qh_printvertices(FILE *fp, const char* string, setT *vertices);
void qh_printvneighbors(FILE *fp, facetT* facetlist, setT *facets, boolT printall);
void qh_printvoronoi(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
void qh_printvnorm(FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded);
void qh_printvridge(FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded);
void qh_produce_output(void);
void qh_produce_output2(void);
void qh_projectdim3(pointT *source, pointT *destination);
int qh_readfeasible(int dim, const char *curline);
coordT *qh_readpoints(int *numpoints, int *dimension, boolT *ismalloc);
void qh_setfeasible(int dim);
boolT qh_skipfacet(facetT *facet);
char *qh_skipfilename(char *filename);
#endif /* qhDEFio */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,67 @@
# -------------------------------------------------
# libqhull.pro -- Qt project for Qhull shared library
# -------------------------------------------------
include(../qhull-warn.pri)
DESTDIR = ../../lib
DLLDESTDIR = ../../bin
TEMPLATE = lib
CONFIG += shared warn_on
CONFIG -= qt
build_pass:CONFIG(debug, debug|release):{
TARGET = qhull_d
OBJECTS_DIR = Debug
}else:build_pass:CONFIG(release, debug|release):{
TARGET = qhull
OBJECTS_DIR = Release
}
win32-msvc* : QMAKE_LFLAGS += /INCREMENTAL:NO
win32-msvc* : DEF_FILE += ../../src/libqhull/qhull-exports.def
# Order object files by frequency of execution. Small files at end.
# libqhull/libqhull.pro and ../qhull-libqhull-src.pri have the same SOURCES and HEADERS
SOURCES += ../libqhull/global.c
SOURCES += ../libqhull/stat.c
SOURCES += ../libqhull/geom2.c
SOURCES += ../libqhull/poly2.c
SOURCES += ../libqhull/merge.c
SOURCES += ../libqhull/libqhull.c
SOURCES += ../libqhull/geom.c
SOURCES += ../libqhull/poly.c
SOURCES += ../libqhull/qset.c
SOURCES += ../libqhull/mem.c
SOURCES += ../libqhull/random.c
SOURCES += ../libqhull/usermem.c
SOURCES += ../libqhull/userprintf.c
SOURCES += ../libqhull/io.c
SOURCES += ../libqhull/user.c
SOURCES += ../libqhull/rboxlib.c
SOURCES += ../libqhull/userprintf_rbox.c
HEADERS += ../libqhull/geom.h
HEADERS += ../libqhull/io.h
HEADERS += ../libqhull/libqhull.h
HEADERS += ../libqhull/mem.h
HEADERS += ../libqhull/merge.h
HEADERS += ../libqhull/poly.h
HEADERS += ../libqhull/random.h
HEADERS += ../libqhull/qhull_a.h
HEADERS += ../libqhull/qset.h
HEADERS += ../libqhull/stat.h
HEADERS += ../libqhull/user.h
OTHER_FILES += Mborland
OTHER_FILES += qh-geom.htm
OTHER_FILES += qh-globa.htm
OTHER_FILES += qh-io.htm
OTHER_FILES += qh-mem.htm
OTHER_FILES += qh-merge.htm
OTHER_FILES += qh-poly.htm
OTHER_FILES += qh-qhull.htm
OTHER_FILES += qh-set.htm
OTHER_FILES += qh-stat.htm
OTHER_FILES += qh-user.htm

View File

@ -0,0 +1,576 @@
/*<html><pre> -<a href="qh-mem.htm"
>-------------------------------</a><a name="TOP">-</a>
mem.c
memory management routines for qhull
This is a standalone program.
To initialize memory:
qh_meminit(stderr);
qh_meminitbuffers(qh IStracing, qh_MEMalign, 7, qh_MEMbufsize,qh_MEMinitbuf);
qh_memsize((int)sizeof(facetT));
qh_memsize((int)sizeof(facetT));
...
qh_memsetup();
To free up all memory buffers:
qh_memfreeshort(&curlong, &totlong);
if qh_NOmem,
malloc/free is used instead of mem.c
notes:
uses Quickfit algorithm (freelists for commonly allocated sizes)
assumes small sizes for freelists (it discards the tail of memory buffers)
see:
qh-mem.htm and mem.h
global.c (qh_initbuffers) for an example of using mem.c
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull/mem.c#7 $$Change: 2065 $
$DateTime: 2016/01/18 13:51:04 $$Author: bbarber $
*/
#include "user.h" /* for QHULL_CRTDBG */
#include "mem.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef qhDEFlibqhull
typedef struct ridgeT ridgeT;
typedef struct facetT facetT;
#ifdef _MSC_VER /* Microsoft Visual C++ -- warning level 4 */
#pragma warning( disable : 4127) /* conditional expression is constant */
#pragma warning( disable : 4706) /* assignment within conditional function */
#endif
void qh_errexit(int exitcode, facetT *, ridgeT *);
void qh_exit(int exitcode);
void qh_fprintf(FILE *fp, int msgcode, const char *fmt, ... );
void qh_fprintf_stderr(int msgcode, const char *fmt, ... );
void qh_free(void *mem);
void *qh_malloc(size_t size);
#endif
/*============ -global data structure ==============
see mem.h for definition
*/
qhmemT qhmem= {0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0}; /* remove "= {0}" if this causes a compiler error */
#ifndef qh_NOmem
/*============= internal functions ==============*/
static int qh_intcompare(const void *i, const void *j);
/*========== functions in alphabetical order ======== */
/*-<a href="qh-mem.htm#TOC"
>-------------------------------</a><a name="intcompare">-</a>
qh_intcompare( i, j )
used by qsort and bsearch to compare two integers
*/
static int qh_intcompare(const void *i, const void *j) {
return(*((const int *)i) - *((const int *)j));
} /* intcompare */
/*-<a href="qh-mem.htm#TOC"
>--------------------------------</a><a name="memalloc">-</a>
qh_memalloc( insize )
returns object of insize bytes
qhmem is the global memory structure
returns:
pointer to allocated memory
errors if insufficient memory
notes:
use explicit type conversion to avoid type warnings on some compilers
actual object may be larger than insize
use qh_memalloc_() for inline code for quick allocations
logs allocations if 'T5'
caller is responsible for freeing the memory.
short memory is freed on shutdown by qh_memfreeshort unless qh_NOmem
design:
if size < qhmem.LASTsize
if qhmem.freelists[size] non-empty
return first object on freelist
else
round up request to size of qhmem.freelists[size]
allocate new allocation buffer if necessary
allocate object from allocation buffer
else
allocate object with qh_malloc() in user.c
*/
void *qh_memalloc(int insize) {
void **freelistp, *newbuffer;
int idx, size, n;
int outsize, bufsize;
void *object;
if (insize<0) {
qh_fprintf(qhmem.ferr, 6235, "qhull error (qh_memalloc): negative request size (%d). Did int overflow due to high-D?\n", insize); /* WARN64 */
qh_errexit(qhmem_ERRmem, NULL, NULL);
}
if (insize>=0 && insize <= qhmem.LASTsize) {
idx= qhmem.indextable[insize];
outsize= qhmem.sizetable[idx];
qhmem.totshort += outsize;
freelistp= qhmem.freelists+idx;
if ((object= *freelistp)) {
qhmem.cntquick++;
qhmem.totfree -= outsize;
*freelistp= *((void **)*freelistp); /* replace freelist with next object */
#ifdef qh_TRACEshort
n= qhmem.cntshort+qhmem.cntquick+qhmem.freeshort;
if (qhmem.IStracing >= 5)
qh_fprintf(qhmem.ferr, 8141, "qh_mem %p n %8d alloc quick: %d bytes (tot %d cnt %d)\n", object, n, outsize, qhmem.totshort, qhmem.cntshort+qhmem.cntquick-qhmem.freeshort);
#endif
return(object);
}else {
qhmem.cntshort++;
if (outsize > qhmem.freesize) {
qhmem.totdropped += qhmem.freesize;
if (!qhmem.curbuffer)
bufsize= qhmem.BUFinit;
else
bufsize= qhmem.BUFsize;
if (!(newbuffer= qh_malloc((size_t)bufsize))) {
qh_fprintf(qhmem.ferr, 6080, "qhull error (qh_memalloc): insufficient memory to allocate short memory buffer (%d bytes)\n", bufsize);
qh_errexit(qhmem_ERRmem, NULL, NULL);
}
*((void **)newbuffer)= qhmem.curbuffer; /* prepend newbuffer to curbuffer
list. newbuffer!=0 by QH6080 */
qhmem.curbuffer= newbuffer;
size= (sizeof(void **) + qhmem.ALIGNmask) & ~qhmem.ALIGNmask;
qhmem.freemem= (void *)((char *)newbuffer+size);
qhmem.freesize= bufsize - size;
qhmem.totbuffer += bufsize - size; /* easier to check */
/* Periodically test totbuffer. It matches at beginning and exit of every call */
n = qhmem.totshort + qhmem.totfree + qhmem.totdropped + qhmem.freesize - outsize;
if (qhmem.totbuffer != n) {
qh_fprintf(qhmem.ferr, 6212, "qh_memalloc internal error: short totbuffer %d != totshort+totfree... %d\n", qhmem.totbuffer, n);
qh_errexit(qhmem_ERRmem, NULL, NULL);
}
}
object= qhmem.freemem;
qhmem.freemem= (void *)((char *)qhmem.freemem + outsize);
qhmem.freesize -= outsize;
qhmem.totunused += outsize - insize;
#ifdef qh_TRACEshort
n= qhmem.cntshort+qhmem.cntquick+qhmem.freeshort;
if (qhmem.IStracing >= 5)
qh_fprintf(qhmem.ferr, 8140, "qh_mem %p n %8d alloc short: %d bytes (tot %d cnt %d)\n", object, n, outsize, qhmem.totshort, qhmem.cntshort+qhmem.cntquick-qhmem.freeshort);
#endif
return object;
}
}else { /* long allocation */
if (!qhmem.indextable) {
qh_fprintf(qhmem.ferr, 6081, "qhull internal error (qh_memalloc): qhmem has not been initialized.\n");
qh_errexit(qhmem_ERRqhull, NULL, NULL);
}
outsize= insize;
qhmem.cntlong++;
qhmem.totlong += outsize;
if (qhmem.maxlong < qhmem.totlong)
qhmem.maxlong= qhmem.totlong;
if (!(object= qh_malloc((size_t)outsize))) {
qh_fprintf(qhmem.ferr, 6082, "qhull error (qh_memalloc): insufficient memory to allocate %d bytes\n", outsize);
qh_errexit(qhmem_ERRmem, NULL, NULL);
}
if (qhmem.IStracing >= 5)
qh_fprintf(qhmem.ferr, 8057, "qh_mem %p n %8d alloc long: %d bytes (tot %d cnt %d)\n", object, qhmem.cntlong+qhmem.freelong, outsize, qhmem.totlong, qhmem.cntlong-qhmem.freelong);
}
return(object);
} /* memalloc */
/*-<a href="qh-mem.htm#TOC"
>--------------------------------</a><a name="memcheck">-</a>
qh_memcheck( )
*/
void qh_memcheck(void) {
int i, count, totfree= 0;
void *object;
if (qhmem.ferr == 0 || qhmem.IStracing < 0 || qhmem.IStracing > 10 || (((qhmem.ALIGNmask+1) & qhmem.ALIGNmask) != 0)) {
qh_fprintf_stderr(6244, "qh_memcheck error: either qhmem is overwritten or qhmem is not initialized. Call qh_meminit() or qh_new_qhull() before calling qh_mem routines. ferr 0x%x IsTracing %d ALIGNmask 0x%x", qhmem.ferr, qhmem.IStracing, qhmem.ALIGNmask);
qh_exit(qhmem_ERRqhull); /* can not use qh_errexit() */
}
if (qhmem.IStracing != 0)
qh_fprintf(qhmem.ferr, 8143, "qh_memcheck: check size of freelists on qhmem\nqh_memcheck: A segmentation fault indicates an overwrite of qhmem\n");
for (i=0; i < qhmem.TABLEsize; i++) {
count=0;
for (object= qhmem.freelists[i]; object; object= *((void **)object))
count++;
totfree += qhmem.sizetable[i] * count;
}
if (totfree != qhmem.totfree) {
qh_fprintf(qhmem.ferr, 6211, "Qhull internal error (qh_memcheck): totfree %d not equal to freelist total %d\n", qhmem.totfree, totfree);
qh_errexit(qhmem_ERRqhull, NULL, NULL);
}
if (qhmem.IStracing != 0)
qh_fprintf(qhmem.ferr, 8144, "qh_memcheck: total size of freelists totfree is the same as qhmem.totfree\n", totfree);
} /* memcheck */
/*-<a href="qh-mem.htm#TOC"
>--------------------------------</a><a name="memfree">-</a>
qh_memfree( object, insize )
free up an object of size bytes
size is insize from qh_memalloc
notes:
object may be NULL
type checking warns if using (void **)object
use qh_memfree_() for quick free's of small objects
design:
if size <= qhmem.LASTsize
append object to corresponding freelist
else
call qh_free(object)
*/
void qh_memfree(void *object, int insize) {
void **freelistp;
int idx, outsize;
if (!object)
return;
if (insize <= qhmem.LASTsize) {
qhmem.freeshort++;
idx= qhmem.indextable[insize];
outsize= qhmem.sizetable[idx];
qhmem.totfree += outsize;
qhmem.totshort -= outsize;
freelistp= qhmem.freelists + idx;
*((void **)object)= *freelistp;
*freelistp= object;
#ifdef qh_TRACEshort
idx= qhmem.cntshort+qhmem.cntquick+qhmem.freeshort;
if (qhmem.IStracing >= 5)
qh_fprintf(qhmem.ferr, 8142, "qh_mem %p n %8d free short: %d bytes (tot %d cnt %d)\n", object, idx, outsize, qhmem.totshort, qhmem.cntshort+qhmem.cntquick-qhmem.freeshort);
#endif
}else {
qhmem.freelong++;
qhmem.totlong -= insize;
if (qhmem.IStracing >= 5)
qh_fprintf(qhmem.ferr, 8058, "qh_mem %p n %8d free long: %d bytes (tot %d cnt %d)\n", object, qhmem.cntlong+qhmem.freelong, insize, qhmem.totlong, qhmem.cntlong-qhmem.freelong);
qh_free(object);
}
} /* memfree */
/*-<a href="qh-mem.htm#TOC"
>-------------------------------</a><a name="memfreeshort">-</a>
qh_memfreeshort( curlong, totlong )
frees up all short and qhmem memory allocations
returns:
number and size of current long allocations
see:
qh_freeqhull(allMem)
qh_memtotal(curlong, totlong, curshort, totshort, maxlong, totbuffer);
*/
void qh_memfreeshort(int *curlong, int *totlong) {
void *buffer, *nextbuffer;
FILE *ferr;
*curlong= qhmem.cntlong - qhmem.freelong;
*totlong= qhmem.totlong;
for (buffer= qhmem.curbuffer; buffer; buffer= nextbuffer) {
nextbuffer= *((void **) buffer);
qh_free(buffer);
}
qhmem.curbuffer= NULL;
if (qhmem.LASTsize) {
qh_free(qhmem.indextable);
qh_free(qhmem.freelists);
qh_free(qhmem.sizetable);
}
ferr= qhmem.ferr;
memset((char *)&qhmem, 0, sizeof(qhmem)); /* every field is 0, FALSE, NULL */
qhmem.ferr= ferr;
} /* memfreeshort */
/*-<a href="qh-mem.htm#TOC"
>--------------------------------</a><a name="meminit">-</a>
qh_meminit( ferr )
initialize qhmem and test sizeof( void*)
Does not throw errors. qh_exit on failure
*/
void qh_meminit(FILE *ferr) {
memset((char *)&qhmem, 0, sizeof(qhmem)); /* every field is 0, FALSE, NULL */
if (ferr)
qhmem.ferr= ferr;
else
qhmem.ferr= stderr;
if (sizeof(void*) < sizeof(int)) {
qh_fprintf(qhmem.ferr, 6083, "qhull internal error (qh_meminit): sizeof(void*) %d < sizeof(int) %d. qset.c will not work\n", (int)sizeof(void*), (int)sizeof(int));
qh_exit(qhmem_ERRqhull); /* can not use qh_errexit() */
}
if (sizeof(void*) > sizeof(ptr_intT)) {
qh_fprintf(qhmem.ferr, 6084, "qhull internal error (qh_meminit): sizeof(void*) %d > sizeof(ptr_intT) %d. Change ptr_intT in mem.h to 'long long'\n", (int)sizeof(void*), (int)sizeof(ptr_intT));
qh_exit(qhmem_ERRqhull); /* can not use qh_errexit() */
}
qh_memcheck();
} /* meminit */
/*-<a href="qh-mem.htm#TOC"
>-------------------------------</a><a name="meminitbuffers">-</a>
qh_meminitbuffers( tracelevel, alignment, numsizes, bufsize, bufinit )
initialize qhmem
if tracelevel >= 5, trace memory allocations
alignment= desired address alignment for memory allocations
numsizes= number of freelists
bufsize= size of additional memory buffers for short allocations
bufinit= size of initial memory buffer for short allocations
*/
void qh_meminitbuffers(int tracelevel, int alignment, int numsizes, int bufsize, int bufinit) {
qhmem.IStracing= tracelevel;
qhmem.NUMsizes= numsizes;
qhmem.BUFsize= bufsize;
qhmem.BUFinit= bufinit;
qhmem.ALIGNmask= alignment-1;
if (qhmem.ALIGNmask & ~qhmem.ALIGNmask) {
qh_fprintf(qhmem.ferr, 6085, "qhull internal error (qh_meminit): memory alignment %d is not a power of 2\n", alignment);
qh_errexit(qhmem_ERRqhull, NULL, NULL);
}
qhmem.sizetable= (int *) calloc((size_t)numsizes, sizeof(int));
qhmem.freelists= (void **) calloc((size_t)numsizes, sizeof(void *));
if (!qhmem.sizetable || !qhmem.freelists) {
qh_fprintf(qhmem.ferr, 6086, "qhull error (qh_meminit): insufficient memory\n");
qh_errexit(qhmem_ERRmem, NULL, NULL);
}
if (qhmem.IStracing >= 1)
qh_fprintf(qhmem.ferr, 8059, "qh_meminitbuffers: memory initialized with alignment %d\n", alignment);
} /* meminitbuffers */
/*-<a href="qh-mem.htm#TOC"
>-------------------------------</a><a name="memsetup">-</a>
qh_memsetup()
set up memory after running memsize()
*/
void qh_memsetup(void) {
int k,i;
qsort(qhmem.sizetable, (size_t)qhmem.TABLEsize, sizeof(int), qh_intcompare);
qhmem.LASTsize= qhmem.sizetable[qhmem.TABLEsize-1];
if (qhmem.LASTsize >= qhmem.BUFsize || qhmem.LASTsize >= qhmem.BUFinit) {
qh_fprintf(qhmem.ferr, 6087, "qhull error (qh_memsetup): largest mem size %d is >= buffer size %d or initial buffer size %d\n",
qhmem.LASTsize, qhmem.BUFsize, qhmem.BUFinit);
qh_errexit(qhmem_ERRmem, NULL, NULL);
}
if (!(qhmem.indextable= (int *)qh_malloc((qhmem.LASTsize+1) * sizeof(int)))) {
qh_fprintf(qhmem.ferr, 6088, "qhull error (qh_memsetup): insufficient memory\n");
qh_errexit(qhmem_ERRmem, NULL, NULL);
}
for (k=qhmem.LASTsize+1; k--; )
qhmem.indextable[k]= k;
i= 0;
for (k=0; k <= qhmem.LASTsize; k++) {
if (qhmem.indextable[k] <= qhmem.sizetable[i])
qhmem.indextable[k]= i;
else
qhmem.indextable[k]= ++i;
}
} /* memsetup */
/*-<a href="qh-mem.htm#TOC"
>-------------------------------</a><a name="memsize">-</a>
qh_memsize( size )
define a free list for this size
*/
void qh_memsize(int size) {
int k;
if (qhmem.LASTsize) {
qh_fprintf(qhmem.ferr, 6089, "qhull error (qh_memsize): called after qhmem_setup\n");
qh_errexit(qhmem_ERRqhull, NULL, NULL);
}
size= (size + qhmem.ALIGNmask) & ~qhmem.ALIGNmask;
for (k=qhmem.TABLEsize; k--; ) {
if (qhmem.sizetable[k] == size)
return;
}
if (qhmem.TABLEsize < qhmem.NUMsizes)
qhmem.sizetable[qhmem.TABLEsize++]= size;
else
qh_fprintf(qhmem.ferr, 7060, "qhull warning (memsize): free list table has room for only %d sizes\n", qhmem.NUMsizes);
} /* memsize */
/*-<a href="qh-mem.htm#TOC"
>-------------------------------</a><a name="memstatistics">-</a>
qh_memstatistics( fp )
print out memory statistics
Verifies that qhmem.totfree == sum of freelists
*/
void qh_memstatistics(FILE *fp) {
int i;
int count;
void *object;
qh_memcheck();
qh_fprintf(fp, 9278, "\nmemory statistics:\n\
%7d quick allocations\n\
%7d short allocations\n\
%7d long allocations\n\
%7d short frees\n\
%7d long frees\n\
%7d bytes of short memory in use\n\
%7d bytes of short memory in freelists\n\
%7d bytes of dropped short memory\n\
%7d bytes of unused short memory (estimated)\n\
%7d bytes of long memory allocated (max, except for input)\n\
%7d bytes of long memory in use (in %d pieces)\n\
%7d bytes of short memory buffers (minus links)\n\
%7d bytes per short memory buffer (initially %d bytes)\n",
qhmem.cntquick, qhmem.cntshort, qhmem.cntlong,
qhmem.freeshort, qhmem.freelong,
qhmem.totshort, qhmem.totfree,
qhmem.totdropped + qhmem.freesize, qhmem.totunused,
qhmem.maxlong, qhmem.totlong, qhmem.cntlong - qhmem.freelong,
qhmem.totbuffer, qhmem.BUFsize, qhmem.BUFinit);
if (qhmem.cntlarger) {
qh_fprintf(fp, 9279, "%7d calls to qh_setlarger\n%7.2g average copy size\n",
qhmem.cntlarger, ((float)qhmem.totlarger)/(float)qhmem.cntlarger);
qh_fprintf(fp, 9280, " freelists(bytes->count):");
}
for (i=0; i < qhmem.TABLEsize; i++) {
count=0;
for (object= qhmem.freelists[i]; object; object= *((void **)object))
count++;
qh_fprintf(fp, 9281, " %d->%d", qhmem.sizetable[i], count);
}
qh_fprintf(fp, 9282, "\n\n");
} /* memstatistics */
/*-<a href="qh-mem.htm#TOC"
>-------------------------------</a><a name="NOmem">-</a>
qh_NOmem
turn off quick-fit memory allocation
notes:
uses qh_malloc() and qh_free() instead
*/
#else /* qh_NOmem */
void *qh_memalloc(int insize) {
void *object;
if (!(object= qh_malloc((size_t)insize))) {
qh_fprintf(qhmem.ferr, 6090, "qhull error (qh_memalloc): insufficient memory\n");
qh_errexit(qhmem_ERRmem, NULL, NULL);
}
qhmem.cntlong++;
qhmem.totlong += insize;
if (qhmem.maxlong < qhmem.totlong)
qhmem.maxlong= qhmem.totlong;
if (qhmem.IStracing >= 5)
qh_fprintf(qhmem.ferr, 8060, "qh_mem %p n %8d alloc long: %d bytes (tot %d cnt %d)\n", object, qhmem.cntlong+qhmem.freelong, insize, qhmem.totlong, qhmem.cntlong-qhmem.freelong);
return object;
}
void qh_memfree(void *object, int insize) {
if (!object)
return;
qh_free(object);
qhmem.freelong++;
qhmem.totlong -= insize;
if (qhmem.IStracing >= 5)
qh_fprintf(qhmem.ferr, 8061, "qh_mem %p n %8d free long: %d bytes (tot %d cnt %d)\n", object, qhmem.cntlong+qhmem.freelong, insize, qhmem.totlong, qhmem.cntlong-qhmem.freelong);
}
void qh_memfreeshort(int *curlong, int *totlong) {
*totlong= qhmem.totlong;
*curlong= qhmem.cntlong - qhmem.freelong;
memset((char *)&qhmem, 0, sizeof(qhmem)); /* every field is 0, FALSE, NULL */
}
void qh_meminit(FILE *ferr) {
memset((char *)&qhmem, 0, sizeof(qhmem)); /* every field is 0, FALSE, NULL */
if (ferr)
qhmem.ferr= ferr;
else
qhmem.ferr= stderr;
if (sizeof(void*) < sizeof(int)) {
qh_fprintf(qhmem.ferr, 6091, "qhull internal error (qh_meminit): sizeof(void*) %d < sizeof(int) %d. qset.c will not work\n", (int)sizeof(void*), (int)sizeof(int));
qh_errexit(qhmem_ERRqhull, NULL, NULL);
}
}
void qh_meminitbuffers(int tracelevel, int alignment, int numsizes, int bufsize, int bufinit) {
qhmem.IStracing= tracelevel;
}
void qh_memsetup(void) {
}
void qh_memsize(int size) {
}
void qh_memstatistics(FILE *fp) {
qh_fprintf(fp, 9409, "\nmemory statistics:\n\
%7d long allocations\n\
%7d long frees\n\
%7d bytes of long memory allocated (max, except for input)\n\
%7d bytes of long memory in use (in %d pieces)\n",
qhmem.cntlong,
qhmem.freelong,
qhmem.maxlong, qhmem.totlong, qhmem.cntlong - qhmem.freelong);
}
#endif /* qh_NOmem */
/*-<a href="qh-mem.htm#TOC"
>-------------------------------</a><a name="memtotlong">-</a>
qh_memtotal( totlong, curlong, totshort, curshort, maxlong, totbuffer )
Return the total, allocated long and short memory
returns:
Returns the total current bytes of long and short allocations
Returns the current count of long and short allocations
Returns the maximum long memory and total short buffer (minus one link per buffer)
Does not error (UsingLibQhull.cpp)
*/
void qh_memtotal(int *totlong, int *curlong, int *totshort, int *curshort, int *maxlong, int *totbuffer) {
*totlong= qhmem.totlong;
*curlong= qhmem.cntlong - qhmem.freelong;
*totshort= qhmem.totshort;
*curshort= qhmem.cntshort + qhmem.cntquick - qhmem.freeshort;
*maxlong= qhmem.maxlong;
*totbuffer= qhmem.totbuffer;
} /* memtotlong */

View File

@ -0,0 +1,222 @@
/*<html><pre> -<a href="qh-mem.htm"
>-------------------------------</a><a name="TOP">-</a>
mem.h
prototypes for memory management functions
see qh-mem.htm, mem.c and qset.h
for error handling, writes message and calls
qh_errexit(qhmem_ERRmem, NULL, NULL) if insufficient memory
and
qh_errexit(qhmem_ERRqhull, NULL, NULL) otherwise
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull/mem.h#2 $$Change: 2062 $
$DateTime: 2016/01/17 13:13:18 $$Author: bbarber $
*/
#ifndef qhDEFmem
#define qhDEFmem 1
#include <stdio.h>
/*-<a href="qh-mem.htm#TOC"
>-------------------------------</a><a name="NOmem">-</a>
qh_NOmem
turn off quick-fit memory allocation
notes:
mem.c implements Quickfit memory allocation for about 20% time
savings. If it fails on your machine, try to locate the
problem, and send the answer to qhull@qhull.org. If this can
not be done, define qh_NOmem to use malloc/free instead.
#define qh_NOmem
*/
/*-<a href="qh-mem.htm#TOC"
>-------------------------------</a><a name="TRACEshort">-</a>
qh_TRACEshort
Trace short and quick memory allocations at T5
*/
#define qh_TRACEshort
/*-------------------------------------------
to avoid bus errors, memory allocation must consider alignment requirements.
malloc() automatically takes care of alignment. Since mem.c manages
its own memory, we need to explicitly specify alignment in
qh_meminitbuffers().
A safe choice is sizeof(double). sizeof(float) may be used if doubles
do not occur in data structures and pointers are the same size. Be careful
of machines (e.g., DEC Alpha) with large pointers. If gcc is available,
use __alignof__(double) or fmax_(__alignof__(float), __alignof__(void *)).
see <a href="user.h#MEMalign">qh_MEMalign</a> in user.h for qhull's alignment
*/
#define qhmem_ERRmem 4 /* matches qh_ERRmem in libqhull.h */
#define qhmem_ERRqhull 5 /* matches qh_ERRqhull in libqhull.h */
/*-<a href="qh-mem.htm#TOC"
>--------------------------------</a><a name="ptr_intT">-</a>
ptr_intT
for casting a void * to an integer-type that holds a pointer
Used for integer expressions (e.g., computing qh_gethash() in poly.c)
notes:
WARN64 -- these notes indicate 64-bit issues
On 64-bit machines, a pointer may be larger than an 'int'.
qh_meminit()/mem.c checks that 'ptr_intT' holds a 'void*'
ptr_intT is typically a signed value, but not necessarily so
size_t is typically unsigned, but should match the parameter type
Qhull uses int instead of size_t except for system calls such as malloc, qsort, qh_malloc, etc.
This matches Qt convention and is easier to work with.
*/
#if (defined(__MINGW64__)) && defined(_WIN64)
typedef long long ptr_intT;
#elif (_MSC_VER) && defined(_WIN64)
typedef long long ptr_intT;
#else
typedef long ptr_intT;
#endif
/*-<a href="qh-mem.htm#TOC"
>--------------------------------</a><a name="qhmemT">-</a>
qhmemT
global memory structure for mem.c
notes:
users should ignore qhmem except for writing extensions
qhmem is allocated in mem.c
qhmem could be swapable like qh and qhstat, but then
multiple qh's and qhmem's would need to keep in synch.
A swapable qhmem would also waste memory buffers. As long
as memory operations are atomic, there is no problem with
multiple qh structures being active at the same time.
If you need separate address spaces, you can swap the
contents of qhmem.
*/
typedef struct qhmemT qhmemT;
extern qhmemT qhmem;
#ifndef DEFsetT
#define DEFsetT 1
typedef struct setT setT; /* defined in qset.h */
#endif
/* Update qhmem in mem.c if add or remove fields */
struct qhmemT { /* global memory management variables */
int BUFsize; /* size of memory allocation buffer */
int BUFinit; /* initial size of memory allocation buffer */
int TABLEsize; /* actual number of sizes in free list table */
int NUMsizes; /* maximum number of sizes in free list table */
int LASTsize; /* last size in free list table */
int ALIGNmask; /* worst-case alignment, must be 2^n-1 */
void **freelists; /* free list table, linked by offset 0 */
int *sizetable; /* size of each freelist */
int *indextable; /* size->index table */
void *curbuffer; /* current buffer, linked by offset 0 */
void *freemem; /* free memory in curbuffer */
int freesize; /* size of freemem in bytes */
setT *tempstack; /* stack of temporary memory, managed by users */
FILE *ferr; /* file for reporting errors when 'qh' may be undefined */
int IStracing; /* =5 if tracing memory allocations */
int cntquick; /* count of quick allocations */
/* Note: removing statistics doesn't effect speed */
int cntshort; /* count of short allocations */
int cntlong; /* count of long allocations */
int freeshort; /* count of short memfrees */
int freelong; /* count of long memfrees */
int totbuffer; /* total short memory buffers minus buffer links */
int totdropped; /* total dropped memory at end of short memory buffers (e.g., freesize) */
int totfree; /* total size of free, short memory on freelists */
int totlong; /* total size of long memory in use */
int maxlong; /* maximum totlong */
int totshort; /* total size of short memory in use */
int totunused; /* total unused short memory (estimated, short size - request size of first allocations) */
int cntlarger; /* count of setlarger's */
int totlarger; /* total copied by setlarger */
};
/*==================== -macros ====================*/
/*-<a href="qh-mem.htm#TOC"
>--------------------------------</a><a name="memalloc_">-</a>
qh_memalloc_(insize, freelistp, object, type)
returns object of size bytes
assumes size<=qhmem.LASTsize and void **freelistp is a temp
*/
#if defined qh_NOmem
#define qh_memalloc_(insize, freelistp, object, type) {\
object= (type*)qh_memalloc(insize); }
#elif defined qh_TRACEshort
#define qh_memalloc_(insize, freelistp, object, type) {\
freelistp= NULL; /* Avoid warnings */ \
object= (type*)qh_memalloc(insize); }
#else /* !qh_NOmem */
#define qh_memalloc_(insize, freelistp, object, type) {\
freelistp= qhmem.freelists + qhmem.indextable[insize];\
if ((object= (type*)*freelistp)) {\
qhmem.totshort += qhmem.sizetable[qhmem.indextable[insize]]; \
qhmem.totfree -= qhmem.sizetable[qhmem.indextable[insize]]; \
qhmem.cntquick++; \
*freelistp= *((void **)*freelistp);\
}else object= (type*)qh_memalloc(insize);}
#endif
/*-<a href="qh-mem.htm#TOC"
>--------------------------------</a><a name="memfree_">-</a>
qh_memfree_(object, insize, freelistp)
free up an object
notes:
object may be NULL
assumes size<=qhmem.LASTsize and void **freelistp is a temp
*/
#if defined qh_NOmem
#define qh_memfree_(object, insize, freelistp) {\
qh_memfree(object, insize); }
#elif defined qh_TRACEshort
#define qh_memfree_(object, insize, freelistp) {\
freelistp= NULL; /* Avoid warnings */ \
qh_memfree(object, insize); }
#else /* !qh_NOmem */
#define qh_memfree_(object, insize, freelistp) {\
if (object) { \
qhmem.freeshort++;\
freelistp= qhmem.freelists + qhmem.indextable[insize];\
qhmem.totshort -= qhmem.sizetable[qhmem.indextable[insize]]; \
qhmem.totfree += qhmem.sizetable[qhmem.indextable[insize]]; \
*((void **)object)= *freelistp;\
*freelistp= object;}}
#endif
/*=============== prototypes in alphabetical order ============*/
void *qh_memalloc(int insize);
void qh_memcheck(void);
void qh_memfree(void *object, int insize);
void qh_memfreeshort(int *curlong, int *totlong);
void qh_meminit(FILE *ferr);
void qh_meminitbuffers(int tracelevel, int alignment, int numsizes,
int bufsize, int bufinit);
void qh_memsetup(void);
void qh_memsize(int size);
void qh_memstatistics(FILE *fp);
void qh_memtotal(int *totlong, int *curlong, int *totshort, int *curshort, int *maxlong, int *totbuffer);
#endif /* qhDEFmem */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,178 @@
/*<html><pre> -<a href="qh-merge.htm"
>-------------------------------</a><a name="TOP">-</a>
merge.h
header file for merge.c
see qh-merge.htm and merge.c
Copyright (c) 1993-2015 C.B. Barber.
$Id: //main/2015/qhull/src/libqhull/merge.h#1 $$Change: 1981 $
$DateTime: 2015/09/28 20:26:32 $$Author: bbarber $
*/
#ifndef qhDEFmerge
#define qhDEFmerge 1
#include "libqhull.h"
/*============ -constants- ==============*/
/*-<a href="qh-merge.htm#TOC"
>--------------------------------</a><a name="qh_ANGLEredundant">-</a>
qh_ANGLEredundant
indicates redundant merge in mergeT->angle
*/
#define qh_ANGLEredundant 6.0
/*-<a href="qh-merge.htm#TOC"
>--------------------------------</a><a name="qh_ANGLEdegen">-</a>
qh_ANGLEdegen
indicates degenerate facet in mergeT->angle
*/
#define qh_ANGLEdegen 5.0
/*-<a href="qh-merge.htm#TOC"
>--------------------------------</a><a name="qh_ANGLEconcave">-</a>
qh_ANGLEconcave
offset to indicate concave facets in mergeT->angle
notes:
concave facets are assigned the range of [2,4] in mergeT->angle
roundoff error may make the angle less than 2
*/
#define qh_ANGLEconcave 1.5
/*-<a href="qh-merge.htm#TOC"
>--------------------------------</a><a name="MRG">-</a>
MRG... (mergeType)
indicates the type of a merge (mergeT->type)
*/
typedef enum { /* in sort order for facet_mergeset */
MRGnone= 0,
MRGcoplanar, /* centrum coplanar */
MRGanglecoplanar, /* angle coplanar */
/* could detect half concave ridges */
MRGconcave, /* concave ridge */
MRGflip, /* flipped facet. facet1 == facet2 */
MRGridge, /* duplicate ridge (qh_MERGEridge) */
/* degen and redundant go onto degen_mergeset */
MRGdegen, /* degenerate facet (!enough neighbors) facet1 == facet2 */
MRGredundant, /* redundant facet (vertex subset) */
/* merge_degenredundant assumes degen < redundant */
MRGmirror, /* mirror facet from qh_triangulate */
ENDmrg
} mergeType;
/*-<a href="qh-merge.htm#TOC"
>--------------------------------</a><a name="qh_MERGEapex">-</a>
qh_MERGEapex
flag for qh_mergefacet() to indicate an apex merge
*/
#define qh_MERGEapex True
/*============ -structures- ====================*/
/*-<a href="qh-merge.htm#TOC"
>--------------------------------</a><a name="mergeT">-</a>
mergeT
structure used to merge facets
*/
typedef struct mergeT mergeT;
struct mergeT { /* initialize in qh_appendmergeset */
realT angle; /* angle between normals of facet1 and facet2 */
facetT *facet1; /* will merge facet1 into facet2 */
facetT *facet2;
mergeType type;
};
/*=========== -macros- =========================*/
/*-<a href="qh-merge.htm#TOC"
>--------------------------------</a><a name="FOREACHmerge_">-</a>
FOREACHmerge_( merges ) {...}
assign 'merge' to each merge in merges
notes:
uses 'mergeT *merge, **mergep;'
if qh_mergefacet(),
restart since qh.facet_mergeset may change
see <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
*/
#define FOREACHmerge_( merges ) FOREACHsetelement_(mergeT, merges, merge)
/*============ prototypes in alphabetical order after pre/postmerge =======*/
void qh_premerge(vertexT *apex, realT maxcentrum, realT maxangle);
void qh_postmerge(const char *reason, realT maxcentrum, realT maxangle,
boolT vneighbors);
void qh_all_merges(boolT othermerge, boolT vneighbors);
void qh_appendmergeset(facetT *facet, facetT *neighbor, mergeType mergetype, realT *angle);
setT *qh_basevertices( facetT *samecycle);
void qh_checkconnect(void /* qh.new_facets */);
boolT qh_checkzero(boolT testall);
int qh_compareangle(const void *p1, const void *p2);
int qh_comparemerge(const void *p1, const void *p2);
int qh_comparevisit(const void *p1, const void *p2);
void qh_copynonconvex(ridgeT *atridge);
void qh_degen_redundant_facet(facetT *facet);
void qh_degen_redundant_neighbors(facetT *facet, facetT *delfacet);
vertexT *qh_find_newvertex(vertexT *oldvertex, setT *vertices, setT *ridges);
void qh_findbest_test(boolT testcentrum, facetT *facet, facetT *neighbor,
facetT **bestfacet, realT *distp, realT *mindistp, realT *maxdistp);
facetT *qh_findbestneighbor(facetT *facet, realT *distp, realT *mindistp, realT *maxdistp);
void qh_flippedmerges(facetT *facetlist, boolT *wasmerge);
void qh_forcedmerges( boolT *wasmerge);
void qh_getmergeset(facetT *facetlist);
void qh_getmergeset_initial(facetT *facetlist);
void qh_hashridge(setT *hashtable, int hashsize, ridgeT *ridge, vertexT *oldvertex);
ridgeT *qh_hashridge_find(setT *hashtable, int hashsize, ridgeT *ridge,
vertexT *vertex, vertexT *oldvertex, int *hashslot);
void qh_makeridges(facetT *facet);
void qh_mark_dupridges(facetT *facetlist);
void qh_maydropneighbor(facetT *facet);
int qh_merge_degenredundant(void);
void qh_merge_nonconvex( facetT *facet1, facetT *facet2, mergeType mergetype);
void qh_mergecycle(facetT *samecycle, facetT *newfacet);
void qh_mergecycle_all(facetT *facetlist, boolT *wasmerge);
void qh_mergecycle_facets( facetT *samecycle, facetT *newfacet);
void qh_mergecycle_neighbors(facetT *samecycle, facetT *newfacet);
void qh_mergecycle_ridges(facetT *samecycle, facetT *newfacet);
void qh_mergecycle_vneighbors( facetT *samecycle, facetT *newfacet);
void qh_mergefacet(facetT *facet1, facetT *facet2, realT *mindist, realT *maxdist, boolT mergeapex);
void qh_mergefacet2d(facetT *facet1, facetT *facet2);
void qh_mergeneighbors(facetT *facet1, facetT *facet2);
void qh_mergeridges(facetT *facet1, facetT *facet2);
void qh_mergesimplex(facetT *facet1, facetT *facet2, boolT mergeapex);
void qh_mergevertex_del(vertexT *vertex, facetT *facet1, facetT *facet2);
void qh_mergevertex_neighbors(facetT *facet1, facetT *facet2);
void qh_mergevertices(setT *vertices1, setT **vertices);
setT *qh_neighbor_intersections(vertexT *vertex);
void qh_newvertices(setT *vertices);
boolT qh_reducevertices(void);
vertexT *qh_redundant_vertex(vertexT *vertex);
boolT qh_remove_extravertices(facetT *facet);
vertexT *qh_rename_sharedvertex(vertexT *vertex, facetT *facet);
void qh_renameridgevertex(ridgeT *ridge, vertexT *oldvertex, vertexT *newvertex);
void qh_renamevertex(vertexT *oldvertex, vertexT *newvertex, setT *ridges,
facetT *oldfacet, facetT *neighborA);
boolT qh_test_appendmerge(facetT *facet, facetT *neighbor);
boolT qh_test_vneighbors(void /* qh.newfacet_list */);
void qh_tracemerge(facetT *facet1, facetT *facet2);
void qh_tracemerging(void);
void qh_updatetested( facetT *facet1, facetT *facet2);
setT *qh_vertexridges(vertexT *vertex);
void qh_vertexridges_facet(vertexT *vertex, facetT *facet, setT **ridges);
void qh_willdelete(facetT *facet, facetT *replace);
#endif /* qhDEFmerge */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,296 @@
/*<html><pre> -<a href="qh-poly.htm"
>-------------------------------</a><a name="TOP">-</a>
poly.h
header file for poly.c and poly2.c
see qh-poly.htm, libqhull.h and poly.c
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull/poly.h#3 $$Change: 2047 $
$DateTime: 2016/01/04 22:03:18 $$Author: bbarber $
*/
#ifndef qhDEFpoly
#define qhDEFpoly 1
#include "libqhull.h"
/*=============== constants ========================== */
/*-<a href="qh-geom.htm#TOC"
>--------------------------------</a><a name="ALGORITHMfault">-</a>
ALGORITHMfault
use as argument to checkconvex() to report errors during buildhull
*/
#define qh_ALGORITHMfault 0
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="DATAfault">-</a>
DATAfault
use as argument to checkconvex() to report errors during initialhull
*/
#define qh_DATAfault 1
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="DUPLICATEridge">-</a>
DUPLICATEridge
special value for facet->neighbor to indicate a duplicate ridge
notes:
set by matchneighbor, used by matchmatch and mark_dupridge
*/
#define qh_DUPLICATEridge (facetT *)1L
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="MERGEridge">-</a>
MERGEridge flag in facet
special value for facet->neighbor to indicate a merged ridge
notes:
set by matchneighbor, used by matchmatch and mark_dupridge
*/
#define qh_MERGEridge (facetT *)2L
/*============ -structures- ====================*/
/*=========== -macros- =========================*/
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="FORALLfacet_">-</a>
FORALLfacet_( facetlist ) { ... }
assign 'facet' to each facet in facetlist
notes:
uses 'facetT *facet;'
assumes last facet is a sentinel
see:
FORALLfacets
*/
#define FORALLfacet_( facetlist ) if (facetlist ) for ( facet=( facetlist ); facet && facet->next; facet= facet->next )
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="FORALLnew_facets">-</a>
FORALLnew_facets { ... }
assign 'newfacet' to each facet in qh.newfacet_list
notes:
uses 'facetT *newfacet;'
at exit, newfacet==NULL
*/
#define FORALLnew_facets for ( newfacet=qh newfacet_list;newfacet && newfacet->next;newfacet=newfacet->next )
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="FORALLvertex_">-</a>
FORALLvertex_( vertexlist ) { ... }
assign 'vertex' to each vertex in vertexlist
notes:
uses 'vertexT *vertex;'
at exit, vertex==NULL
*/
#define FORALLvertex_( vertexlist ) for (vertex=( vertexlist );vertex && vertex->next;vertex= vertex->next )
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="FORALLvisible_facets">-</a>
FORALLvisible_facets { ... }
assign 'visible' to each visible facet in qh.visible_list
notes:
uses 'vacetT *visible;'
at exit, visible==NULL
*/
#define FORALLvisible_facets for (visible=qh visible_list; visible && visible->visible; visible= visible->next)
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="FORALLsame_">-</a>
FORALLsame_( newfacet ) { ... }
assign 'same' to each facet in newfacet->f.samecycle
notes:
uses 'facetT *same;'
stops when it returns to newfacet
*/
#define FORALLsame_(newfacet) for (same= newfacet->f.samecycle; same != newfacet; same= same->f.samecycle)
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="FORALLsame_cycle_">-</a>
FORALLsame_cycle_( newfacet ) { ... }
assign 'same' to each facet in newfacet->f.samecycle
notes:
uses 'facetT *same;'
at exit, same == NULL
*/
#define FORALLsame_cycle_(newfacet) \
for (same= newfacet->f.samecycle; \
same; same= (same == newfacet ? NULL : same->f.samecycle))
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="FOREACHneighborA_">-</a>
FOREACHneighborA_( facet ) { ... }
assign 'neighborA' to each neighbor in facet->neighbors
FOREACHneighborA_( vertex ) { ... }
assign 'neighborA' to each neighbor in vertex->neighbors
declare:
facetT *neighborA, **neighborAp;
see:
<a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
*/
#define FOREACHneighborA_(facet) FOREACHsetelement_(facetT, facet->neighbors, neighborA)
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="FOREACHvisible_">-</a>
FOREACHvisible_( facets ) { ... }
assign 'visible' to each facet in facets
notes:
uses 'facetT *facet, *facetp;'
see <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
*/
#define FOREACHvisible_(facets) FOREACHsetelement_(facetT, facets, visible)
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="FOREACHnewfacet_">-</a>
FOREACHnewfacet_( facets ) { ... }
assign 'newfacet' to each facet in facets
notes:
uses 'facetT *newfacet, *newfacetp;'
see <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
*/
#define FOREACHnewfacet_(facets) FOREACHsetelement_(facetT, facets, newfacet)
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="FOREACHvertexA_">-</a>
FOREACHvertexA_( vertices ) { ... }
assign 'vertexA' to each vertex in vertices
notes:
uses 'vertexT *vertexA, *vertexAp;'
see <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
*/
#define FOREACHvertexA_(vertices) FOREACHsetelement_(vertexT, vertices, vertexA)
/*-<a href="qh-poly.htm#TOC"
>--------------------------------</a><a name="FOREACHvertexreverse12_">-</a>
FOREACHvertexreverse12_( vertices ) { ... }
assign 'vertex' to each vertex in vertices
reverse order of first two vertices
notes:
uses 'vertexT *vertex, *vertexp;'
see <a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
*/
#define FOREACHvertexreverse12_(vertices) FOREACHsetelementreverse12_(vertexT, vertices, vertex)
/*=============== prototypes poly.c in alphabetical order ================*/
void qh_appendfacet(facetT *facet);
void qh_appendvertex(vertexT *vertex);
void qh_attachnewfacets(void /* qh.visible_list, qh.newfacet_list */);
boolT qh_checkflipped(facetT *facet, realT *dist, boolT allerror);
void qh_delfacet(facetT *facet);
void qh_deletevisible(void /*qh.visible_list, qh.horizon_list*/);
setT *qh_facetintersect(facetT *facetA, facetT *facetB, int *skipAp,int *skipBp, int extra);
int qh_gethash(int hashsize, setT *set, int size, int firstindex, void *skipelem);
facetT *qh_makenewfacet(setT *vertices, boolT toporient, facetT *facet);
void qh_makenewplanes(void /* newfacet_list */);
facetT *qh_makenew_nonsimplicial(facetT *visible, vertexT *apex, int *numnew);
facetT *qh_makenew_simplicial(facetT *visible, vertexT *apex, int *numnew);
void qh_matchneighbor(facetT *newfacet, int newskip, int hashsize,
int *hashcount);
void qh_matchnewfacets(void);
boolT qh_matchvertices(int firstindex, setT *verticesA, int skipA,
setT *verticesB, int *skipB, boolT *same);
facetT *qh_newfacet(void);
ridgeT *qh_newridge(void);
int qh_pointid(pointT *point);
void qh_removefacet(facetT *facet);
void qh_removevertex(vertexT *vertex);
void qh_updatevertices(void);
/*========== -prototypes poly2.c in alphabetical order ===========*/
void qh_addhash(void* newelem, setT *hashtable, int hashsize, int hash);
void qh_check_bestdist(void);
void qh_check_dupridge(facetT *facet1, realT dist1, facetT *facet2, realT dist2);
void qh_check_maxout(void);
void qh_check_output(void);
void qh_check_point(pointT *point, facetT *facet, realT *maxoutside, realT *maxdist, facetT **errfacet1, facetT **errfacet2);
void qh_check_points(void);
void qh_checkconvex(facetT *facetlist, int fault);
void qh_checkfacet(facetT *facet, boolT newmerge, boolT *waserrorp);
void qh_checkflipped_all(facetT *facetlist);
void qh_checkpolygon(facetT *facetlist);
void qh_checkvertex(vertexT *vertex);
void qh_clearcenters(qh_CENTER type);
void qh_createsimplex(setT *vertices);
void qh_delridge(ridgeT *ridge);
void qh_delvertex(vertexT *vertex);
setT *qh_facet3vertex(facetT *facet);
facetT *qh_findbestfacet(pointT *point, boolT bestoutside,
realT *bestdist, boolT *isoutside);
facetT *qh_findbestlower(facetT *upperfacet, pointT *point, realT *bestdistp, int *numpart);
facetT *qh_findfacet_all(pointT *point, realT *bestdist, boolT *isoutside,
int *numpart);
int qh_findgood(facetT *facetlist, int goodhorizon);
void qh_findgood_all(facetT *facetlist);
void qh_furthestnext(void /* qh.facet_list */);
void qh_furthestout(facetT *facet);
void qh_infiniteloop(facetT *facet);
void qh_initbuild(void);
void qh_initialhull(setT *vertices);
setT *qh_initialvertices(int dim, setT *maxpoints, pointT *points, int numpoints);
vertexT *qh_isvertex(pointT *point, setT *vertices);
vertexT *qh_makenewfacets(pointT *point /*horizon_list, visible_list*/);
void qh_matchduplicates(facetT *atfacet, int atskip, int hashsize, int *hashcount);
void qh_nearcoplanar(void /* qh.facet_list */);
vertexT *qh_nearvertex(facetT *facet, pointT *point, realT *bestdistp);
int qh_newhashtable(int newsize);
vertexT *qh_newvertex(pointT *point);
ridgeT *qh_nextridge3d(ridgeT *atridge, facetT *facet, vertexT **vertexp);
void qh_outcoplanar(void /* facet_list */);
pointT *qh_point(int id);
void qh_point_add(setT *set, pointT *point, void *elem);
setT *qh_pointfacet(void /*qh.facet_list*/);
setT *qh_pointvertex(void /*qh.facet_list*/);
void qh_prependfacet(facetT *facet, facetT **facetlist);
void qh_printhashtable(FILE *fp);
void qh_printlists(void);
void qh_resetlists(boolT stats, boolT resetVisible /*qh.newvertex_list qh.newfacet_list qh.visible_list*/);
void qh_setvoronoi_all(void);
void qh_triangulate(void /*qh.facet_list*/);
void qh_triangulate_facet(facetT *facetA, vertexT **first_vertex);
void qh_triangulate_link(facetT *oldfacetA, facetT *facetA, facetT *oldfacetB, facetT *facetB);
void qh_triangulate_mirror(facetT *facetA, facetT *facetB);
void qh_triangulate_null(facetT *facetA);
void qh_vertexintersect(setT **vertexsetA,setT *vertexsetB);
setT *qh_vertexintersect_new(setT *vertexsetA,setT *vertexsetB);
void qh_vertexneighbors(void /*qh.facet_list*/);
boolT qh_vertexsubset(setT *vertexsetA, setT *vertexsetB);
#endif /* qhDEFpoly */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,295 @@
<!-- Do not edit with Front Page, it adds too many spaces -->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>geom.c, geom2.c -- geometric and floating point routines</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a><br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm#TOC">Geom</a> &#149; <a href="qh-globa.htm">Global</a>
&#149; <a href="qh-io.htm">Io</a> &#149; <a href="qh-mem.htm">Mem</a>
&#149; <a href="qh-merge.htm">Merge</a> &#149; <a href="qh-poly.htm">Poly</a>
&#149; <a href="qh-qhull.htm">Qhull</a> &#149; <a href="qh-set.htm">Set</a>
&#149; <a href="qh-stat.htm">Stat</a> &#149; <a href="qh-user.htm">User</a>
</p>
<hr>
<!-- Main text of document. -->
<h2>geom.c, geom2.c, random.c -- geometric and floating point routines</h2>
<blockquote>
<p>Geometrically, a vertex is a point with <em>d</em> coordinates
and a facet is a halfspace. A <em>halfspace</em> is defined by an
oriented hyperplane through the facet's vertices. A <em>hyperplane</em>
is defined by <em>d</em> normalized coefficients and an offset. A
point is <em>above</em> a facet if its distance to the facet is
positive.</p>
<p>Qhull uses floating point coordinates for input points,
vertices, halfspace equations, centrums, and an interior point.</p>
<p>Qhull may be configured for single precision or double
precision floating point arithmetic (see <a href="user.h#realT">realT</a>
). </p>
<p>Each floating point operation may incur round-off error (see
<a href="qh-merge.htm#TOC">Merge</a>). The maximum error for distance
computations is determined at initialization. The roundoff error
in halfspace computation is accounted for by computing the
distance from vertices to the halfspace. </p>
</blockquote>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="#TOP">&#187;</a> <b>Geom</b>
<a name="TOC">&#149;</a> <a href="qh-globa.htm#TOC">Global</a> &#149;
<a href="qh-io.htm#TOC">Io</a> &#149; <a href="qh-mem.htm#TOC">Mem</a> &#149;
<a href="qh-merge.htm#TOC">Merge</a> &#149; <a href="qh-poly.htm#TOC">Poly</a> &#149;
<a href="qh-qhull.htm#TOC">Qhull</a> &#149; <a href="qh-set.htm#TOC">Set</a> &#149;
<a href="qh-stat.htm#TOC">Stat</a> &#149; <a href="qh-user.htm#TOC">User</a> </p>
<h3>Index to <a href="geom.c">geom.c</a>,
<a href="geom2.c">geom2.c</a>, <a href="geom.h">geom.h</a>,
<a href="random.c">random.c</a>, <a href="random.h">random.h</a>
</h3>
<ul>
<li><a href="#gtype">geometric data types and constants</a> </li>
<li><a href="#gmacro">mathematical macros</a>
</li>
<li><a href="#gmath">mathematical functions</a> </li>
<li><a href="#gcomp">computational geometry functions</a> </li>
<li><a href="#gpoint">point array functions</a> </li>
<li><a href="#gfacet">geometric facet functions</a> </li>
<li><a href="#ground">geometric roundoff functions</a></li>
</ul>
<h3><a href="qh-geom.htm#TOC">&#187;</a><a name="gtype">geometric data types
and constants</a></h3>
<ul>
<li><a href="libqhull.h#coordT">coordT</a> coordinates and
coefficients are stored as realT</li>
<li><a href="libqhull.h#pointT">pointT</a> a point is an array
of <tt>DIM3</tt> coordinates </li>
</ul>
<h3><a href="qh-geom.htm#TOC">&#187;</a><a name="gmacro">mathematical macros</a></h3>
<ul>
<li><a href="geom.h#fabs_">fabs_</a> returns the absolute
value of a </li>
<li><a href="geom.h#fmax_">fmax_</a> returns the maximum
value of a and b </li>
<li><a href="geom.h#fmin_">fmin_</a> returns the minimum
value of a and b </li>
<li><a href="geom.h#maximize_">maximize_</a> maximize a value
</li>
<li><a href="geom.h#minimize_">minimize_</a> minimize a value
</li>
<li><a href="geom.h#det2_">det2_</a> compute a 2-d
determinate </li>
<li><a href="geom.h#det3_">det3_</a> compute a 3-d
determinate </li>
<li><a href="geom.h#dX">dX, dY, dZ</a> compute the difference
between two coordinates </li>
</ul>
<h3><a href="qh-geom.htm#TOC">&#187;</a><a name="gmath">mathematical functions</a></h3>
<ul>
<li><a href="geom.c#backnormal">qh_backnormal</a> solve for
normal using back substitution </li>
<li><a href="geom2.c#crossproduct">qh_crossproduct</a>
compute the cross product of two 3-d vectors </li>
<li><a href="geom2.c#determinant">qh_determinant</a> compute
the determinant of a square matrix </li>
<li><a href="geom.c#gausselim">qh_gausselim</a> Gaussian
elimination with partial pivoting </li>
<li><a href="geom2.c#gram_schmidt">qh_gram_schmidt</a>
implements Gram-Schmidt orthogonalization by rows </li>
<li><a href="geom2.c#maxabsval">qh_maxabsval</a> return max
absolute value of a vector </li>
<li><a href="geom2.c#minabsval">qh_minabsval</a> return min
absolute value of a dim vector </li>
<li><a href="geom2.c#mindiff">qh_mindiff</a> return index of
min absolute difference of two vectors </li>
<li><a href="geom.c#normalize">qh_normalize</a> normalize a
vector </li>
<li><a href="geom.c#normalize2">qh_normalize2</a> normalize a
vector and report if too small </li>
<li><a href="geom2.c#printmatrix">qh_printmatrix</a> print
matrix given by row vectors </li>
<li><a href="random.c#rand">qh_rand/srand</a> generate random
numbers </li>
<li><a href="random.c#randomfactor">qh_randomfactor</a> return
a random factor near 1.0 </li>
<li><a href="random.c#randommatrix">qh_randommatrix</a>
generate a random dimXdim matrix in range (-1,1) </li>
</ul>
<h3><a href="qh-geom.htm#TOC">&#187;</a><a name="gcomp">computational geometry functions</a></h3>
<ul>
<li><a href="geom2.c#detsimplex">qh_detsimplex</a> compute
determinate of a simplex of points </li>
<li><a href="io.c#detvnorm">qh_detvnorm</a> determine normal for Voronoi ridge </li>
<li><a href="geom2.c#distnorm">qh_distnorm</a> compute
distance from point to hyperplane as defined by normal and offset</li>
<li><a href="geom2.c#facetarea_simplex">qh_facetarea_simplex</a>
return area of a simplex</li>
<li><a href="geom.c#getangle">qh_getangle</a> return cosine
of angle (i.e., dot product) </li>
<li><a href="geom.c#getcenter">qh_getcenter</a> return
arithmetic center for a set of vertices </li>
<li><a href="geom2.c#pointdist">qh_pointdist</a> return
distance between two points </li>
<li><a href="geom2.c#rotatepoints">qh_rotatepoints</a> rotate
numpoints points by a row matrix </li>
<li><a href="geom2.c#sethalfspace">qh_sethalfspace</a> set
coords to dual of halfspace relative to an interior point </li>
<li><a href="geom.c#sethyperplane_det">qh_sethyperplane_det</a>
return hyperplane for oriented simplex using determinates
</li>
<li><a href="geom.c#sethyperplane_gauss">qh_sethyperplane_gauss</a>
return hyperplane for oriented simplex using Gaussian
elimination </li>
<li><a href="geom2.c#voronoi_center">qh_voronoi_center</a>
return Voronoi center for a set of points </li>
</ul>
<h3><a href="qh-geom.htm#TOC">&#187;</a><a name="gpoint">point array functions</a></h3>
<ul>
<li><a href="geom2.c#copypoints">qh_copypoints</a> return
malloc'd copy of points</li>
<li><a href="geom2.c#joggleinput">qh_joggleinput</a> joggle
input points by qh.JOGGLEmax </li>
<li><a href="geom2.c#maxmin">qh_maxmin</a> return max/min
points for each dimension</li>
<li><a href="geom2.c#maxsimplex">qh_maxsimplex</a> determines
maximum simplex for a set of points </li>
<li><a href="geom2.c#printpoints">qh_printpoints</a> print ids for a
set of points </li>
<li><a href="geom2.c#projectinput">qh_projectinput</a> project
input using qh DELAUNAY and qh low_bound/high_bound </li>
<li><a href="geom2.c#projectpoints">qh_projectpoints</a>
project points along one or more dimensions </li>
<li><a href="geom2.c#rotateinput">qh_rotateinput</a> rotate
input points using row matrix </li>
<li><a href="geom2.c#scaleinput">qh_scaleinput</a> scale
input points using qh low_bound/high_bound </li>
<li><a href="geom2.c#scalelast">qh_scalelast</a> scale last
coordinate to [0,m] for Delaunay triangulations </li>
<li><a href="geom2.c#scalepoints">qh_scalepoints</a> scale
points to new lowbound and highbound </li>
<li><a href="geom2.c#setdelaunay">qh_setdelaunay</a> project
points to paraboloid for Delaunay triangulation </li>
<li><a href="geom2.c#sethalfspace_all">qh_sethalfspace_all</a>
generate dual for halfspace intersection with interior
point </li>
</ul>
<h3><a href="qh-geom.htm#TOC">&#187;</a><a name="gfacet">geometric facet functions</a></h3>
<ul>
<li><a href="geom.c#distplane">qh_distplane</a> return
distance from point to facet </li>
<li><a href="geom2.c#facetarea">qh_facetarea</a> return area
of a facet </li>
<li><a href="geom2.c#facetcenter">qh_facetcenter</a> return
Voronoi center for a facet's vertices </li>
<li><a href="geom.c#findbest">qh_findbest</a> find visible
facet or best facet for a point </li>
<li><a href="geom.c#findbesthorizon">qh_findbesthorizon</a>
update best new facet with horizon facets</li>
<li><a href="geom.c#findbestnew">qh_findbestnew</a> find best
new facet for point </li>
<li><a href="geom2.c#getarea">qh_getarea</a> get area of all
facets in facetlist, collect statistics </li>
<li><a href="geom.c#getcentrum">qh_getcentrum</a> return
centrum for a facet </li>
<li><a href="geom.c#getdistance">qh_getdistance</a> returns
the max and min distance of a facet's vertices to a
neighboring facet</li>
<li><a href="geom2.c#findgooddist">qh_findgooddist</a> find
best good facet visible for point from facet </li>
<li><a href="geom2.c#inthresholds">qh_inthresholds</a> return
True if facet normal within 'Pdn' and 'PDn'</li>
<li><a href="geom2.c#orientoutside">qh_orientoutside</a>
orient facet so that <tt>qh.interior_point</tt> is inside</li>
<li><a href="geom.c#projectpoint">qh_projectpoint</a> project
point onto a facet </li>
<li><a href="geom.c#setfacetplane">qh_setfacetplane</a> sets
the hyperplane for a facet </li>
<li><a href="geom2.c#sharpnewfacets">qh_sharpnewfacets</a> true
if new facets contains a sharp corner</li>
</ul>
<h3><a href="qh-geom.htm#TOC">&#187;</a><a name="ground">geometric roundoff functions</a></h3>
<ul>
<li><a href="geom2.c#detjoggle">qh_detjoggle</a> determine
default joggle for points and distance roundoff error</li>
<li><a href="geom2.c#detroundoff">qh_detroundoff</a>
determine maximum roundoff error and other precision constants</li>
<li><a href="geom2.c#distround">qh_distround</a> compute
maximum roundoff error due to a distance computation to a
normalized hyperplane</li>
<li><a href="geom2.c#divzero">qh_divzero</a> divide by a
number that is nearly zero </li>
<li><a href="geom2.c#maxouter">qh_maxouter</a> return maximum outer
plane</li>
<li><a href="geom2.c#outerinner">qh_outerinner</a> return actual
outer and inner planes
</ul>
<p><!-- Navigation links --> </p>
<hr>
<p><b>Up:</b>
<a href="http://www.qhull.org">Home page for
Qhull</a> <br>
<b>Up:</b> <a href="index.htm#TOC">Qhull manual: Table of Contents</a> <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149;
<a href="qh-globa.htm">Global</a> &#149; <a href="qh-io.htm">Io</a>
&#149; <a href="qh-mem.htm">Mem</a> &#149; <a href="qh-merge.htm">Merge</a>
&#149; <a href="qh-poly.htm">Poly</a> &#149; <a href="qh-qhull.htm#TOC">Qhull</a>
&#149; <a href="qh-set.htm">Set</a> &#149; <a href="qh-stat.htm">Stat</a>
&#149; <a href="qh-user.htm">User</a><br>
<p><!-- GC common information --> </p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img
src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
Geometry Center Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,165 @@
<!-- Do not edit with Front Page, it adds too many spaces -->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>global.c -- global variables and their functions</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a><br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149; <a href="qh-globa.htm#TOC">Global</a>
&#149; <a href="qh-io.htm">Io</a> &#149; <a href="qh-mem.htm">Mem</a>
&#149; <a href="qh-merge.htm">Merge</a> &#149; <a href="qh-poly.htm">Poly</a>
&#149; <a href="qh-qhull.htm">Qhull</a> &#149; <a href="qh-set.htm">Set</a>
&#149; <a href="qh-stat.htm">Stat</a> &#149; <a href="qh-user.htm">User</a>
</p>
<hr>
<!-- Main text of document. -->
<h2>global.c -- global variables and their functions</h2>
<blockquote>
<p>Qhull uses a global data structure, <tt>qh</tt>, to store
globally defined constants, lists, sets, and variables. This
allows multiple instances of Qhull to execute at the same time.
The structure may be statically allocated or
dynamically allocated with malloc(). See
<a href="user.h#QHpointer">QHpointer</a>.
</p>
</blockquote>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="#TOP">&#187;</a> <a href="qh-geom.htm#TOC">Geom</a>
<a name="TOC">&#149;</a> <b>Global</b> &#149;
<a href="qh-io.htm#TOC">Io</a> &#149; <a href="qh-mem.htm#TOC">Mem</a> &#149;
<a href="qh-merge.htm#TOC">Merge</a> &#149; <a href="qh-poly.htm#TOC">Poly</a> &#149;
<a href="qh-qhull.htm#TOC">Qhull</a> &#149; <a href="qh-set.htm#TOC">Set</a> &#149;
<a href="qh-stat.htm#TOC">Stat</a> &#149; <a href="qh-user.htm#TOC">User</a> </p>
<h3>Index to <a href="global.c">global.c</a> and
<a href="libqhull.h">libqhull.h</a></h3>
<ul>
<li><a href="#ovar">Qhull's global variables</a> </li>
<li><a href="#ofunc">Global variable and initialization
routines</a> </li>
</ul>
<h3><a href="qh-globa.htm#TOC">&#187;</a><a name="ovar">Qhull's global
variables</a></h3>
<ul>
<li><a href=global.c#qh_version>qh_version</a> version string
<li><a href="libqhull.h#qh">qh</a> all global variables for
qhull are in <tt>qh,qhmem</tt>, and <tt>qhstat</tt></li>
<li><a href="libqhull_r.h#qh">QHULL_LIB_CHECK</a> Check for compatible library</li>
<li><a href="libqhull.h#qh-const">qh constants</a> configuration
flags and constants for Qhull </li>
<li><a href="libqhull.h#qh-prec">qh precision constants</a>
precision constants for Qhull </li>
<li><a href="libqhull.h#qh-codetern">qh internal constants</a>
internal constants for Qhull </li>
<li><a href="libqhull.h#qh-lists">qh facet and vertex lists</a>
lists of facets and vertices </li>
<li><a href="libqhull.h#qh-var">qh global variables</a> minimum
and maximum distances, next visit ids, several flags, and
other global variables. </li>
<li><a href="libqhull.h#qh-set">qh global sets</a> global sets
for merging, hashing, input, etc. </li>
<li><a href="libqhull.h#qh-buf">qh global buffers</a> buffers
for matrix operations and input </li>
<li><a href="libqhull.h#qh-static">qh static variables</a>
static variables for individual functions </li>
</ul>
<h3><a href="qh-globa.htm#TOC">&#187;</a><a name="ofunc">Global variable and
initialization routines</a></h3>
<ul>
<li><a href="global.c#appendprint">qh_appendprint</a> append
output format to <tt>qh.PRINTout</tt> </li>
<li><a href="global.c#freebuffers">qh_freebuffers</a> free
global memory buffers </li>
<li><a href="global.c#freeqhull">qh_freeqhull</a> free memory
used by qhull </li>
<li><a href="global.c#init_A">qh_init_A</a> called before
error handling initialized </li>
<li><a href="global.c#init_B">qh_init_B</a> called after
points are defined </li>
<li><a href="global.c#init_qhull_command">qh_init_qhull_command</a>
build <tt>qh.qhull_command</tt> from <tt>argc/argv</tt></li>
<li><a href="global.c#initflags">qh_initflags</a> set flags
and constants from command line </li>
<li><a href="global.c#initqhull_buffers">qh_initqhull_buffers</a>
initialize global memory buffers </li>
<li><a href="global.c#initqhull_globals">qh_initqhull_globals</a>
initialize global variables </li>
<li><a href="global.c#initqhull_mem">qh_initqhull_mem</a>
initialize Qhull memory management </li>
<li><a href="global.c#initqhull_start">qh_initqhull_start</a>
allocate qh_qh and call qh_initqhull_start2()
<li><a href="global.c#initqhull_start2">qh_initqhull_start2</a>
initialize default values at Qhull startup </li>
<li><a href="global.c#initthresholds">qh_initthresholds</a>
initialize 'Pdn' and 'PDn' thresholds </li>
<li><a href="global.c#lib_check">qh_lib_check</a> check for compatible Qhull library. Invoked by QHULL_LIB_CHECK at start of each program.</li>
<li><a href="global.c#option">qh_option</a> append option
description to <tt>qh.global_options</tt> </li>
<li><a href="global.c#restore_qhull">qh_restore_qhull</a>
restores a previously saved qhull </li>
<li><a href="global.c#save_qhull">qh_save_qhull</a> saves
qhull for a later qh_restore_qhull() </li>
<li><a href="global.c#strtol">qh_strtol</a> duplicates
strtod() and strtol() </li>
</ul>
<p><!-- Navigation links --> </p>
<hr>
<p><b>Up:</b>
<a href="http://www.qhull.org">Home page for
Qhull</a> <br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual: Table of Contents</a> <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149;
<a href="qh-globa.htm">Global</a> &#149; <a href="qh-io.htm">Io</a>
&#149; <a href="qh-mem.htm">Mem</a> &#149; <a href="qh-merge.htm">Merge</a>
&#149; <a href="qh-poly.htm">Poly</a> &#149; <a href="qh-qhull.htm#TOC">Qhull</a>
&#149; <a href="qh-set.htm">Set</a> &#149; <a href="qh-stat.htm">Stat</a>
&#149; <a href="qh-user.htm">User</a><br>
<p><!-- GC common information --> </p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img
src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
Geometry Center Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,305 @@
<!-- Do not edit with Front Page, it adds too many spaces -->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>io.c -- input and output operations</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a><br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149; <a href="qh-globa.htm">Global</a>
&#149; <a href="qh-io.htm#TOC">Io</a> &#149; <a href="qh-mem.htm">Mem</a>
&#149; <a href="qh-merge.htm">Merge</a> &#149; <a href="qh-poly.htm">Poly</a>
&#149; <a href="qh-qhull.htm">Qhull</a> &#149; <a href="qh-set.htm">Set</a>
&#149; <a href="qh-stat.htm">Stat</a> &#149; <a href="qh-user.htm">User</a>
</p>
<hr>
<h2>io.c -- input and output operations</h2>
<blockquote>
<p>Qhull provides a wide range of input
and output options. To organize the code, most output formats use
the same driver: </p>
<pre>
qh_printbegin( fp, format, facetlist, facets, printall );
FORALLfacet_( facetlist )
qh_printafacet( fp, format, facet, printall );
FOREACHfacet_( facets )
qh_printafacet( fp, format, facet, printall );
qh_printend( fp, format );
</pre>
<p>Note the 'printall' flag. It selects whether or not
qh_skipfacet() is tested. </p>
</blockquote>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="#TOP">&#187;</a> <a href="qh-geom.htm#TOC">Geom</a> <a name="TOC">&#149;</a>
<a href="qh-globa.htm#TOC">Global</a> &#149; <b>Io</b> &#149;
<a href="qh-mem.htm#TOC">Mem</a> &#149; <a href="qh-merge.htm#TOC">Merge</a> &#149;
<a href="qh-poly.htm#TOC">Poly</a> &#149; <a href="qh-qhull.htm#TOC">Qhull</a> &#149;
<a href="qh-set.htm#TOC">Set</a> &#149; <a href="qh-stat.htm#TOC">Stat</a> &#149;
<a href="qh-user.htm#TOC">User</a> </p>
<h3>Index to <a href="io.c">io.c</a> and <a href="io.h">io.h</a></h3>
<ul>
<li><a href="#iconst">io.h constants and types</a> </li>
<li><a href="#ilevel">User level functions</a> </li>
<li><a href="#iprint">Print functions for all output formats</a></li>
<li><a href="#itext">Text output functions</a> </li>
<li><a href="#iutil">Text utility functions</a></li>
<li><a href="#igeom">Geomview output functions</a> </li>
<li><a href="#iview">Geomview utility functions</a></li>
</ul>
<h3><a href="qh-io.htm#TOC">&#187;</a><a name="iconst">io.h constants and types</a></h3>
<ul>
<li><a href="io.h#qh_MAXfirst">qh_MAXfirst</a> maximum length
of first two lines of stdin </li>
<li><a href="io.h#qh_WHITESPACE">qh_WHITESPACE</a> possible
values of white space </li>
<li><a href="io.h#printvridgeT">printvridgeT</a> function to
print results of qh_printvdiagram or qh_eachvoronoi</li>
</ul>
<h3><a href="qh-io.htm#TOC">&#187;</a><a name="ilevel">User level functions</a></h3>
<ul>
<li><a href="io.c#copyfilename">qh_copyfilename</a>
copy filename identified by qh_skipfilename
<li><a href="io.c#eachvoronoi_all">qh_eachvoronoi_all</a>
visit each Voronoi ridge of the Voronoi diagram
<li><a href="io.c#prepare_output">qh_prepare_output</a>
prepare Qhull for output (called by qh_produce_output())
<li><a href="io.c#printhelp_degenerate">qh_printhelp_degenerate</a>
prints descriptive message for precision error </li>
<li><a href="io.c#printhelp_singular">qh_printhelp_singular</a>
print help message for singular data </li>
<li><a href="libqhull.c#printsummary">qh_printsummary</a> print
summary ('s')</li>
<li><a href="io.c#produce_output">qh_produce_output</a>
prints out the result of qhull()</li>
<li><a href="io.c#produce_output">qh_produce_output2</a>
prints out the result of qhull() without calling qh_prepare_output()</li>
<li><a href="io.c#readfeasible">qh_readfeasible</a> read
interior point from remainder and qh fin ('H')</li>
<li><a href="io.c#readpoints">qh_readpoints</a> read input
points </li>
<li><a href="io.c#setfeasible">qh_setfeasible</a> set
interior point from qh feasible_string ('Hn,n,n')</li>
<li><a href="io.c#skipfilename">qh_skipfilename</a>
skip filename in string
</ul>
<h3><a href="qh-io.htm#TOC">&#187;</a><a name="iprint">Print functions for all
output formats</a></h3>
<ul>
<li><a href="io.c#countfacets">qh_countfacets</a> count good
facets for printing and set visitid </li>
<li><a href="io.c#markkeep">qh_markkeep</a> mark good facets
that meet qh.KEEParea ('PAn'), qh.KEEPmerge ('PMn'), and qh.KEEPminArea ('PFn')</li>
<li><a href="io.c#order_vertexneighbors">qh_order_vertexneighbors</a>
order neighbors for a 3-d vertex by adjacency ('i', 'o')</li>
<li><a href="io.c#printafacet">qh_printafacet</a> print facet
in an output format </li>
<li><a href="io.c#printbegin">qh_printbegin</a> print header
for an output format </li>
<li><a href="io.c#printend">qh_printend</a> print trailer for
an output format </li>
<li><a href="user.c#printfacetlist">qh_printfacetlist</a>
print facets in a facetlist</li>
<li><a href="io.c#printfacets">qh_printfacets</a> print
facetlist and/or facet set in an output format </li>
<li><a href="io.c#printneighborhood">qh_printneighborhood</a>
print neighborhood of one or two facets ('Po')</li>
<li><a href="io.c#produce_output">qh_produce_output</a>
print the results of qh_qhull() </li>
<li><a href="io.c#skipfacet">qh_skipfacet</a> True if not
printing this facet ('Pdk:n', 'QVn', 'QGn')</li>
<li><a href="io.c#facetvertices">qh_facetvertices</a> return
vertices in a set of facets ('p')</li>
</ul>
<h3><a href="qh-io.htm#TOC">&#187;</a><a name="itext">Text output functions</a></h3>
<ul>
<li><a href="io.c#eachvoronoi">qh_eachvoronoi</a>
print or visit each Voronoi ridge for an input site of the Voronoi diagram
<li><a href="io.c#printextremes">qh_printextremes</a> print
extreme points by point ID (vertices of convex hull) ('Fx')</li>
<li><a href="io.c#printextremes_2d">qh_printextremes_2d</a> print
2-d extreme points by point ID ('Fx')</li>
<li><a href="io.c#printextremes_d">qh_printextremes_d</a> print
extreme points of input sites for Delaunay triangulations ('Fx')</li>
<li><a href="io.c#printfacet">qh_printfacet</a> print all
fields of a facet ('f')</li>
<li><a href="io.c#printfacet2math">qh_printfacet2math</a> print
2-d Maple or Mathematica output for a facet ('FM' or 'm')</li>
<li><a href="io.c#printfacet3math">qh_printfacet3math</a>
print 3-d Maple or Mathematica facet ('FM' or 'm')</li>
<li><a href="io.c#printfacet3vertex">qh_printfacet3vertex</a>
print vertices for a 3-d facet ('i', 'o')</li>
<li><a href="io.c#printfacetheader">qh_printfacetheader</a>
prints header fields of a facet ('f')</li>
<li><a href="io.c#printfacetNvertex_nonsimplicial">qh_printfacetNvertex_nonsimplicial</a>
print vertices for an N-d non-simplicial facet ('i', 'Ft')</li>
<li><a href="io.c#printfacetNvertex_simplicial">qh_printfacetNvertex_simplicial</a>
print vertices for an N-d simplicial facet ('i', 'o', 'Ft')</li>
<li><a href="io.c#printfacetridges">qh_printfacetridges</a>
prints ridges of a facet ('f')</li>
<li><a href="io.c#printpoints_out">qh_printpoints_out</a> prints
vertices for facets by their point coordinates ('p')</li>
<li><a href="io.c#printridge">qh_printridge</a> print all
fields for a ridge ('f')</li>
<li><a href="io.c#printvdiagram">qh_printvdiagram</a> print
voronoi diagram as Voronoi vertices for each input pair</li>
<li><a href="io.c#printvertex">qh_printvertex</a> print all
fields for a vertex ('f')</li>
<li><a href="io.c#printvertexlist">qh_printvertexlist</a>
print vertices used by a list or set of facets ('f')</li>
<li><a href="io.c#printvertices">qh_printvertices</a> print a
set of vertices ('f')</li>
<li><a href="io.c#printvneighbors">qh_printvneighbors</a>
print vertex neighbors of vertices ('FN')</li>
<li><a href="io.c#printvoronoi">qh_printvoronoi</a> print
voronoi diagram in 'o' or 'G' format</li>
</ul>
<h3><a href="qh-io.htm#TOC">&#187;</a><a name="iutil">Text utility functions</a></h3>
<ul>
<li><a href="io.c#dfacet">dfacet</a> print facet by ID </li>
<li><a href="io.c#dvertex">dvertex</a> print vertex by ID </li>
<li><a href="io.c#compare_facetarea">qh_compare_facetarea</a>
used by qsort() to order facets by area </li>
<li><a href="io.c#compare_facetmerge">qh_compare_facetmerge</a>
used by qsort() to order facets by number of merges </li>
<li><a href="io.c#compare_facetvisit">qh_compare_facetvisit</a>
used by qsort() to order facets by visit ID or ID </li>
<li><a href="io.c#compare_vertexpoint">qh_compare_vertexpoint</a>
used by qsort() to order vertices by point ID </li>
<li><a href="io.c#detvnorm">qh_detvnorm</a> determine normal for Voronoi ridge </li>
<li><a href="io.c#detvridge">qh_detvridge</a> determine Voronoi
ridge for an input site
<li><a href="io.c#detvridge3">qh_detvridge3</a> determine 3-d Voronoi
ridge for an input site
<li><a href="io.c#facet2point">qh_facet2point</a> return two
projected temporary vertices for a 2-d facet ('m', 'G')</li>
<li><a href="io.c#markvoronoi">qh_markvoronoi</a> mark Voronoi
vertices for printing
<li><a href="io.c#printcenter">qh_printcenter</a> print
facet-&gt;center as centrum or Voronoi center ('Ft', 'v p', 'FC', 'f') </li>
<li><a href="io.c#printpoint">qh_printpoint</a>, qh_printpointid, print
coordinates of a point ('p', 'o', 'Fp', 'G', 'f')</li>
<li><a href="io.c#printpoint3">qh_printpoint3</a> prints 2-d,
3-d, or 4-d point as 3-d coordinates ('G')</li>
<li><a href="io.c#printvdiagram2">qh_printvdiagram2</a> print
voronoi diagram for each ridge of each vertex from qh_markvoronoi</li>
<li><a href="io.c#printvnorm">qh_printvnorm</a> print
separating plane of the Voronoi diagram for a pair of input sites</li>
<li><a href="io.c#printvridge">qh_printvridge</a> print
ridge of the Voronoi diagram for a pair of input sites</li>
<li><a href="io.c#projectdim3">qh_projectdim3</a> project 2-d
3-d or 4-d point to a 3-d point ('G')</li>
</ul>
<h3><a href="qh-io.htm#TOC">&#187;</a><a name="igeom">Geomview output functions</a></h3>
<ul>
<li><a href="io.c#printfacet2geom">qh_printfacet2geom</a>
print facet as a 2-d VECT object </li>
<li><a href="io.c#printfacet2geom_points">qh_printfacet2geom_points</a>
print points as a 2-d VECT object with offset </li>
<li><a href="io.c#printfacet3geom_nonsimplicial">qh_printfacet3geom_nonsimplicial</a>
print Geomview OFF for a 3-d nonsimplicial facet. </li>
<li><a href="io.c#printfacet3geom_points">qh_printfacet3geom_points</a>
prints a 3-d facet as OFF Geomview object. </li>
<li><a href="io.c#printfacet3geom_simplicial">qh_printfacet3geom_simplicial</a>
print Geomview OFF for a 3-d simplicial facet. </li>
<li><a href="io.c#printfacet4geom_nonsimplicial">qh_printfacet4geom_nonsimplicial</a>
print Geomview 4OFF file for a 4d nonsimplicial facet </li>
<li><a href="io.c#printfacet4geom_simplicial">qh_printfacet4geom_simplicial</a>
print Geomview 4OFF file for a 4d simplicial facet </li>
<li><a href="io.c#printhyperplaneintersection">qh_printhyperplaneintersection</a>
print hyperplane intersection as OFF or 4OFF </li>
<li><a href="io.c#printvoronoi">qh_printvoronoi</a> print
voronoi diagram in 'o' or 'G' format</li>
</ul>
<h3><a href="qh-io.htm#TOC">&#187;</a><a name="iview">Geomview utility functions</a></h3>
<ul>
<li><a href="io.c#geomplanes">qh_geomplanes</a>
return outer and inner planes for Geomview</li>
<li><a href="io.c#printcentrum">qh_printcentrum</a> print
centrum for a facet in OOGL format </li>
<li><a href="io.c#printend4geom">qh_printend4geom</a> helper
function for qh_printbegin/printend </li>
<li><a href="io.c#printhyperplaneintersection">qh_printhyperplaneintersection</a>
print Geomview OFF or 4OFF for the intersection of two
hyperplanes in 3-d or 4-d </li>
<li><a href="io.c#printline3geom">qh_printline3geom</a> prints a
line as a VECT </li>
<li><a href="io.c#printpointvect">qh_printpointvect</a>
prints a 2-d or 3-d point as 3-d VECT's </li>
<li><a href="io.c#printpointvect2">qh_printpointvect2</a>
prints a 2-d or 3-d point as 2 3-d VECT's </li>
<li><a href="io.c#printspheres">qh_printspheres</a> prints 3-d
vertices as OFF spheres </li>
</ul>
<p>
<p><!-- Navigation links --> </p>
<hr>
<p><b>Up:</b>
<a href="http://www.qhull.org">Home page for
Qhull</a> <br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual: Table of Contents</a> <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149;
<a href="qh-globa.htm">Global</a> &#149; <a href="qh-io.htm">Io</a>
&#149; <a href="qh-mem.htm">Mem</a> &#149; <a href="qh-merge.htm">Merge</a>
&#149; <a href="qh-poly.htm">Poly</a> &#149; <a href="qh-qhull.htm#TOC">Qhull</a>
&#149; <a href="qh-set.htm">Set</a> &#149; <a href="qh-stat.htm">Stat</a>
&#149; <a href="qh-user.htm">User</a><br>
</p>
<p><!-- GC common information --> </p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img
src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
Geometry Center Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,145 @@
<!-- Do not edit with Front Page, it adds too many spaces -->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>mem.c -- memory operations</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a><br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149; <a href="qh-globa.htm">Global</a>
&#149; <a href="qh-io.htm">Io</a> &#149; <a href="qh-mem.htm#TOC">Mem</a>
&#149; <a href="qh-merge.htm">Merge</a> &#149; <a href="qh-poly.htm">Poly</a>
&#149; <a href="qh-qhull.htm">Qhull</a> &#149; <a href="qh-set.htm">Set</a>
&#149; <a href="qh-stat.htm">Stat</a> &#149; <a href="qh-user.htm">User</a>
</p>
<hr>
<h2>mem.c -- memory operations</h2>
<blockquote>
<p>Qhull uses quick-fit memory allocation. It maintains a
set of free lists for a variety of small allocations. A
small request returns a block from the best fitting free
list. If the free list is empty, Qhull allocates a block
from a reserved buffer. </p>
<p>Use 'T5' to trace memory allocations.</p>
</blockquote>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="#TOP">&#187;</a> <a href="qh-geom.htm#TOC">Geom</a>
<a name="TOC">&#149;</a> <a href="qh-globa.htm#TOC">Global</a> &#149;
<a href="qh-io.htm#TOC">Io</a> &#149; <b>Mem</b>
&#149; <a href="qh-merge.htm#TOC">Merge</a> &#149; <a href="qh-poly.htm#TOC">Poly</a>
&#149; <a href="qh-qhull.htm#TOC">Qhull</a> &#149; <a href="qh-set.htm#TOC">Set</a>
&#149; <a href="qh-stat.htm#TOC">Stat</a> &#149; <a href="qh-user.htm#TOC">User</a>
</p>
<h3>Index to <a href="mem.c">mem.c</a> and
<a href="mem.h">mem.h</a></h3>
<ul>
<li><a href="#etype">mem.h data types</a> </li>
<li><a href="#emacro">mem.h macros</a> </li>
<li><a href="#efunc">User level functions</a> </li>
</ul>
<h3><a href="qh-mem.htm#TOC">&#187;</a><a name="etype">mem.h data types and constants</a></h3>
<ul>
<li><a href="mem.h#ptr_intT">ptr_intT</a> for casting
a void* to an integer-type </li>
<li><a href="mem.h#qhmemT">qhmemT</a> global memory
structure for mem.c </li>
<li><a href="mem.h#NOmem">qh_NOmem</a> disable memory allocation</li>
</ul>
<h3><a href="qh-mem.htm#TOC">&#187;</a><a name="emacro">mem.h macros</a></h3>
<ul>
<li><a href="mem.h#memalloc_">qh_memalloc_</a>
allocate memory</li>
<li><a href="mem.h#memfree_">qh_memfree_</a> free
memory</li>
</ul>
<h3><a href="qh-mem.htm#TOC">&#187;</a><a name="efunc">User level
functions</a></h3>
<ul>
<li><a href="mem.c#memalloc">qh_memalloc</a> allocate
memory </li>
<li><a href="mem.c#memcheck">qh_memcheck</a>
quick check of memory for internal consistency</li>
<li><a href="mem.c#memfree">qh_memfree</a> free
memory </li>
<li><a href="mem.c#meminit">qh_meminit</a> initialize
memory </li>
<li><a href="mem.c#memstatistics">qh_memstatistics</a>
print memory statistics </li>
<li><a href="mem.c#meminit">qh_memtotlong</a> return total, allocated long memory</li>
<li><a href="mem.c#NOmem">qh_NOmem</a> allocation routines with malloc() and free()
</ul>
<h3><a href="qh-mem.htm#TOC">&#187;</a><a name="m">Initialization and
termination functions</a></h3>
<ul>
<li><a href="mem.c#intcompare">qh_intcompare</a> used by
qsort and bsearch to compare two integers </li>
<li><a href="mem.c#memfreeshort">qh_memfreeshort</a>
frees up all short and qhmem memory allocations </li>
<li><a href="mem.c#meminit">qh_meminit</a> initialize
memory </li>
<li><a href="mem.c#meminitbuffers">qh_meminitbuffers</a>
initialize qhmem </li>
<li><a href="mem.c#memsetup">qh_memsetup</a> set up
memory after running memsize() </li>
<li><a href="mem.c#memsize">qh_memsize</a> define a free
list for this size </li>
<li><a href="mem.c#memstatistics">qh_memstatistics</a>
print out memory statistics </li>
</ul>
<p><!-- Navigation links --> </p>
<hr>
<p><b>Up:</b>
<a href="http://www.qhull.org">Home page for
Qhull</a> <br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual: Table of Contents</a> <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149;
<a href="qh-globa.htm">Global</a> &#149; <a href="qh-io.htm">Io</a>
&#149; <a href="qh-mem.htm">Mem</a> &#149; <a href="qh-merge.htm">Merge</a>
&#149; <a href="qh-poly.htm">Poly</a> &#149; <a href="qh-qhull.htm#TOC">Qhull</a>
&#149; <a href="qh-set.htm">Set</a> &#149; <a href="qh-stat.htm">Stat</a>
&#149; <a href="qh-user.htm">User</a><br>
</p>
<p><!-- GC common information --> </p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img
src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
Geometry Center Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,366 @@
<!-- Do not edit with Front Page, it adds too many spaces -->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>merge.c -- facet merge operations</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a><br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149; <a href="qh-globa.htm">Global</a>
&#149; <a href="qh-io.htm">Io</a> &#149; <a href="qh-mem.htm">Mem</a>
&#149; <a href="qh-merge.htm#TOC">Merge</a> &#149; <a href="qh-poly.htm">Poly</a>
&#149; <a href="qh-qhull.htm">Qhull</a> &#149; <a href="qh-set.htm">Set</a>
&#149; <a href="qh-stat.htm">Stat</a> &#149; <a href="qh-user.htm">User</a>
</p>
<hr>
<h2>merge.c -- facet merge operations</h2>
<blockquote>
<p>Qhull handles precision problems by merged facets or joggled input.
Except for redundant vertices, it corrects a problem by
merging two facets. When done, all facets are clearly
convex. See <a href="../../html/qh-impre.htm">Imprecision in Qhull</a>
for further information. </p>
<p>Users may joggle the input ('<a href="../../html/qh-optq.htm#QJn">QJn</a>')
instead of merging facets. </p>
<p>Qhull detects and corrects the following problems: </p>
<ul>
<li><b>More than two facets meeting at a ridge. </b>When
Qhull creates facets, it creates an even number
of facets for each ridge. A convex hull always
has two facets for each ridge. More than two
facets may be created if non-adjacent facets
share a vertex. This is called a <em>duplicate
ridge</em>. In 2-d, a duplicate ridge would
create a loop of facets. </li>
</ul>
<ul>
<li><b>A facet contained in another facet. </b>Facet
merging may leave all vertices of one facet as a
subset of the vertices of another facet. This is
called a <em>redundant facet</em>. </li>
</ul>
<ul>
<li><b>A facet with fewer than three neighbors. </b>Facet
merging may leave a facet with one or two
neighbors. This is called a <em>degenerate facet</em>.
</li>
</ul>
<ul>
<li><b>A facet with flipped orientation. </b>A
facet's hyperplane may define a halfspace that
does not include the interior point.This is
called a <em>flipped facet</em>. </li>
</ul>
<ul>
<li><strong>A coplanar horizon facet.</strong> A
newly processed point may be coplanar with an
horizon facet. Qhull creates a new facet without
a hyperplane. It links new facets for the same
horizon facet together. This is called a <em>samecycle</em>.
The new facet or samecycle is merged into the
horizon facet. </li>
</ul>
<ul>
<li><b>Concave facets. </b>A facet's centrum may be
above a neighboring facet. If so, the facets meet
at a concave angle. </li>
</ul>
<ul>
<li><b>Coplanar facets. </b>A facet's centrum may be
coplanar with a neighboring facet (i.e., it is
neither clearly below nor clearly above the
facet's hyperplane). Qhull removes coplanar
facets in independent sets sorted by angle.</li>
</ul>
<ul>
<li><b>Redundant vertex. </b>A vertex may have fewer
than three neighboring facets. If so, it is
redundant and may be renamed to an adjacent
vertex without changing the topological
structure.This is called a <em>redundant vertex</em>.
</li>
</ul>
</blockquote>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="#TOP">&#187;</a> <a href="qh-geom.htm#TOC">Geom</a>
<a name="TOC">&#149;</a> <a href="qh-globa.htm#TOC">Global</a>
&#149; <a href="qh-io.htm#TOC">Io</a> &#149; <a href="qh-mem.htm#TOC">Mem</a>
&#149; <b>Merge</b> &#149; <a href="qh-poly.htm#TOC">Poly</a>
&#149; <a href="qh-qhull.htm#TOC">Qhull</a> &#149; <a href="qh-set.htm#TOC">Set</a>
&#149; <a href="qh-stat.htm#TOC">Stat</a> &#149; <a href="qh-user.htm#TOC">User</a>
</p>
<h3>Index to <a href="merge.c">merge.c</a> and
<a href="merge.h">merge.h</a></h3>
<ul>
<li><a href="#mtype">merge.h data types, macros, and
global sets</a> </li>
<li><a href="#mconst">merge.h constants</a> </li>
</ul>
<ul>
<li><a href="#mtop">top-level merge functions</a> </li>
<li><a href="#mset">functions for identifying merges</a></li>
<li><a href="#mbest">functions for determining the
best merge</a> </li>
<li><a href="#mmerge">functions for merging facets</a>
</li>
<li><a href="#mcycle">functions for merging a cycle
of facets</a> </li>
<li><a href="#mrename">functions for renaming a
vertex</a> </li>
<li><a href="#mvertex">functions for identifying
vertices for renaming</a> </li>
<li><a href="#mcheck">functions for check and trace</a> </li>
</ul>
<h3><a href="qh-merge.htm#TOC">&#187;</a><a name="mtype">merge.h data
types, macros, and global sets</a></h3>
<ul>
<li><a href="merge.h#mergeT">mergeT</a> structure to
identify a merge of two facets</li>
<li><a href="merge.h#FOREACHmerge_">FOREACHmerge_</a>
assign 'merge' to each merge in merges </li>
<li><a href="libqhull.h#qh-set">qh global sets</a>
qh.facet_mergeset contains non-convex merges
while qh.degen_mergeset contains degenerate and
redundant facets</li>
</ul>
<h3><a href="qh-merge.htm#TOC">&#187;</a><a name="mconst">merge.h
constants</a></h3>
<ul>
<li><a href="libqhull.h#qh-prec">qh precision constants</a>
precision constants for Qhull </li>
<li><a href="merge.h#MRG">MRG...</a> indicates the
type of a merge (mergeT-&gt;type)</li>
<li><a href="merge.h#qh_ANGLEredundant">qh_ANGLEredundant</a>
indicates redundant merge in mergeT-&gt;angle </li>
<li><a href="merge.h#qh_ANGLEdegen">qh_ANGLEdegen</a>
indicates degenerate facet in mergeT-&gt;angle </li>
<li><a href="merge.h#qh_ANGLEconcave">qh_ANGLEconcave</a>
offset to indicate concave facets in
mergeT-&gt;angle </li>
<li><a href="merge.h#qh_MERGEapex">qh_MERGEapex</a>
flag for qh_mergefacet() to indicate an apex
merge </li>
</ul>
<h3><a href="qh-merge.htm#TOC">&#187;</a><a name="mtop">top-level merge
functions</a></h3>
<ul>
<li><a href="merge.c#all_merges">qh_all_merges</a>
merge all non-convex facets </li>
<li><a href="merge.c#checkzero">qh_checkzero</a>
check that facets are clearly convex </li>
<li><a href="merge.c#flippedmerges">qh_flippedmerges</a>
merge flipped facets into best neighbor </li>
<li><a href="merge.c#forcedmerges">qh_forcedmerges</a>
merge all duplicate ridges </li>
<li><a href="merge.c#merge_degenredundant">qh_merge_degenredundant</a>
merge degenerate and redundant facets </li>
<li><a href="merge.c#merge_nonconvex">qh_merge_nonconvex</a>
merge a non-convex ridge </li>
<li><a href="merge.c#premerge">qh_premerge</a>
pre-merge non-convex facets </li>
<li><a href="merge.c#postmerge">qh_postmerge</a>
post-merge nonconvex facets as defined by
maxcentrum/maxangle </li>
</ul>
<h3><a href="qh-merge.htm#TOC">&#187;</a><a name="mset">functions for
identifying merges</a></h3>
<ul>
<li><a href="merge.c#appendmergeset">qh_appendmergeset</a>
appends an entry to qh.facet_mergeset</li>
<li><a href="merge.c#compareangle">qh_compareangle</a>
used by qsort() to order merges </li>
<li><a href="merge.c#comparemerge">qh_comparemerge</a>
used by qsort() to order merges </li>
<li><a href="merge.c#degen_redundant_facet">qh_degen_redundant_facet</a>
check for a degenerate and redundant facet</li>
<li><a href="merge.c#degen_redundant_neighbors">qh_degen_redundant_neighbors</a>
append degenerate and redundant neighbors to
qh.degen_mergeset </li>
<li><a href="merge.c#getmergeset_initial">qh_getmergeset_initial</a>
build initial qh.facet_mergeset </li>
<li><a href="merge.c#getmergeset">qh_getmergeset</a>
update qh.facet_mergeset </li>
<li><a href="merge.c#mark_dupridges">qh_mark_dupridges</a>
add duplicated ridges to qh.facet_mergeset</li>
<li><a href="merge.c#maydropneighbor">qh_maydropneighbor</a>
drop neighbor relationship if no ridge between
facet and neighbor </li>
<li><a href="merge.c#test_appendmerge">qh_test_appendmerge</a>
test a pair of facets for convexity and append to
qh.facet_mergeset if non-convex </li>
<li><a href="merge.c#test_vneighbors">qh_test_vneighbors</a>
test vertex neighbors for convexity </li>
</ul>
<h3><a href="qh-merge.htm#TOC">&#187;</a><a name="mbest">functions for
determining the best merge</a></h3>
<ul>
<li><a href="merge.c#findbest_test">qh_findbest_test</a>
test neighbor for best merge </li>
<li><a href="merge.c#findbestneighbor">qh_findbestneighbor</a>
finds best neighbor of a facet for merging (i.e.,
closest hyperplane) </li>
</ul>
<h3><a href="qh-merge.htm#TOC">&#187;</a><a name="mmerge">functions for
merging facets</a></h3>
<ul>
<li><a href="merge.c#copynonconvex">qh_copynonconvex</a>
copy non-convex flag to another ridge for the
same neighbor </li>
<li><a href="merge.c#makeridges">qh_makeridges</a>
creates explicit ridges between simplicial facets
</li>
<li><a href="merge.c#mergefacet">qh_mergefacet</a>
merges one facet into another facet</li>
<li><a href="merge.c#mergeneighbors">qh_mergeneighbors</a>
merges the neighbors of two facets </li>
<li><a href="merge.c#mergeridges">qh_mergeridges</a>
merges the ridge sets of two facets </li>
<li><a href="merge.c#mergesimplex">qh_mergesimplex</a>
merge a simplicial facet into another simplicial
facet </li>
<li><a href="merge.c#mergevertex_del">qh_mergevertex_del</a>
delete a vertex due to merging one facet into
another facet </li>
<li><a href="merge.c#mergevertex_neighbors">qh_mergevertex_neighbors</a>
merge the vertex neighbors of two facets </li>
<li><a href="merge.c#mergevertices">qh_mergevertices</a>
merge the vertex sets of two facets </li>
<li><a href="merge.c#newvertices">qh_newvertices</a>
register all vertices as new vertices </li>
<li><a href="merge.c#updatetested">qh_updatetested</a>
clear tested flags and centrums involved in a
merge </li>
<li><a href="merge.c#willdelete">qh_willdelete</a>
moves facet to qh.visible_list; sets replacement
or NULL </li>
</ul>
<h3><a href="qh-merge.htm#TOC">&#187;</a><a name="mcycle">functions for
merging a cycle of facets</a></h3>
<p>If a point is coplanar with an horizon facet, the
corresponding new facets are linked together (a <em>samecycle</em>)
for merging.</p>
<ul>
<li><a href="merge.c#basevertices">qh_basevertices</a>
return temporary set of base vertices for a
samecycle </li>
<li><a href="merge.c#mergecycle">qh_mergecycle</a>
merge a samecycle into a horizon facet </li>
<li><a href="merge.c#mergecycle_all">qh_mergecycle_all</a>
merge all samecycles into horizon facets</li>
<li><a href="merge.c#mergecycle_facets">qh_mergecycle_facets</a>
finish merge of samecycle </li>
<li><a href="merge.c#mergecycle_neighbors">qh_mergecycle_neighbors</a>
merge neighbor sets for samecycle </li>
<li><a href="merge.c#mergecycle_ridges">qh_mergecycle_ridges</a>
merge ridge sets for samecycle </li>
<li><a href="merge.c#mergecycle_vneighbors">qh_mergecycle_vneighbors</a>
merge vertex neighbor sets for samecycle </li>
</ul>
<h3><a href="qh-merge.htm#TOC">&#187;</a><a name="mrename">functions
for renaming a vertex</a></h3>
<ul>
<li><a href="merge.c#comparevisit">qh_comparevisit</a>
used by qsort() to order vertices by visitid</li>
<li><a href="merge.c#reducevertices">qh_reducevertices</a>
reduce vertex sets </li>
<li><a href="merge.c#redundant_vertex">qh_redundant_vertex</a>
returns true if detect and rename redundant
vertex </li>
<li><a href="merge.c#rename_sharedvertex">qh_rename_sharedvertex</a>
detect and rename a shared vertex </li>
<li><a href="merge.c#renameridgevertex">qh_renameridgevertex</a>
rename oldvertex to newvertex in a ridge </li>
<li><a href="merge.c#renamevertex">qh_renamevertex</a>
rename oldvertex to newvertex in ridges </li>
<li><a href="merge.c#remove_extravertices">qh_remove_extravertices</a>
remove extra vertices in non-simplicial facets </li>
</ul>
<h3><a href="qh-merge.htm#TOC">&#187;</a><a name="mvertex">functions
for identifying vertices for renaming</a></h3>
<ul>
<li><a href="merge.c#find_newvertex">qh_find_newvertex</a>
locate new vertex for renaming old vertex </li>
<li><a href="merge.c#hashridge">qh_hashridge</a> add
ridge to hashtable </li>
<li><a href="merge.c#hashridge_find">qh_hashridge_find</a>
returns matching ridge in hashtable</li>
<li><a href="merge.c#neighbor_intersections">qh_neighbor_intersections</a>
return intersection of vertex sets for
neighboring facets </li>
<li><a href="merge.c#vertexridges">qh_vertexridges</a>
return temporary set of ridges adjacent to a
vertex </li>
<li><a href="merge.c#vertexridges_facet">qh_vertexridges_facet</a>
add adjacent ridges for a vertex in facet </li>
</ul>
<h3><a href="qh-merge.htm#TOC">&#187;</a><a name="mcheck">functions for check and
trace</a></h3>
<ul>
<li><a href="merge.c#checkconnect">qh_checkconnect</a>
check that new facets are connected </li>
<li><a href="merge.c#tracemerge">qh_tracemerge</a>
print trace message after merge </li>
<li><a href="merge.c#tracemerging">qh_tracemerging</a>
print trace message during post-merging </li>
</ul>
<p><!-- Navigation links --> </p>
<hr>
<p><b>Up:</b>
<a href="http://www.qhull.org">Home page for
Qhull</a> <br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual: Table of Contents</a> <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149;
<a href="qh-globa.htm">Global</a> &#149; <a href="qh-io.htm">Io</a>
&#149; <a href="qh-mem.htm">Mem</a> &#149; <a href="qh-merge.htm">Merge</a>
&#149; <a href="qh-poly.htm">Poly</a> &#149; <a href="qh-qhull.htm#TOC">Qhull</a>
&#149; <a href="qh-set.htm">Set</a> &#149; <a href="qh-stat.htm">Stat</a>
&#149; <a href="qh-user.htm">User</a><br>
</p>
<p><!-- GC common information --> </p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img
src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
Geometry Center Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,485 @@
<!-- Do not edit with Front Page, it adds too many spaces -->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>poly.c, poly2.c -- polyhedron operations</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a><br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149; <a href="qh-globa.htm">Global</a>
&#149; <a href="qh-io.htm">Io</a> &#149; <a href="qh-mem.htm">Mem</a>
&#149; <a href="qh-merge.htm">Merge</a> &#149; <a href="qh-poly.htm#TOC">Poly</a>
&#149; <a href="qh-qhull.htm">Qhull</a> &#149; <a href="qh-set.htm">Set</a>
&#149; <a href="qh-stat.htm">Stat</a> &#149; <a href="qh-user.htm">User</a>
</p>
<hr>
<h2>poly.c, poly2.c -- polyhedron operations</h2>
<blockquote>
<p>Qhull uses dimension-free terminology. Qhull builds a
polyhedron in dimension <em>d. </em>A <em>polyhedron</em> is a
simplicial complex of faces with geometric information for the
top and bottom-level faces. A (<em>d-1</em>)-face is a <em>facet</em>,
a (<em>d-2</em>)-face is a <em>ridge</em>, and a <em>0</em>-face
is a <em>vertex</em>. For example in 3-d, a facet is a polygon
and a ridge is an edge. A facet is built from a ridge (the <em>base</em>)
and a vertex (the <em>apex</em>). See
<a href="../../html/index.htm#structure">Qhull's data structures</a>.</p>
<p>Qhull's primary data structure is a polyhedron. A
polyhedron is a list of facets. Each facet has a set of
neighboring facets and a set of vertices. Each facet has a
hyperplane. For example, a tetrahedron has four facets.
If its vertices are <em>a, b, c, d</em>, and its facets
are <em>1, 2, 3, 4,</em> the tetrahedron is </p>
<blockquote>
<ul>
<li>facet 1 <ul>
<li>vertices: b c d </li>
<li>neighbors: 2 3 4 </li>
</ul>
</li>
<li>facet 2 <ul>
<li>vertices: a c d </li>
<li>neighbors: 1 3 4 </li>
</ul>
</li>
<li>facet 3 <ul>
<li>vertices: a b d </li>
<li>neighbors: 1 2 4 </li>
</ul>
</li>
<li>facet 4 <ul>
<li>vertices: a b c </li>
<li>neighbors: 1 2 3 </li>
</ul>
</li>
</ul>
</blockquote>
<p>A facet may be simplicial or non-simplicial. In 3-d, a
<i>simplicial facet</i> has three vertices and three
neighbors. A <i>nonsimplicial facet</i> has more than
three vertices and more than three neighbors. A
nonsimplicial facet has a set of ridges and a centrum. </p>
<p>
A simplicial facet has an orientation. An <i>orientation</i>
is either <i>top</i> or <i>bottom</i>.
The flag, <tt>facet-&gt;toporient,</tt>
defines the orientation of the facet's vertices. For example in 3-d,
'top' is left-handed orientation (i.e., the vertex order follows the direction
of the left-hand fingers when the thumb is pointing away from the center).
Except for axis-parallel facets in 5-d and higher, topological orientation
determines the geometric orientation of the facet's hyperplane.
<p>A nonsimplicial facet is due to merging two or more
facets. The facet's ridge set determine a simplicial
decomposition of the facet. Each ridge is a 1-face (i.e.,
it has two vertices and two neighboring facets). The
orientation of a ridge is determined by the order of the
neighboring facets. The flag, <tt>facet-&gt;toporient,</tt>is
ignored. </p>
<p>A nonsimplicial facet has a centrum for testing
convexity. A <i>centrum</i> is a point on the facet's
hyperplane that is near the center of the facet. Except
for large facets, it is the arithmetic average of the
facet's vertices. </p>
<p>A nonsimplicial facet is an approximation that is
defined by offsets from the facet's hyperplane. When
Qhull finishes, the <i>outer plane</i> is above all
points while the <i>inner plane</i> is below the facet's
vertices. This guarantees that any exact convex hull
passes between the inner and outer planes. The outer
plane is defined by <tt>facet-&gt;maxoutside</tt> while
the inner plane is computed from the facet's vertices.</p>
<p>Qhull 3.1 includes triangulation of non-simplicial facets
('<a href="../../html/qh-optq.htm#Qt">Qt</a>').
These facets,
called <i>tricoplanar</i>, share the same normal. centrum, and Voronoi center.
One facet (keepcentrum) owns these data structures.
While tricoplanar facets are more accurate than the simplicial facets from
joggled input, they
may have zero area or flipped orientation.
</blockquote>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="#TOP">&#187;</a> <a href="qh-geom.htm#TOC">Geom</a>
<a name="TOC">&#149;</a> <a href="qh-globa.htm#TOC">Global</a>
&#149; <a href="qh-io.htm#TOC">Io</a> &#149; <a href="qh-mem.htm#TOC">Mem</a>
&#149; <a href="qh-merge.htm#TOC">Merge</a> &#149; <b>Poly</b>
&#149; <a href="qh-qhull.htm#TOC">Qhull</a> &#149; <a href="qh-set.htm#TOC">Set</a>
&#149; <a href="qh-stat.htm#TOC">Stat</a> &#149; <a href="qh-user.htm#TOC">User</a>
</p>
<h3>Index to <a href="poly.c">poly.c</a>,
<a href="poly2.c">poly2.c</a>, <a href="poly.h">poly.h</a>,
and <a href="libqhull.h">libqhull.h</a></h3>
<ul>
<li><a href="#ptype">Data types and global
lists for polyhedrons</a> </li>
<li><a href="#pconst">poly.h constants</a> </li>
<li><a href="#pgall">Global FORALL macros</a> </li>
<li><a href="#pall">FORALL macros</a> </li>
<li><a href="#peach">FOREACH macros</a> </li>
<li><a href="#pieach">Indexed FOREACH macros</a> </li>
<li><a href="#pmacro">Other macros for polyhedrons</a><p>&nbsp;</li>
<li><a href="#plist">Facetlist functions</a> </li>
<li><a href="#pfacet">Facet functions</a> </li>
<li><a href="#pvertex">Vertex, ridge, and point
functions</a> </li>
<li><a href="#phash">Hashtable functions</a> </li>
<li><a href="#pnew">Allocation and deallocation
functions</a> </li>
<li><a href="#pcheck">Check functions</a> </li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="ptype">Data
types and global lists for polyhedrons</a></h3>
<ul>
<li><a href="libqhull.h#facetT">facetT</a> defines a
facet </li>
<li><a href="libqhull.h#ridgeT">ridgeT</a> defines a
ridge </li>
<li><a href="libqhull.h#vertexT">vertexT</a> defines a
vertex </li>
<li><a href="libqhull.h#qh-lists">qh facet and vertex
lists</a> lists of facets and vertices </li>
<li><a href="libqhull.h#qh-set">qh global sets</a>
global sets for merging, hashing, input, etc. </li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="pconst">poly.h constants</a></h3>
<ul>
<li><a href="poly.h#ALGORITHMfault">ALGORITHMfault</a>
flag to not report errors in qh_checkconvex() </li>
<li><a href="poly.h#DATAfault">DATAfault</a> flag to
report errors in qh_checkconvex() </li>
<li><a href="poly.h#DUPLICATEridge">DUPLICATEridge</a>
special value for facet-&gt;neighbor to indicate
a duplicate ridge </li>
<li><a href="poly.h#MERGEridge">MERGEridge</a>
special value for facet-&gt;neighbor to indicate
a merged ridge </li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="pgall">Global FORALL
macros</a></h3>
<ul>
<li><a href="libqhull.h#FORALLfacets">FORALLfacets</a>
assign 'facet' to each facet in qh.facet_list </li>
<li><a href="poly.h#FORALLnew_facets">FORALLnew_facets</a>
assign 'facet' to each facet in qh.newfacet_list </li>
<li><a href="poly.h#FORALLvisible_facets">FORALLvisible_facets</a>
assign 'visible' to each visible facet in
qh.visible_list </li>
<li><a href="libqhull.h#FORALLpoints">FORALLpoints</a>
assign 'point' to each point in qh.first_point,
qh.num_points </li>
<li><a href="libqhull.h#FORALLvertices">FORALLvertices</a>
assign 'vertex' to each vertex in qh.vertex_list </li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="pall">FORALL macros</a></h3>
<ul>
<li><a href="poly.h#FORALLfacet_">FORALLfacet_</a>
assign 'facet' to each facet in facetlist </li>
<li><a href="libqhull.h#FORALLpoint_">FORALLpoint_</a>
assign 'point' to each point in points array</li>
<li><a href="poly.h#FORALLsame_">FORALLsame_</a>
assign 'same' to each facet in samecycle</li>
<li><a href="poly.h#FORALLsame_cycle_">FORALLsame_cycle_</a>
assign 'same' to each facet in samecycle</li>
<li><a href="poly.h#FORALLvertex_">FORALLvertex_</a>
assign 'vertex' to each vertex in vertexlist </li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="peach">FOREACH macros</a></h3>
<ul>
<li><a href="libqhull.h#FOREACHfacet_">FOREACHfacet_</a>
assign 'facet' to each facet in facets </li>
<li><a href="libqhull.h#FOREACHneighbor_">FOREACHneighbor_</a>
assign 'neighbor' to each facet in
facet-&gt;neighbors or vertex-&gt;neighbors</li>
<li><a href="poly.h#FOREACHnewfacet_">FOREACHnewfacet_</a>
assign 'newfacet' to each facet in facet set </li>
<li><a href="libqhull.h#FOREACHpoint_">FOREACHpoint_</a>
assign 'point' to each point in points set </li>
<li><a href="libqhull.h#FOREACHridge_">FOREACHridge_</a>
assign 'ridge' to each ridge in ridge set </li>
<li><a href="libqhull.h#FOREACHvertex_">FOREACHvertex_</a>
assign 'vertex' to each vertex in vertex set </li>
<li><a href="poly.h#FOREACHvertexA_">FOREACHvertexA_</a>
assign 'vertexA' to each vertex in vertex set</li>
<li><a href="poly.h#FOREACHvisible_">FOREACHvisible_</a>
assign 'visible' to each facet in facet set </li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="pieach">Indexed
FOREACH macros</a></h3>
<ul>
<li><a href="libqhull.h#FOREACHfacet_i_">FOREACHfacet_i_</a>
assign 'facet' and 'facet_i' to each facet in
facet set </li>
<li><a href="libqhull.h#FOREACHneighbor_i_">FOREACHneighbor_i_</a>
assign 'neighbor' and 'neighbor_i' to each facet
in facet-&gt;neighbors or vertex-&gt;neighbors</li>
<li><a href="libqhull.h#FOREACHpoint_i_">FOREACHpoint_i_</a>
assign 'point' and 'point_i' to each point in
points set </li>
<li><a href="libqhull.h#FOREACHridge_i_">FOREACHridge_i_</a>
assign 'ridge' and 'ridge_i' to each ridge in
ridges set </li>
<li><a href="libqhull.h#FOREACHvertex_i_">FOREACHvertex_i_</a>
assign 'vertex' and 'vertex_i' to each vertex in
vertices set </li>
<li><a href="poly.h#FOREACHvertexreverse12_">FOREACHvertexreverse12_</a>
assign 'vertex' to each vertex in vertex set;
reverse the order of first two vertices </li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="pmacro">Other macros for polyhedrons</a></h3>
<ul>
<li><a href="libqhull.h#getid_">getid_</a> return ID for
a facet, ridge, or vertex </li>
<li><a href="libqhull.h#otherfacet_">otherfacet_</a>
return neighboring facet for a ridge in a facet </li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="plist">Facetlist
functions</a></h3>
<ul>
<li><a href="poly.c#appendfacet">qh_appendfacet</a>
appends facet to end of qh.facet_list</li>
<li><a href="poly.c#attachnewfacets">qh_attachnewfacets</a>
attach new facets in qh.newfacet_list to the
horizon </li>
<li><a href="poly2.c#findgood">qh_findgood</a>
identify good facets for qh.PRINTgood </li>
<li><a href="poly2.c#findgood_all">qh_findgood_all</a>
identify more good facets for qh.PRINTgood </li>
<li><a href="poly2.c#furthestnext">qh_furthestnext</a>
move facet with furthest of furthest points to
facet_next </li>
<li><a href="poly2.c#initialhull">qh_initialhull</a>
construct the initial hull as a simplex of
vertices </li>
<li><a href="poly2.c#nearcoplanar">qh_nearcoplanar</a>
remove near-inside points from coplanar sets</li>
<li><a href="poly2.c#prependfacet">qh_prependfacet</a>
prepends facet to start of facetlist </li>
<li><a href="user.c#printfacetlist">qh_printfacetlist</a>
print facets in a facetlist</li>
<li><a href="poly2.c#printlists">qh_printlists</a>
print out facet list for debugging </li>
<li><a href="poly.c#removefacet">qh_removefacet</a>
unlinks facet from qh.facet_list</li>
<li><a href="poly2.c#resetlists">qh_resetlists</a>
reset qh.newvertex_list, qh.newfacet_list, and
qh.visible_list </li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="pfacet">Facet
functions</a></h3>
<ul>
<li><a href="poly2.c#createsimplex">qh_createsimplex</a>
create a simplex of facets from a set of vertices
</li>
<li><a href="poly2.c#findbestlower">qh_findbestlower</a> find best
non-upper, non-flipped facet for point at upperfacet</li>
<li><a href="poly2.c#furthestout">qh_furthestout</a>
make furthest outside point the last point of a
facet's outside set </li>
<li><a href="poly.c#makenew_nonsimplicial">qh_makenew_nonsimplicial</a>
make new facets from ridges of visible facets </li>
<li><a href="poly.c#makenew_simplicial">qh_makenew_simplicial</a>
make new facets for horizon neighbors </li>
<li><a href="poly.c#makenewfacet">qh_makenewfacet</a>
create a facet from vertices and apex </li>
<li><a href="poly2.c#makenewfacets">qh_makenewfacets</a>
make new facets from vertex, horizon facets, and
visible facets </li>
<li><a href="poly.c#makenewplanes">qh_makenewplanes</a>
make new hyperplanes for facets </li>
<li><a href="poly2.c#outcoplanar">qh_outcoplanar</a>
move points from outside set to coplanar set </li>
<li><a href="poly2.c#setvoronoi_all">qh_setvoronoi_all</a>
compute Voronoi centers for all facets </li>
<li><a href="poly2.c#triangulate">qh_triangulate</a>
triangulate non-simplicial facets</li>
<li><a href="poly2.c#triangulate_facet">qh_triangulate_facet</a>
triangulate a non-simplicial facet</li>
<li><a href="poly2.c#triangulate_link">qh_triangulate_link</a>
link facets together from qh_triangulate</li>
<li><a href="poly2.c#triangulate_mirror">qh_triangulate_mirror</a>
delete mirrored facets from qh_triangulate</li>
<li><a href="poly2.c#triangulate_null">qh_triangulate_null</a>
delete null facet from qh_triangulate</li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="pvertex">Vertex,
ridge, and point functions</a></h3>
<ul>
<li><a href="poly.c#appendvertex">qh_appendvertex</a>
append vertex to end of qh.vertex_list, </li>
<li><a href="io.c#detvridge">qh_detvridge</a> determine Voronoi
ridge for an input site
<li><a href="io.c#detvridge3">qh_detvridge3</a> determine 3-d Voronoi
ridge for an input site
<li><a href="poly2.c#facet3vertex">qh_facet3vertex</a>
return an oriented vertex set for a 3-d facet </li>
<li><a href="poly.c#facetintersect">qh_facetintersect</a>
return intersection of simplicial facets </li>
<li><a href="poly2.c#initialvertices">qh_initialvertices</a>
return non-singular set of initial vertices </li>
<li><a href="poly2.c#isvertex">qh_isvertex</a> true
if point is in a vertex set </li>
<li><a href="poly2.c#nearvertex">qh_nearvertex</a>
return nearest vertex to point </li>
<li><a href="poly2.c#nextridge3d">qh_nextridge3d</a>
iterate over each ridge and vertex for a 3-d
facet </li>
<li><a href="poly2.c#point">qh_point</a> return point
for a point ID </li>
<li><a href="poly2.c#pointfacet">qh_pointfacet</a>
return temporary set of facets indexed by point
ID </li>
<li><a href="poly.c#pointid">qh_pointid</a> return ID
for a point</li>
<li><a href="poly2.c#pointvertex">qh_pointvertex</a>
return temporary set of vertices indexed by point
ID </li>
<li><a href="poly.c#removevertex">qh_removevertex</a>
unlink vertex from qh.vertex_list, </li>
<li><a href="poly.c#updatevertices">qh_updatevertices</a>
update vertex neighbors and delete interior
vertices </li>
<li><a href="poly2.c#vertexintersect">qh_vertexintersect</a>
intersect two vertex sets </li>
<li><a href="poly2.c#vertexintersect_new">qh_vertexintersect_new</a>
return intersection of two vertex sets </li>
<li><a href="poly2.c#vertexneighbors">qh_vertexneighbors</a>
for each vertex in hull, determine facet
neighbors </li>
<li><a href="poly2.c#vertexsubset">qh_vertexsubset</a>
returns True if vertexsetA is a subset of
vertexsetB </li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="phash">Hashtable functions</a></h3>
<ul>
<li><a href="poly2.c#addhash">qh_addhash</a> add hash
element to linear hash table</li>
<li><a href="poly.c#gethash">qh_gethash</a> return
hash value for a set</li>
<li><a href="poly2.c#matchduplicates">qh_matchduplicates</a>
match duplicate ridges in hash table </li>
<li><a href="poly.c#matchneighbor">qh_matchneighbor</a>
try to match subridge of new facet with a
neighbor </li>
<li><a href="poly.c#matchnewfacets">qh_matchnewfacets</a>
match new facets with their new facet neighbors </li>
<li><a href="poly.c#matchvertices">qh_matchvertices</a>
tests whether a facet and hash entry match at a
ridge </li>
<li><a href="poly2.c#newhashtable">qh_newhashtable</a>
allocate a new qh.hash_table </li>
<li><a href="poly2.c#printhashtable">qh_printhashtable</a>
print hash table </li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="pnew">Allocation and
deallocation functions</a></h3>
<ul>
<li><a href="poly2.c#clearcenters">qh_clearcenters</a>
clear old data from facet-&gt;center </li>
<li><a href="poly.c#deletevisible">qh_deletevisible</a>
delete visible facets and vertices </li>
<li><a href="poly.c#delfacet">qh_delfacet</a> free up
the memory occupied by a facet </li>
<li><a href="poly2.c#delridge">qh_delridge</a> delete
ridge</li>
<li><a href="poly2.c#delvertex">qh_delvertex</a>
delete vertex </li>
<li><a href="poly.c#newfacet">qh_newfacet</a> create
and allocate space for a facet </li>
<li><a href="poly.c#newridge">qh_newridge</a> create
and allocate space for a ridge </li>
<li><a href="poly2.c#newvertex">qh_newvertex</a>
create and allocate space for a vertex </li>
</ul>
<h3><a href="qh-poly.htm#TOC">&#187;</a><a name="pcheck">Check
functions</a></h3>
<ul>
<li><a href="poly2.c#check_bestdist">qh_check_bestdist</a>
check that points are not outside of facets </li>
<li><a href="poly2.c#check_dupridge">qh_check_dupridge</a>
check duplicate ridge between facet1 and facet2 for wide merge </li>
<li><a href="poly2.c#check_maxout">qh_check_maxout</a>
updates qh.max_outside and checks all points
against bestfacet </li>
<li><a href="poly2.c#check_output">qh_check_output</a>
check topological and geometric output</li>
<li><a href="poly2.c#check_point">qh_check_point</a>
check that point is not outside of facet </li>
<li><a href="poly2.c#check_points">qh_check_points</a>
check that all points are inside all facets </li>
<li><a href="poly2.c#checkconvex">qh_checkconvex</a>
check that each ridge in facetlist is convex </li>
<li><a href="poly2.c#checkfacet">qh_checkfacet</a>
check for consistency errors in facet </li>
<li><a href="poly.c#checkflipped">qh_checkflipped</a>
check facet orientation to the interior point </li>
<li><a href="poly2.c#checkflipped_all">qh_checkflipped_all</a>
check facet orientation for a facet list </li>
<li><a href="poly2.c#checkpolygon">qh_checkpolygon</a>
check topological structure </li>
<li><a href="poly2.c#checkvertex">qh_checkvertex</a>
check vertex for consistency </li>
<li><a href="poly2.c#infiniteloop">qh_infiniteloop</a>
report error for a loop of facets </li>
<li><a href="poly2.c#printlists">qh_printlists</a>
print out facet list for debugging </li>
</ul>
<p><!-- Navigation links --> </p>
<hr>
<p><b>Up:</b>
<a href="http://www.qhull.org">Home page for
Qhull</a> <br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual: Table of Contents</a> <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149;
<a href="qh-globa.htm">Global</a> &#149; <a href="qh-io.htm">Io</a>
&#149; <a href="qh-mem.htm">Mem</a> &#149; <a href="qh-merge.htm">Merge</a>
&#149; <a href="qh-poly.htm">Poly</a> &#149; <a href="qh-qhull.htm#TOC">Qhull</a>
&#149; <a href="qh-set.htm">Set</a> &#149; <a href="qh-stat.htm">Stat</a>
&#149; <a href="qh-user.htm">User</a><br>
</p>
<p><!-- GC common information --> </p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img
src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
Geometry Center Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,279 @@
<!-- Do not edit with Front Page, it adds too many spaces -->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>libqhull.c -- top-level functions and basic data types</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a><br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149; <a href="qh-globa.htm">Global</a>
&#149; <a href="qh-io.htm">Io</a> &#149; <a href="qh-mem.htm">Mem</a>
&#149; <a href="qh-merge.htm">Merge</a> &#149; <a href="qh-poly.htm">Poly</a>
&#149; <a href="qh-qhull.htm#TOC">Qhull</a> &#149; <a href="qh-set.htm">Set</a>
&#149; <a href="qh-stat.htm">Stat</a> &#149; <a href="qh-user.htm">User</a>
</p>
<hr>
<h2>libqhull.c -- top-level functions and basic data types</h2>
<blockquote>
<p>Qhull implements the Quickhull algorithm for computing
the convex hull. The Quickhull algorithm combines two
well-known algorithms: the 2-d quickhull algorithm and
the n-d beneath-beyond algorithm. See
<a href="../../html/index.htm#description">Description of Qhull</a>. </p>
<p>This section provides an index to the top-level
functions and base data types. The top-level header file, <tt>libqhull.h</tt>,
contains prototypes for these functions.</p>
</blockquote>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="#TOP">&#187;</a> <a href="qh-geom.htm#TOC">Geom</a>
<a name="TOC">&#149;</a> <a href="qh-globa.htm#TOC">Global</a>
&#149; <a href="qh-io.htm#TOC">Io</a> &#149; <a href="qh-mem.htm#TOC">Mem</a>
&#149; <a href="qh-merge.htm#TOC">Merge</a> &#149; <a href="qh-poly.htm#TOC">Poly</a>
&#149; <b>Qhull</b> &#149; <a href="qh-set.htm#TOC">Set</a>
&#149; <a href="qh-stat.htm#TOC">Stat</a> &#149; <a href="qh-user.htm#TOC">User</a>
</p>
<h3>Index to <a href="libqhull.c">libqhull.c</a>,
<a href="libqhull.h">libqhull.h</a>, and
<a href="../qhull/unix.c">unix.c</a></h3>
<ul>
<li><a href="#qtype">libqhull.h and unix.c data types and
constants</a> </li>
<li><a href="#qmacro">libqhull.h other macros</a> </li>
<li><a href="#qfunc">Quickhull routines in call order</a> </li>
<li><a href="#qinit">Top-level routines for initializing and terminating Qhull</a></li>
<li><a href="#qin">Top-level routines for reading and modifying the input</a></li>
<li><a href="#qcall">Top-level routines for calling Qhull</a></li>
<li><a href="#qout">Top-level routines for returning results</a></li>
<li><a href="#qtest">Top-level routines for testing and debugging</a></li>
</ul>
<h3><a href="qh-qhull.htm#TOC">&#187;</a><a name="qtype">libqhull.h and unix.c
data types and constants</a></h3>
<ul>
<li><a href="libqhull.h#flagT">flagT</a> Boolean flag as
a bit </li>
<li><a href="libqhull.h#boolT">boolT</a> boolean value,
either True or False </li>
<li><a href="libqhull.h#CENTERtype">CENTERtype</a> to
distinguish facet-&gt;center </li>
<li><a href="libqhull.h#qh_PRINT">qh_PRINT</a> output
formats for printing (qh.PRINTout) </li>
<li><a href="libqhull.h#qh_ALL">qh_ALL</a> argument flag
for selecting everything </li>
<li><a href="libqhull.h#qh_ERR">qh_ERR</a> Qhull exit
codes for indicating errors </li>
<li><a href="libqhull.h#qh_FILEstderr">qh_FILEstderr</a> Fake stderr
to distinguish error output from normal output [C++ only]</li>
<li><a href="../qhull/unix.c#prompt">qh_prompt</a> version and long prompt for Qhull</li>
<li><a href="../qhull/unix.c#prompt2">qh_prompt2</a> synopsis for Qhull</li>
<li><a href="../qhull/unix.c#prompt3">qh_prompt3</a> concise prompt for Qhull</li>
<li><a href="global.c#qh_version">qh_version</a> version stamp</li>
</ul>
<h3><a href="qh-qhull.htm#TOC">&#187;</a><a name="qmacro">libqhull.h other
macros</a></h3>
<ul>
<li><a href="qhull_a.h#traceN">traceN</a> print trace
message if <em>qh.IStracing &gt;= N</em>. </li>
<li><a href="qhull_a.h#QHULL_UNUSED">QHULL_UNUSED</a> declare an
unused variable to avoid warnings. </li>
</ul>
<h3><a href="qh-qhull.htm#TOC">&#187;</a><a name="qfunc">Quickhull
routines in call order</a></h3>
<ul>
<li><a href="../qhull/unix.c#main">main</a> processes the
command line, calls qhull() to do the work, and
exits </li>
<li><a href="libqhull.c#qhull">qh_qhull</a> construct
the convex hull of a set of points </li>
<li><a href="libqhull.c#build_withrestart">qh_build_withrestart</a>
allow restarts while calling qh_buildhull</li>
<li><a href="poly2.c#initbuild">qh_initbuild</a>
initialize hull and outside sets with point array</li>
<li><a href="libqhull.c#partitionall">qh_partitionall</a>
partition all points into outside sets </li>
<li><a href="libqhull.c#buildhull">qh_buildhull</a>
construct a convex hull by adding points one at a
time </li>
<li><a href="libqhull.c#nextfurthest">qh_nextfurthest</a>
return next furthest point for processing </li>
<li><a href="libqhull.c#buildtracing">qh_buildtracing</a>
trace an iteration of buildhull </li>
<li><a href="libqhull.c#addpoint">qh_addpoint</a> add a
point to the convex hull </li>
<li><a href="libqhull.c#findhorizon">qh_findhorizon</a>
find the horizon and visible facets for a point </li>
<li><a href="libqhull.c#partitionvisible">qh_partitionvisible</a>
partition points from facets in qh.visible_list
to facets in qh.newfacet_list </li>
<li><a href="libqhull.c#partitionpoint">qh_partitionpoint</a>
partition a point as inside, coplanar with, or
outside a facet </li>
<li><a href="libqhull.c#partitioncoplanar">qh_partitioncoplanar</a>
partition coplanar point into a facet </li>
<li><a href="libqhull.c#precision">qh_precision</a> restart on precision errors if not merging and if 'QJn'</li>
</ul>
<h3><a href="qh-qhull.htm#TOC">&#187;</a><a name="qinit">Top-level routines for initializing and terminating Qhull (in other modules)</a></h3>
<ul>
<li><a href="global.c#freebuild">qh_freebuild</a>
free memory used by qh_initbuild and qh_buildhull
</li>
<li><a href="global.c#checkflags">qh_checkflags</a>
check flags for multiple frontends to qhull
<li><a href="global.c#freeqhull">qh_freeqhull</a>
free memory used by qhull </li>
<li><a href="global.c#init_A">qh_init_A</a> called
before error handling initialized </li>
<li><a href="global.c#init_B">qh_init_B</a> called
after points are defined </li>
<li><a href="global.c#initflags">qh_initflags</a> set
flags and constants from command line </li>
<li><a href="rboxlib.c#rboxpoints">qh_rboxpoints</a>
generate points for qhull </li>
<li><a href="global.c#restore_qhull">qh_restore_qhull</a>
restores a saved qhull </li>
<li><a href="global.c#save_qhull">qh_save_qhull</a>
saves qhull for later restoring </li>
<li><a href="user.c#user_memsizes">qh_user_memsizes</a>
define additional quick allocation sizes
</li>
</ul>
<h3><a href="qh-qhull.htm#TOC">&#187;</a><a name="qin">Top-level routines for reading and modifying the input (in other modules)</a></h3>
<ul>
<li><a href="geom2.c#gram_schmidt">qh_gram_schmidt</a>
implements Gram-Schmidt orthogonalization by rows </li>
<li><a href="geom2.c#projectinput">qh_projectinput</a>
project input along one or more dimensions +
Delaunay projection </li>
<li><a href="geom2.c#randommatrix">qh_randommatrix</a>
generate a random dimXdim matrix in range (-1,1) </li>
<li><a href="io.c#readpoints">qh_readpoints</a> read
points from input </li>
<li><a href="geom2.c#rotateinput">qh_rotateinput</a> rotate
input points using row matrix </li>
<li><a href="geom2.c#scaleinput">qh_scaleinput</a> scale
input points using qh low_bound/high_bound </li>
<li><a href="geom2.c#setdelaunay">qh_setdelaunay</a> project
points to paraboloid for Delaunay triangulation </li>
<li><a href="geom2.c#sethalfspace_all">qh_sethalfspace_all</a>
generate dual for halfspace intersection with interior
point </li>
</ul>
<h3><a href="qh-qhull.htm#TOC">&#187;</a><a name="qcall">Top-level routines for calling Qhull (in other modules)</a></h3>
<ul>
<li><a href="libqhull.c#addpoint">qh_addpoint</a> add
point to convex hull </li>
<li><a href="poly2.c#findbestfacet">qh_findbestfacet</a>
find facet that is furthest below a point </li>
<li><a href="poly2.c#findfacet_all">qh_findfacet_all</a>
exhaustive search for facet below a point </li>
<li><a href="libqhull.c#qhull">qh_qhull</a> construct
the convex hull of a set of points </li>
</ul>
<h3><a href="qh-qhull.htm#TOC">&#187;</a><a name="qout">Top-level routines for returning results (in other modules)</a></h3>
<ul>
<li><a href="stat.c#collectstatistics">qh_collectstatistics</a>
collect statistics for qh.facet_list </li>
<li><a href="poly2.c#nearvertex">qh_nearvertex</a>
return nearest vertex to point </li>
<li><a href="poly2.c#point">qh_point</a> return point
for a point ID </li>
<li><a href="poly2.c#pointfacet">qh_pointfacet</a>
return temporary set of facets indexed by point
ID </li>
<li><a href="poly.c#pointid">qh_pointid</a> return ID
for a point</li>
<li><a href="poly2.c#pointvertex">qh_pointvertex</a>
return vertices (if any) for all points</li>
<li><a href="stat.c#printallstatistics">qh_printallstatistics</a>
print all statistics </li>
<li><a href="io.c#printneighborhood">qh_printneighborhood</a>
print neighborhood of one or two facets </li>
<li><a href="libqhull.c#printsummary">qh_printsummary</a>
print summary </li>
<li><a href="io.c#produce_output">qh_produce_output</a>
print the results of qh_qhull() </li>
<li><a href="poly2.c#setvoronoi_all">qh_setvoronoi_all</a>
compute Voronoi centers for all facets </li>
</ul>
<h3><a href="qh-qhull.htm#TOC">&#187;</a><a name="qtest">Top-level routines for testing and debugging (in other modules)</a></h3>
<ul>
<li><a href="io.c#dfacet">dfacet</a> print facet by
ID from debugger </li>
<li><a href="io.c#dvertex">dvertex</a> print vertex
by ID from debugger </li>
<li><a href="poly2.c#check_output">qh_check_output</a>
check output </li>
<li><a href="poly2.c#check_points">qh_check_points</a>
verify that all points are inside the convex hull
</li>
<li><a href="user.c#errexit">qh_errexit</a> report
error with a facet and a ridge</li>
<li><a href="libqhull.c#errexit2">qh_errexit2</a> report
error with two facets </li>
<li><a href="user.c#errprint">qh_errprint</a> print
erroneous facets, ridge, and vertex </li>
<li><a href="user.c#printfacetlist">qh_printfacetlist</a>
print all fields for a list of facets </li>
</ul>
<p><!-- Navigation links --> </p>
<hr>
<p><b>Up:</b>
<a href="http://www.qhull.org">Home page for
Qhull</a> <br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual: Table of Contents</a> <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149;
<a href="qh-globa.htm">Global</a> &#149; <a href="qh-io.htm">Io</a>
&#149; <a href="qh-mem.htm">Mem</a> &#149; <a href="qh-merge.htm">Merge</a>
&#149; <a href="qh-poly.htm">Poly</a> &#149; <a href="qh-qhull.htm#TOC">Qhull</a>
&#149; <a href="qh-set.htm">Set</a> &#149; <a href="qh-stat.htm">Stat</a>
&#149; <a href="qh-user.htm">User</a><br>
</p>
<p><!-- GC common information --> </p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img
src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
Geometry Center Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,308 @@
<!-- Do not edit with Front Page, it adds too many spaces -->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>qset.c -- set data type and operations</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a><br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149; <a href="qh-globa.htm">Global</a>
&#149; <a href="qh-io.htm">Io</a> &#149; <a href="qh-mem.htm">Mem</a>
&#149; <a href="qh-merge.htm">Merge</a> &#149; <a href="qh-poly.htm">Poly</a>
&#149; <a href="qh-qhull.htm">Qhull</a> &#149; <a href="qh-set.htm#TOC">Set</a>
&#149; <a href="qh-stat.htm">Stat</a> &#149; <a href="qh-user.htm">User</a>
</p>
<hr>
<h2>qset.c -- set data type and operations</h2>
<blockquote>
<p>Qhull's data structures are constructed from sets. The
functions and macros in qset.c construct, iterate, and
modify these sets. They are the most frequently called
functions in Qhull. For this reason, efficiency is the
primary concern. </p>
<p>In Qhull, a <i>set</i> is represented by an unordered
array of pointers with a maximum size and a NULL
terminator (<a href="qset.h#setT">setT</a>).
Most sets correspond to mathematical sets
(i.e., the pointers are unique). Some sets are sorted to
enforce uniqueness. Some sets are ordered. For example,
the order of vertices in a ridge determine the ridge's
orientation. If you reverse the order of adjacent
vertices, the orientation reverses. Some sets are not
mathematical sets. They may be indexed as an array and
they may include NULL pointers. </p>
<p>The most common operation on a set is to iterate its
members. This is done with a 'FOREACH...' macro. Each set
has a custom macro. For example, 'FOREACHvertex_'
iterates over a set of vertices. Each vertex is assigned
to the variable 'vertex' from the pointer 'vertexp'. </p>
<p>Most sets are constructed by appending elements to the
set. The last element of a set is either NULL or the
index of the terminating NULL for a partially full set.
If a set is full, appending an element copies the set to
a larger array. </p>
</blockquote>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="#TOP">&#187;</a> <a href="qh-geom.htm#TOC">Geom</a>
<a name="TOC">&#149;</a> <a href="qh-globa.htm#TOC">Global</a> &#149;
<a href="qh-io.htm#TOC">Io</a> &#149; <a href="qh-mem.htm#TOC">Mem</a> &#149;
<a href="qh-merge.htm#TOC">Merge</a> &#149; <a href="qh-poly.htm#TOC">Poly</a>
&#149; <a href="qh-qhull.htm#TOC">Qhull</a> &#149; <b>Set</b>
&#149; <a href="qh-stat.htm#TOC">Stat</a> &#149; <a href="qh-user.htm#TOC">User</a>
</p>
<h3>Index to <a href="qset.c">qset.c</a> and
<a href="qset.h">qset.h</a></h3>
<ul>
<li><a href="#stype">Data types and constants</a> </li>
<li><a href="#seach">FOREACH macros</a> </li>
<li><a href="#saccess">access and size macros</a> </li>
<li><a href="#sint">internal macros</a> </li>
<li><a href="#saddr">address macros</a><p>&nbsp;</li>
<li><a href="#snew">Allocation and deallocation functions</a> </li>
<li><a href="#spred">Access and predicate functions</a>
</li>
<li><a href="#sadd">Add functions</a> </li>
<li><a href="#scheck">Check and print functions</a></li>
<li><a href="#scopy">Copy, compact, and zero functions</a></li>
<li><a href="#sdel">Delete functions</a> </li>
<li><a href="#stemp">Temporary set functions</a> </li>
</ul>
<h3><a href="qh-set.htm#TOC">&#187;</a><a name="stype">Data types and
constants</a></h3>
<ul>
<li><a href="qset.h#SETelemsize">SETelemsize</a> size
of a set element in bytes </li>
<li><a href="qset.h#setT">setT</a> a set with a
maximum size and a current size</li>
<li><a href="libqhull.h#qh-set">qh global sets</a>
global sets for temporary sets, etc. </li>
</ul>
<h3><a href="qh-set.htm#TOC">&#187;</a><a name="seach">FOREACH macros</a></h3>
<ul>
<li><a href="qset.h#FOREACHelem_">FOREACHelem_</a>
assign 'elem' to each element in a set </li>
<li><a href="qset.h#FOREACHset_">FOREACHset_</a>
assign 'set' to each set in a set of sets </li>
<li><a href="qset.h#FOREACHsetelement_">FOREACHsetelement_</a>
define a FOREACH iterator </li>
<li><a href="qset.h#FOREACHsetelement_i_">FOREACHsetelement_i_</a>
define an indexed FOREACH iterator </li>
<li><a href="qset.h#FOREACHsetelementreverse_">FOREACHsetelementreverse_</a>
define a reversed FOREACH iterator </li>
<li><a href="qset.h#FOREACHsetelementreverse12_">FOREACHsetelementreverse12_</a>
define a FOREACH iterator with e[1] and e[0]
reversed </li>
</ul>
<h3><a href="qh-set.htm#TOC">&#187;</a><a name="saccess">Access and
size macros</a></h3>
<ul>
<li><a href="qset.h#SETelem_">SETelem_</a> return the
n'th element of set </li>
<li><a href="qset.h#SETelemt_">SETelemt_</a> return
the n'th element of set as a type</li>
<li><a href="qset.h#SETempty_">SETempty_</a> return
true (1) if set is empty </li>
<li><a href="qset.h#SETfirst_">SETfirst_</a> return
first element of set </li>
<li><a href="qset.h#SETfirstt_">SETfirstt_</a> return
first element of set as a type</li>
<li><a href="qset.h#SETindex_">SETindex_</a> return
index of elem in set </li>
<li><a href="qset.h#SETreturnsize_">SETreturnsize_</a>
return size of a set (normally use <a href="qset.c#setsize">qh_setsize</a>) </li>
<li><a href="qset.h#SETsecond_">SETsecond_</a> return
second element of set </li>
<li><a href="qset.h#SETsecondt_">SETsecondt_</a>
return second element of set as a type</li>
<li><a href="qset.h#SETtruncate_">SETtruncate_</a>
truncate set to size, i.e., qh_settruncate()</li>
</ul>
<h3><a href="qh-set.htm#TOC">&#187;</a><a name="sint">Internal macros</a></h3>
<ul>
<li><a href="qset.c#SETsizeaddr_">SETsizeaddr_</a>
return pointer to end element of a set (indicates
current size) </li>
</ul>
<h3><a href="qh-set.htm#TOC">&#187;</a><a name="saddr">address macros</a></h3>
<ul>
<li><a href="qset.h#SETaddr_">SETaddr_</a> return
address of a set's elements </li>
<li><a href="qset.h#SETelemaddr_">SETelemaddr_</a>
return address of the n'th element of a set </li>
<li><a href="qset.h#SETref_">SETref_</a> l.h.s. for
modifying the current element in a FOREACH
iteration </li>
</ul>
<h3><a href="qh-set.htm#TOC">&#187;</a><a name="snew">Allocation and
deallocation functions</a></h3>
<ul>
<li><a href="qset.c#setfree">qh_setfree</a> free the
space occupied by a set </li>
<li><a href="qset.c#setfree2">qh_setfree2</a> free a
set and its elements </li>
<li><a href="qset.c#setfreelong">qh_setfreelong</a>
free a set only if it is in long memory </li>
<li><a href="qset.c#setnew">qh_setnew</a> create a new
set </li>
</ul>
<h3><a href="qh-set.htm#TOC">&#187;</a><a name="spred">Access and
predicate functions </a></h3>
<ul>
<li><a href="qset.c#setendpointer">qh_setendpointer</a> return
pointer to NULL terminator of a set</li>
<li><a href="qset.c#setequal">qh_setequal</a> return 1
if two sorted sets are equal </li>
<li><a href="qset.c#setequal_except">qh_setequal_except</a>
return 1 if two sorted sets are equal except for
an element </li>
<li><a href="qset.c#setequal_skip">qh_setequal_skip</a>
return 1 if two sorted sets are equal except for
a pair of skipped elements </li>
<li><a href="qset.c#setequal_skip">qh_setequal_skip</a>
return 1 if two sorted sets are equal except for
a pair of skipped elements </li>
<li><a href="qset.c#setin">qh_setin</a> return 1 if an
element is in a set </li>
<li><a href="qset.c#setindex">qh_setindex</a> return
the index of an element in a set </li>
<li><a href="qset.c#setlast">qh_setlast</a> return
last element of a set</li>
<li><a href="qset.c#setsize">qh_setsize</a> returns
the size of a set </li>
</ul>
<h3><a href="qh-set.htm#TOC">&#187;</a><a name="sadd">Add functions</a></h3>
<ul>
<li><a href="qset.c#setaddnth">qh_setaddnth</a> add a
element as n'th element of sorted or unsorted set
</li>
<li><a href="qset.c#setaddsorted">qh_setaddsorted</a>
add an element to a sorted set </li>
<li><a href="qset.c#setappend">qh_setappend</a> append
an element to a set </li>
<li><a href="qset.c#setappend_set">qh_setappend_set</a>
append a set of elements to a set </li>
<li><a href="qset.c#setappend2ndlast">qh_setappend2ndlast</a>
add an element as the next to the last element in
a set </li>
<li><a href="qset.c#setlarger">qh_setlarger</a> return
a larger set with the same elements</li>
<li><a href="qset.c#setreplace">qh_setreplace</a>
replace one element with another in a set</li>
<li><a href="qset.c#setunique">qh_setunique</a> add an
element if it is not already in a set </li>
</ul>
<h3><a href="qh-set.htm#TOC">&#187;</a><a name="scheck">Check and print functions</a></h3>
<ul>
<li><a href="qset.c#setcheck">qh_setcheck</a> check a
set for validity </li>
<li><a href="qset.c#setprint">qh_setprint</a> print a
set's elements to fp </li>
</ul>
<h3><a href="qh-set.htm#TOC">&#187;</a><a name="scopy">Copy, compact, and zero functions</a></h3>
<ul>
<li><a href="qset.c#setcompact">qh_setcompact</a>
compact NULLs from an unsorted set </li>
<li><a href="qset.c#setcopy">qh_setcopy</a> make a
copy of a sorted or unsorted set </li>
<li><a href="qset.c#setduplicate">qh_setduplicate</a>
duplicate a set and its elements </li>
<li><a href="qset.c#settruncate">qh_settruncate</a>
truncate a set to size elements </li>
<li><a href="qset.c#setzero">qh_setzero</a> zero the
remainder of a set </li>
</ul>
<h3><a href="qh-set.htm#TOC">&#187;</a><a name="sdel">Delete functions</a></h3>
<ul>
<li><a href="qset.c#setdel">qh_setdel</a> delete an
element from an unsorted set. </li>
<li><a href="qset.c#setdellast">qh_setdellast</a>
delete and return last element from a set</li>
<li><a href="qset.c#setdelnth">qh_setdelnth</a> delete
and return nth element from an unsorted set </li>
<li><a href="qset.c#setdelnthsorted">qh_setdelnthsorted</a>
delete and return nth element from a sorted set </li>
<li><a href="qset.c#setdelsorted">qh_setdelsorted</a>
delete an element from a sorted set </li>
<li><a href="qset.c#setnew_delnthsorted">qh_setnew_delnthsorted</a>
create a sorted set not containing the nth
element </li>
</ul>
<h3><a href="qh-set.htm#TOC">&#187;</a><a name="stemp">Temporary set functions</a></h3>
<ul>
<li><a href="qset.c#settemp">qh_settemp</a> return a
temporary set and append it qhmem.tempstack</li>
<li><a href="qset.c#settempfree">qh_settempfree</a>
free and pop a set from qhmem.tempstack</li>
<li><a href="qset.c#settempfree_all">qh_settempfree_all</a>
free all sets in qhmem.tempstack </li>
<li><a href="qset.c#settemppop">qh_settemppop</a> pop
a set from qhmem.tempstack (makes it permanent) </li>
<li><a href="qset.c#settemppush">qh_settemppush</a>
push a set unto qhmem.tempstack (makes it
temporary) </li>
</ul>
<p><!-- Navigation links --> </p>
<hr>
<p><b>Up:</b>
<a href="http://www.qhull.org">Home page for
Qhull</a> <br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual: Table of Contents</a> <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149;
<a href="qh-globa.htm">Global</a> &#149; <a href="qh-io.htm">Io</a>
&#149; <a href="qh-mem.htm">Mem</a> &#149; <a href="qh-merge.htm">Merge</a>
&#149; <a href="qh-poly.htm">Poly</a> &#149; <a href="qh-qhull.htm#TOC">Qhull</a>
&#149; <a href="qh-set.htm">Set</a> &#149; <a href="qh-stat.htm">Stat</a>
&#149; <a href="qh-user.htm">User</a><br>
</p>
<p><!-- GC common information --> </p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img
src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
Geometry Center Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,163 @@
<!-- Do not edit with Front Page, it adds too many spaces -->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>stat.c -- statistical operations</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a><br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149; <a href="qh-globa.htm">Global</a>
&#149; <a href="qh-io.htm">Io</a> &#149; <a href="qh-mem.htm">Mem</a>
&#149; <a href="qh-merge.htm">Merge</a> &#149; <a href="qh-poly.htm">Poly</a>
&#149; <a href="qh-qhull.htm">Qhull</a> &#149; <a href="qh-set.htm">Set</a>
&#149; <a href="qh-stat.htm#TOC">Stat</a> &#149; <a href="qh-user.htm">User</a>
</p>
<hr>
<h2>stat.c -- statistical operations</h2>
<blockquote>
<p>Qhull records many statistics. These functions and
macros make it inexpensive to add a statistic.
<p>As with Qhull's global variables, the statistics data structure is
accessed by a macro, 'qhstat'. If qh_QHpointer is defined, the macro
is 'qh_qhstat->', otherwise the macro is 'qh_qhstat.'.
Statistics
may be turned off in user.h. If so, all but the 'zz'
statistics are ignored.</p>
</blockquote>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="#TOP">&#187;</a> <a href="qh-geom.htm#TOC">Geom</a>
<a name="TOC">&#149;</a> <a href="qh-globa.htm#TOC">Global</a>
&#149; <a href="qh-io.htm#TOC">Io</a> &#149; <a href="qh-mem.htm#TOC">Mem</a>
&#149; <a href="qh-merge.htm#TOC">Merge</a> &#149; <a href="qh-poly.htm#TOC">Poly</a>
&#149; <a href="qh-qhull.htm#TOC">Qhull</a> &#149; <a href="qh-set.htm#TOC">Set</a>
&#149; <b>Stat</b> &#149; <a href="qh-user.htm#TOC">User</a>
</p>
<h3>Index to <a href="stat.c">stat.c</a> and
<a href="stat.h">stat.h</a></h3>
<ul>
<li><a href="#ttype">stat.h types</a> </li>
<li><a href="#tconst">stat.h constants</a> </li>
<li><a href="#tmacro">stat.h macros</a> </li>
<li><a href="#tfunc">stat.c functions</a> </li>
</ul>
<h3><a href="qh-stat.htm#TOC">&#187;</a><a name="ttype">stat.h types</a></h3>
<ul>
<li><a href="stat.h#intrealT">intrealT</a> union of
integer and real</li>
<li><a href="stat.h#qhstat">qhstat</a> global data
structure for statistics </li>
</ul>
<h3><a href="qh-stat.htm#TOC">&#187;</a><a name="tconst">stat.h
constants</a></h3>
<ul>
<li><a href="stat.h#KEEPstatistics">qh_KEEPstatistics</a> 0 turns off most statistics</li>
<li><a href="stat.h#statistics">Z..., W...</a> integer (Z) and real (W) statistics
</li>
<li><a href="stat.h#ZZstat">ZZstat</a> Z.../W... statistics that
remain defined if qh_KEEPstatistics=0
</li>
<li><a href="stat.h#ztype">ztype</a> zdoc, zinc, etc.
for definining statistics </li>
</ul>
<h3><a href="qh-stat.htm#TOC">&#187;</a><a name="tmacro">stat.h macros</a></h3>
<ul>
<li><a href="stat.h#MAYdebugx">MAYdebugx</a> called
frequently for error trapping </li>
<li><a href="stat.h#zadd_">zadd_/wadd_</a> add value
to an integer or real statistic </li>
<li><a href="stat.h#zdef_">zdef_</a> define a
statistic </li>
<li><a href="stat.h#zinc_">zinc_</a> increment an
integer statistic </li>
<li><a href="stat.h#zmax_">zmax_/wmax_</a> update
integer or real maximum statistic </li>
<li><a href="stat.h#zmin_">zmin_/wmin_</a> update
integer or real minimum statistic </li>
<li><a href="stat.h#zval_">zval_/wval_</a> set or
return value of a statistic </li>
</ul>
<h3><a href="qh-stat.htm#TOC">&#187;</a><a name="tfunc">stat.c
functions</a></h3>
<ul>
<li><a href="stat.c#allstatA">qh_allstatA</a> define
statistics in groups of 20 </li>
<li><a href="stat.c#allstatistics">qh_allstatistics</a>
reset printed flag for all statistics </li>
<li><a href="stat.c#collectstatistics">qh_collectstatistics</a>
collect statistics for qh.facet_list </li>
<li><a href="stat.c#freestatistics">qh_freestatistics</a>
free memory used for statistics </li>
<li><a href="stat.c#initstatistics">qh_initstatistics</a>
allocate and initialize statistics </li>
<li><a href="stat.c#newstats">qh_newstats</a> returns
True if statistics for zdoc </li>
<li><a href="stat.c#nostatistic">qh_nostatistic</a>
true if no statistic to print </li>
<li><a href="stat.c#printallstatistics">qh_printallstatistics</a>
print all statistics </li>
<li><a href="stat.c#printstatistics">qh_printstatistics</a>
print statistics to a file </li>
<li><a href="stat.c#printstatlevel">qh_printstatlevel</a>
print level information for a statistic </li>
<li><a href="stat.c#printstats">qh_printstats</a>
print statistics for a zdoc group </li>
<li><a href="stat.c#stddev">qh_stddev</a> compute the
standard deviation and average from statistics </li>
</ul>
<p><!-- Navigation links --> </p>
<hr>
<p><b>Up:</b>
<a href="http://www.qhull.org">Home page for
Qhull</a> <br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual: Table of Contents</a> <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149;
<a href="qh-globa.htm">Global</a> &#149; <a href="qh-io.htm">Io</a>
&#149; <a href="qh-mem.htm">Mem</a> &#149; <a href="qh-merge.htm">Merge</a>
&#149; <a href="qh-poly.htm">Poly</a> &#149; <a href="qh-qhull.htm#TOC">Qhull</a>
&#149; <a href="qh-set.htm">Set</a> &#149; <a href="qh-stat.htm">Stat</a>
&#149; <a href="qh-user.htm">User</a><br>
</p>
<p><!-- GC common information --> </p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img
src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
Geometry Center Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,271 @@
<!-- Do not edit with Front Page, it adds too many spaces -->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>user.c -- user-definable operations</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a><br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149; <a href="qh-globa.htm">Global</a>
&#149; <a href="qh-io.htm">Io</a> &#149; <a href="qh-mem.htm">Mem</a>
&#149; <a href="qh-merge.htm">Merge</a> &#149; <a href="qh-poly.htm">Poly</a>
&#149; <a href="qh-qhull.htm">Qhull</a> &#149; <a href="qh-set.htm">Set</a>
&#149; <a href="qh-stat.htm">Stat</a> &#149; <a href="qh-user.htm#TOC">User</a>
</p>
<hr>
<h2>user.c -- user-definable operations</h2>
<blockquote>
<p>This section contains functions and constants that the
user may want to change. </p>
</blockquote>
<p><b>Copyright &copy; 1995-2015 C.B. Barber</b></p>
<hr>
<p><a href="#TOP">&#187;</a> <a href="qh-geom.htm#TOC">Geom</a>
<a name="TOC">&#149;</a> <a href="qh-globa.htm#TOC">Global</a>
&#149; <a href="qh-io.htm#TOC">Io</a> &#149; <a href="qh-mem.htm#TOC">Mem</a>
&#149; <a href="qh-merge.htm#TOC">Merge</a> &#149; <a href="qh-poly.htm#TOC">Poly</a>
&#149; <a href="qh-qhull.htm#TOC">Qhull</a> &#149; <a href="qh-set.htm#TOC">Set</a>
&#149; <a href="qh-stat.htm#TOC">Stat</a> &#149; <b>User</b>
</p>
<h3>Index to <a href="user.c">user.c</a>, <a href="usermem.c">usermem.c</a>, <a href="userprintf.c">userprintf.c</a>, <a href="userprintf_rbox.c">userprintf_rbox.c</a> and
<a href="user.h">user.h</a></h3>
<ul>
<li><a href="#qulllib">qhull library constants</a></li>
<li><a href="#utype">user.h data types and
configuration macros</a> </li>
<li><a href="#ujoggle">joggle constants</a></li>
<li><a href="#uperform">performance related constants</a></li>
<li><a href="#umemory">memory constants</a></li>
<li><a href="#ucond">conditional compilation</a></li>
<li><a href="#umerge">merge constants</a> </li>
<li><a href="#ufunc">user.c functions</a> </li>
<li><a href="#u2func">usermem.c functions</a> </li>
<li><a href="#u3func">userprintf.c functions</a> </li>
</ul>
<h3><a href="qh-user.htm#TOC">&#187;</a><a name="qulllib">Qhull library constants</a></h3>
<ul>
<li><a href="user.h#filenamelen">FILENAMElen</a> -- max length of TI or TO filename </li>
<li><a href="user.h#msgcode">msgcode</a> -- unique message codes for qh_fprintf </li>
<li><a href="user.h#qh_OPTIONline">qh_OPTIONline</a> -- max length of option line ('FO')</li>
</ul>
<h3><a href="qh-user.htm#TOC">&#187;</a><a name="utype">user.h data
types and configuration macros</a></h3>
<ul>
<li><a href="user.h#realT">realT, qh_REAL...</a> size
of floating point numbers </li>
<li><a href="user.h#countT">countT, COUNTmax</a> size
of counts and identifiers, typically 'int' or 'long long' </li>
<li><a href="user.h#CPUclock">qh_CPUclock</a> clock()
function for reporting the total time spent by
Qhull </li>
<li><a href="user.h#RANDOM">qh_RANDOM...</a> random
number generator </li>
</ul>
<h3><a href="qh-user.htm#TOC">&#187;</a><a name="udef">definition constants</a></h3>
<ul>
<li><a href="user.h#DEFAULTbox">qh_DEFAULTbox</a>
define default box size for rbox, 'Qbb', and 'QbB' (Geomview expects 0.5) </li>
<li><a href="user.h#INFINITE">qh_INFINITE</a> on
output, indicates Voronoi center at infinity </li>
<li><a href="user.h#ORIENTclock">qh_ORIENTclock</a>
define convention for orienting facets</li>
<li><a href="user.h#ZEROdelaunay">qh_ZEROdelaunay</a>
define facets that are ignored in Delaunay triangulations</li>
</ul>
<h3><a href="qh-user.htm#TOC">&#187;</a><a name="ujoggle">joggle constants</a></h3>
<ul>
<li><a href="user.h#JOGGLEagain">qh_JOGGLEagain</a>
how often to retry before using qh_JOGGLEmaxincrease
again </li>
<li><a href="user.h#JOGGLEdefault">qh_JOGGLEdefault</a>
default value for qh.JOGGLEmax for 'QP' </li>
<li><a href="user.h#JOGGLEincrease">qh_JOGGLEincrease</a>
factor to increase qh.JOGGLEmax on retrys for
'QPn' </li>
<li><a href="user.h#JOGGLEmaxincrease">qh_JOGGLEmaxincrease</a> max
for increasing qh.JOGGLEmax relative to
qh.MAXwidth </li>
<li><a href="user.h#JOGGLEretry">qh_JOGGLEmaxretry</a>
report error if this many retries </li>
<li><a href="user.h#JOGGLEretry">qh_JOGGLEretry</a>
how often to retry before using qh_JOGGLEmax </li>
</ul>
<h3><a href="qh-user.htm#TOC">&#187;</a><a name="uperform">performance
related constants</a></h3>
<ul>
<li><a href="user.h#HASHfactor">qh_HASHfactor</a>
total/used hash slots </li>
<li><a href="user.h#INITIALmax">qh_INITIALmax</a> if
dim &gt;= qh_INITIALmax, use min/max coordinate
points for initial simplex </li>
<li><a href="user.h#INITIALsearch">qh_INITIALsearch</a>
if qh.INITIALmax, search points up to this
dimension </li>
<li><a href="user.h#NOtrace">qh_NOtrace</a> disallow
tracing </li>
<li><a href="user.h#VERIFYdirect">qh_VERIFYdirect</a>
'Tv' verifies all <em>points X facets</em> if op
count is smaller </li>
</ul>
<h3><a href="qh-user.htm#TOC">&#187;</a><a name="umemory">memory constants</a></h3>
<ul>
<li><a href="user.h#MEMalign">qh_MEMalign</a> memory
alignment for qh_meminitbuffers() in global.c </li>
<li><a href="user.h#MEMbufsize">qh_MEMbufsize</a>
size of additional memory buffers </li>
<li><a href="user.h#MEMinitbuf">qh_MEMinitbuf</a>
size of initial memory buffer </li>
</ul>
<h3><a href="qh-user.htm#TOC">&#187;</a><a name="ucond">conditional compilation</a></h3>
<ul>
<li><a href="user.h#compiler">compiler</a> defined symbols,
e.g., _STDC_ and _cplusplus
<li><a href="user.h#COMPUTEfurthest">qh_COMPUTEfurthest</a>
compute furthest distance to an outside point instead of storing it with the facet
<li><a href="user.h#KEEPstatistics">qh_KEEPstatistics</a>
enable statistic gathering and reporting with option 'Ts'
<li><a href="user.h#MAXoutside">qh_MAXoutside</a>
record outer plane for each facet
<li><a href="user.h#NOmerge">qh_NOmerge</a>
disable facet merging
<li><a href="user.h#NOtrace">qh_NOtrace</a>
disable tracing with option 'T4'
<li><a href="user.h#QHpointer">qh_QHpointer</a>
access global data with pointer or static structure
<li><a href="user.h#QUICKhelp">qh_QUICKhelp</a>
use abbreviated help messages, e.g., for degenerate inputs
</ul>
<h3><a href="qh-user.htm#TOC">&#187;</a><a name="umerge">merge
constants</a></h3>
<ul>
<li><a href="user.h#BESTcentrum">qh_BESTcentrum</a>
when does qh_findbestneighbor() test centrums? </li>
<li><a href="user.h#BESTnonconvex">qh_BESTnonconvex</a>
when does qh_findbestneighbor() test nonconvex
ridges only? </li>
<li><a href="user.h#COPLANARratio">qh_COPLANARratio</a>
what is qh.MINvisible? </li>
<li><a href="user.h#DIMreduceBuild">qh_DIMreduceBuild</a>
max dimension for vertex reduction </li>
<li><a href="user.h#DIMmergeVertex">qh_DIMmergeVertex</a>
max dimension for vertex merging </li>
<li><a href="user.h#DISToutside">qh_DISToutside</a>
when is a point clearly outside of a facet for qh_findbestnew and qh_partitionall</li>
<li><a href="user.h#MAXnarrow">qh_MAXnarrow</a> max.
cosine for qh.NARROWhull </li>
<li><a href="user.h#MAXnewcentrum">qh_MAXnewcentrum</a>
when does qh_reducevertices_centrum() reset the
centrum? </li>
<li><a href="user.h#MAXnewmerges">qh_MAXnewmerges</a>
when does qh_merge_nonconvex() call
qh_reducevertices_centrums? </li>
<li><a href="user.h#RATIOnearinside">qh_RATIOnearinside</a>
ratio for retaining inside points for
qh_check_maxout() </li>
<li><a href="user.h#SEARCHdist">qh_SEARCHdist</a>
when is facet coplanar with the best facet for qh_findbesthorizon</li>
<li><a href="user.h#USEfindbestnew">qh_USEfindbestnew</a>
when to use qh_findbestnew for qh_partitionpoint()</li>
<li><a href="user.h#WARNnarrow">qh_WARNnarrow</a>
max. cosine to warn about qh.NARROWhull </li>
<li><a href="user.h#WIDEcoplanar">qh_WIDEcoplanar</a>
what is a wide facet? </li>
<li><a href="user.h#WIDEduplicate">qh_WIDEduplicate</a>
what is a wide ratio on merging duplicate ridges? </li>
</ul>
<h3><a href="qh-user.htm#TOC">&#187;</a><a name="ufunc">user.c
functions</a></h3>
<ul>
<li><a href="user.c#qhull_template">Qhull template</a> for calling qh_new_qhull from your program</li>
<li><a href="user.c#errexit">qh_errexit</a> report
error and exit qhull()</li>
<li><a href="user.c#errprint">qh_errprint</a> print
information about facets and ridges </li>
<li><a href="user.c#new_qhull">qh_new_qhull</a> call qhull on an array
of points</li>
<li><a href="user.c#printfacetlist">qh_printfacetlist</a>
print all fields of all facets </li>
</ul>
<h3><a href="qh-user.htm#TOC">&#187;</a><a name="u2func">usermem.c
functions</a></h3>
<ul>
<li><a href="usermem.c#qh_exit">qh_exit</a> exit program, same as exit(). May be redefined as throw "QH10003.." by libqhullcpp/usermem_r-cpp.cpp</li>
<li><a href="usermem.c#qh_fprintf_stderr">qh_fprintf_stderr</a> print to stderr when qh.ferr is not defined.</li>
<li><a href="usermem.c#qh_free">qh_free</a> free memory, same as free().</li>
<li><a href="usermem.c#qh_malloc">qh_malloc</a> allocate memory, same as malloc()</li>
</ul>
<h3><a href="qh-user.htm#TOC">&#187;</a><a name="u3func">userprintf.c
and userprintf_rbox,c functions</a></h3>
<ul>
<li><a href="userprintf.c#qh_fprintf">qh_fprintf</a> print
information from Qhull, sames as fprintf(). </li>
<li><a href="userprintf_rbox.c#qh_fprintf_rbox">qh_fprintf_rbox</a> print
information from Rbox, sames as fprintf(). </li>
</ul>
<p><!-- Navigation links --> </p>
<hr>
<p><b>Up:</b>
<a href="http://www.qhull.org">Home page for
Qhull</a> <br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual: Table of Contents</a> <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
<b>To:</b> <a href="index.htm">Qhull functions</a>, macros, and data structures<br>
<b>To:</b> <a href="qh-geom.htm">Geom</a> &#149;
<a href="qh-globa.htm">Global</a> &#149; <a href="qh-io.htm">Io</a>
&#149; <a href="qh-mem.htm">Mem</a> &#149; <a href="qh-merge.htm">Merge</a>
&#149; <a href="qh-poly.htm">Poly</a> &#149; <a href="qh-qhull.htm#TOC">Qhull</a>
&#149; <a href="qh-set.htm">Set</a> &#149; <a href="qh-stat.htm">Stat</a>
&#149; <a href="qh-user.htm">User</a><br>
</p>
<p><!-- GC common information --> </p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img
src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
Geometry Center Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

View File

@ -0,0 +1,417 @@
; qhull-exports.def -- msvc module-definition file
;
; Generated from depends.exe by cut-and-paste of exported symbols by mingw gcc
; [mar'11] 399 symbols
; Annotate as DATA qh_last_random qh_qh qh_qhstat qhmem rbox rbox_inuse
; Annotate as __declspec for outside access in win32 -- qh_qh qh_qhstat
; Same as ../libqhullp/qhull_p-exports.def without qh_save_qhull and qh_restore_qhull
;
; $Id: //main/2015/qhull/src/libqhull/qhull-exports.def#3 $$Change: 2047 $
; $DateTime: 2016/01/04 22:03:18 $$Author: bbarber $
;
; Define qhull_VERSION in CMakeLists.txt, Makefile, qhull-exports.def, qhull_p-exports.def, qhull_r-exports.def, and qhull-warn.pri
VERSION 7.0
EXPORTS
qh_addhash
qh_addpoint
qh_all_merges
qh_allstatA
qh_allstatB
qh_allstatC
qh_allstatD
qh_allstatE
qh_allstatE2
qh_allstatF
qh_allstatG
qh_allstatH
qh_allstatI
qh_allstatistics
qh_appendfacet
qh_appendmergeset
qh_appendprint
qh_appendvertex
qh_argv_to_command
qh_argv_to_command_size
qh_attachnewfacets
qh_backnormal
qh_basevertices
qh_build_withrestart
qh_buildhull
qh_buildtracing
qh_check_bestdist
qh_check_dupridge
qh_check_maxout
qh_check_output
qh_check_point
qh_check_points
qh_checkconnect
qh_checkconvex
qh_checkfacet
qh_checkflags
qh_checkflipped
qh_checkflipped_all
qh_checkpolygon
qh_checkvertex
qh_checkzero
qh_clear_outputflags
qh_clearcenters
qh_clock
qh_collectstatistics
qh_compare_facetarea
qh_compare_facetmerge
qh_compare_facetvisit
qh_compare_vertexpoint
qh_compareangle
qh_comparemerge
qh_comparevisit
qh_copyfilename
qh_copynonconvex
qh_copypoints
qh_countfacets
qh_createsimplex
qh_crossproduct
qh_degen_redundant_facet
qh_degen_redundant_neighbors
qh_deletevisible
qh_delfacet
qh_delridge
qh_delvertex
qh_determinant
qh_detjoggle
qh_detroundoff
qh_detsimplex
qh_detvnorm
qh_detvridge
qh_detvridge3
qh_dfacet
qh_distnorm
qh_distplane
qh_distround
qh_divzero
qh_dvertex
qh_eachvoronoi
qh_eachvoronoi_all
qh_errexit
qh_errexit2
qh_errexit_rbox
qh_errprint
qh_exit
qh_facet2point
qh_facet3vertex
qh_facetarea
qh_facetarea_simplex
qh_facetcenter
qh_facetintersect
qh_facetvertices
qh_find_newvertex
qh_findbest
qh_findbest_test
qh_findbestfacet
qh_findbesthorizon
qh_findbestlower
qh_findbestneighbor
qh_findbestnew
qh_findfacet_all
qh_findgood
qh_findgood_all
qh_findgooddist
qh_findhorizon
qh_flippedmerges
qh_forcedmerges
qh_fprintf
qh_fprintf_rbox
qh_fprintf_stderr
qh_free
qh_freebuffers
qh_freebuild
qh_freeqhull
qh_freeqhull2
qh_freestatistics
qh_furthestnext
qh_furthestout
qh_gausselim
qh_geomplanes
qh_getangle
qh_getarea
qh_getcenter
qh_getcentrum
qh_getdistance
qh_gethash
qh_getmergeset
qh_getmergeset_initial
qh_gram_schmidt
qh_hashridge
qh_hashridge_find
qh_infiniteloop
qh_init_A
qh_init_B
qh_init_qhull_command
qh_initbuild
qh_initflags
qh_initialhull
qh_initialvertices
qh_initqhull_buffers
qh_initqhull_globals
qh_initqhull_mem
qh_initqhull_outputflags
qh_initqhull_start
qh_initqhull_start2
qh_initstatistics
qh_initthresholds
qh_inthresholds
qh_isvertex
qh_joggleinput
; Mark as DATA, otherwise links a separate qh_last_random. No __declspec.
qh_last_random DATA
qh_lib_check
qh_makenew_nonsimplicial
qh_makenew_simplicial
qh_makenewfacet
qh_makenewfacets
qh_makenewplanes
qh_makeridges
qh_malloc
qh_mark_dupridges
qh_markkeep
qh_markvoronoi
qh_matchduplicates
qh_matchneighbor
qh_matchnewfacets
qh_matchvertices
qh_maxabsval
qh_maxmin
qh_maxouter
qh_maxsimplex
qh_maydropneighbor
qh_memalloc
qh_memfree
qh_memfreeshort
qh_meminit
qh_meminitbuffers
qh_memsetup
qh_memsize
qh_memstatistics
qh_memtotal
qh_merge_degenredundant
qh_merge_nonconvex
qh_mergecycle
qh_mergecycle_all
qh_mergecycle_facets
qh_mergecycle_neighbors
qh_mergecycle_ridges
qh_mergecycle_vneighbors
qh_mergefacet
qh_mergefacet2d
qh_mergeneighbors
qh_mergeridges
qh_mergesimplex
qh_mergevertex_del
qh_mergevertex_neighbors
qh_mergevertices
qh_minabsval
qh_mindiff
qh_nearcoplanar
qh_nearvertex
qh_neighbor_intersections
qh_new_qhull
qh_newfacet
qh_newhashtable
qh_newridge
qh_newstats
qh_newvertex
qh_newvertices
qh_nextfurthest
qh_nextridge3d
qh_normalize
qh_normalize2
qh_nostatistic
qh_option
qh_order_vertexneighbors
qh_orientoutside
qh_out1
qh_out2n
qh_out3n
qh_outcoplanar
qh_outerinner
qh_partitionall
qh_partitioncoplanar
qh_partitionpoint
qh_partitionvisible
qh_point
qh_point_add
qh_pointdist
qh_pointfacet
qh_pointid
qh_pointvertex
qh_postmerge
qh_precision
qh_premerge
qh_prepare_output
qh_prependfacet
qh_printafacet
qh_printallstatistics
qh_printbegin
qh_printcenter
qh_printcentrum
qh_printend
qh_printend4geom
qh_printextremes
qh_printextremes_2d
qh_printextremes_d
qh_printfacet
qh_printfacet2geom
qh_printfacet2geom_points
qh_printfacet2math
qh_printfacet3geom_nonsimplicial
qh_printfacet3geom_points
qh_printfacet3geom_simplicial
qh_printfacet3math
qh_printfacet3vertex
qh_printfacet4geom_nonsimplicial
qh_printfacet4geom_simplicial
qh_printfacetNvertex_nonsimplicial
qh_printfacetNvertex_simplicial
qh_printfacetheader
qh_printfacetlist
qh_printfacetridges
qh_printfacets
qh_printhashtable
qh_printhelp_degenerate
qh_printhelp_narrowhull
qh_printhelp_singular
qh_printhyperplaneintersection
qh_printline3geom
qh_printlists
qh_printmatrix
qh_printneighborhood
qh_printpoint
qh_printpoint3
qh_printpointid
qh_printpoints
qh_printpoints_out
qh_printpointvect
qh_printpointvect2
qh_printridge
qh_printspheres
qh_printstatistics
qh_printstatlevel
qh_printstats
qh_printsummary
qh_printvdiagram
qh_printvdiagram2
qh_printvertex
qh_printvertexlist
qh_printvertices
qh_printvneighbors
qh_printvnorm
qh_printvoronoi
qh_printvridge
qh_produce_output
qh_produce_output2
qh_projectdim3
qh_projectinput
qh_projectpoint
qh_projectpoints
; Mark as DATA, otherwise links a separate qh_qh. qh_qh and qh_qhstat requires __declspec
qh_qh DATA
qh_qhstat DATA
qh_qhull
qh_rand
qh_randomfactor
qh_randommatrix
qh_rboxpoints
qh_readfeasible
qh_readpoints
qh_reducevertices
qh_redundant_vertex
qh_remove_extravertices
qh_removefacet
qh_removevertex
qh_rename_sharedvertex
qh_renameridgevertex
qh_renamevertex
qh_resetlists
qh_rotateinput
qh_rotatepoints
qh_roundi
qh_scaleinput
qh_scalelast
qh_scalepoints
qh_setaddnth
qh_setaddsorted
qh_setappend
qh_setappend2ndlast
qh_setappend_set
qh_setcheck
qh_setcompact
qh_setcopy
qh_setdel
qh_setdelaunay
qh_setdellast
qh_setdelnth
qh_setdelnthsorted
qh_setdelsorted
qh_setduplicate
qh_setequal
qh_setequal_except
qh_setequal_skip
qh_setfacetplane
qh_setfeasible
qh_setfree
qh_setfree2
qh_setfreelong
qh_sethalfspace
qh_sethalfspace_all
qh_sethyperplane_det
qh_sethyperplane_gauss
qh_setin
qh_setindex
qh_setlarger
qh_setlast
qh_setnew
qh_setnew_delnthsorted
qh_setprint
qh_setreplace
qh_setsize
qh_settemp
qh_settempfree
qh_settempfree_all
qh_settemppop
qh_settemppush
qh_settruncate
qh_setunique
qh_setvoronoi_all
qh_setzero
qh_sharpnewfacets
qh_skipfacet
qh_skipfilename
qh_srand
qh_stddev
qh_strtod
qh_strtol
qh_test_appendmerge
qh_test_vneighbors
qh_tracemerge
qh_tracemerging
qh_triangulate
qh_triangulate_facet
qh_triangulate_link
qh_triangulate_mirror
qh_triangulate_null
qh_updatetested
qh_updatevertices
qh_user_memsizes
qh_version
qh_version2
qh_vertexintersect
qh_vertexintersect_new
qh_vertexneighbors
qh_vertexridges
qh_vertexridges_facet
qh_vertexsubset
qh_voronoi_center
qh_willdelete
; Mark as DATA, otherwise links a separate qhmem. No __declspec
qhmem DATA
rbox DATA
rbox_inuse DATA

View File

@ -0,0 +1,150 @@
/*<html><pre> -<a href="qh-qhull.htm"
>-------------------------------</a><a name="TOP">-</a>
qhull_a.h
all header files for compiling qhull with non-reentrant code
included before C++ headers for user_r.h:QHULL_CRTDBG
see qh-qhull.htm
see libqhull.h for user-level definitions
see user.h for user-definable constants
defines internal functions for libqhull.c global.c
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull/qhull_a.h#4 $$Change: 2064 $
$DateTime: 2016/01/18 12:36:08 $$Author: bbarber $
Notes: grep for ((" and (" to catch fprintf("lkasdjf");
full parens around (x?y:z)
use '#include "libqhull/qhull_a.h"' to avoid name clashes
*/
#ifndef qhDEFqhulla
#define qhDEFqhulla 1
#include "libqhull.h" /* Includes user_r.h and data types */
#include "stat.h"
#include "random.h"
#include "mem.h"
#include "qset.h"
#include "geom.h"
#include "merge.h"
#include "poly.h"
#include "io.h"
#include <setjmp.h>
#include <string.h>
#include <math.h>
#include <float.h> /* some compilers will not need float.h */
#include <limits.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
/*** uncomment here and qset.c
if string.h does not define memcpy()
#include <memory.h>
*/
#if qh_CLOCKtype == 2 /* defined in user.h from libqhull.h */
#include <sys/types.h>
#include <sys/times.h>
#include <unistd.h>
#endif
#ifdef _MSC_VER /* Microsoft Visual C++ -- warning level 4 */
#pragma warning( disable : 4100) /* unreferenced formal parameter */
#pragma warning( disable : 4127) /* conditional expression is constant */
#pragma warning( disable : 4706) /* assignment within conditional function */
#pragma warning( disable : 4996) /* function was declared deprecated(strcpy, localtime, etc.) */
#endif
/* ======= -macros- =========== */
/*-<a href="qh-qhull.htm#TOC"
>--------------------------------</a><a name="traceN">-</a>
traceN((qh ferr, 0Nnnn, "format\n", vars));
calls qh_fprintf if qh.IStracing >= N
Add debugging traps to the end of qh_fprintf
notes:
removing tracing reduces code size but doesn't change execution speed
*/
#ifndef qh_NOtrace
#define trace0(args) {if (qh IStracing) qh_fprintf args;}
#define trace1(args) {if (qh IStracing >= 1) qh_fprintf args;}
#define trace2(args) {if (qh IStracing >= 2) qh_fprintf args;}
#define trace3(args) {if (qh IStracing >= 3) qh_fprintf args;}
#define trace4(args) {if (qh IStracing >= 4) qh_fprintf args;}
#define trace5(args) {if (qh IStracing >= 5) qh_fprintf args;}
#else /* qh_NOtrace */
#define trace0(args) {}
#define trace1(args) {}
#define trace2(args) {}
#define trace3(args) {}
#define trace4(args) {}
#define trace5(args) {}
#endif /* qh_NOtrace */
/*-<a href="qh-qhull.htm#TOC"
>--------------------------------</a><a name="QHULL_UNUSED">-</a>
Define an unused variable to avoid compiler warnings
Derived from Qt's corelib/global/qglobal.h
*/
#if defined(__cplusplus) && defined(__INTEL_COMPILER) && !defined(QHULL_OS_WIN)
template <typename T>
inline void qhullUnused(T &x) { (void)x; }
# define QHULL_UNUSED(x) qhullUnused(x);
#else
# define QHULL_UNUSED(x) (void)x;
#endif
/***** -libqhull.c prototypes (alphabetical after qhull) ********************/
void qh_qhull(void);
boolT qh_addpoint(pointT *furthest, facetT *facet, boolT checkdist);
void qh_buildhull(void);
void qh_buildtracing(pointT *furthest, facetT *facet);
void qh_build_withrestart(void);
void qh_errexit2(int exitcode, facetT *facet, facetT *otherfacet);
void qh_findhorizon(pointT *point, facetT *facet, int *goodvisible,int *goodhorizon);
pointT *qh_nextfurthest(facetT **visible);
void qh_partitionall(setT *vertices, pointT *points,int npoints);
void qh_partitioncoplanar(pointT *point, facetT *facet, realT *dist);
void qh_partitionpoint(pointT *point, facetT *facet);
void qh_partitionvisible(boolT allpoints, int *numpoints);
void qh_precision(const char *reason);
void qh_printsummary(FILE *fp);
/***** -global.c internal prototypes (alphabetical) ***********************/
void qh_appendprint(qh_PRINT format);
void qh_freebuild(boolT allmem);
void qh_freebuffers(void);
void qh_initbuffers(coordT *points, int numpoints, int dim, boolT ismalloc);
/***** -stat.c internal prototypes (alphabetical) ***********************/
void qh_allstatA(void);
void qh_allstatB(void);
void qh_allstatC(void);
void qh_allstatD(void);
void qh_allstatE(void);
void qh_allstatE2(void);
void qh_allstatF(void);
void qh_allstatG(void);
void qh_allstatH(void);
void qh_freebuffers(void);
void qh_initbuffers(coordT *points, int numpoints, int dim, boolT ismalloc);
#endif /* qhDEFqhulla */

View File

@ -0,0 +1,418 @@
; qhull_p-exports.def -- msvc module-definition file
;
; Generated from depends.exe by cut-and-paste of exported symbols by mingw gcc
; [mar'11] 399 symbols [jan'15] added 3 symbols
; Annotate as DATA qh_last_random qh_qh qh_qhstat qhmem rbox rbox_inuse
; Annotate as __declspec for outside access in win32 -- qh_qh qh_qhstat
;
; $Id: //main/2011/qhull/src/libqhull/qhull-exports.def#2 $$Change: 1368 $
; $DateTime: 2011/04/16 08:12:32 $$Author: bbarber $
;
; Define qhull_VERSION in CMakeLists.txt, Makefile, qhull-exports.def, qhull_p-exports.def, qhull_r-exports.def, and qhull-warn.pri
VERSION 7.0
EXPORTS
qh_addhash
qh_addpoint
qh_all_merges
qh_allstatA
qh_allstatB
qh_allstatC
qh_allstatD
qh_allstatE
qh_allstatE2
qh_allstatF
qh_allstatG
qh_allstatH
qh_allstatI
qh_allstatistics
qh_appendfacet
qh_appendmergeset
qh_appendprint
qh_appendvertex
qh_argv_to_command
qh_argv_to_command_size
qh_attachnewfacets
qh_backnormal
qh_basevertices
qh_build_withrestart
qh_buildhull
qh_buildtracing
qh_check_bestdist
qh_check_dupridge
qh_check_maxout
qh_check_output
qh_check_point
qh_check_points
qh_checkconnect
qh_checkconvex
qh_checkfacet
qh_checkflags
qh_checkflipped
qh_checkflipped_all
qh_checkpolygon
qh_checkvertex
qh_checkzero
qh_clear_outputflags
qh_clearcenters
qh_clock
qh_collectstatistics
qh_compare_facetarea
qh_compare_facetmerge
qh_compare_facetvisit
qh_compare_vertexpoint
qh_compareangle
qh_comparemerge
qh_comparevisit
qh_copyfilename
qh_copynonconvex
qh_copypoints
qh_countfacets
qh_createsimplex
qh_crossproduct
qh_degen_redundant_facet
qh_degen_redundant_neighbors
qh_deletevisible
qh_delfacet
qh_delridge
qh_delvertex
qh_determinant
qh_detjoggle
qh_detroundoff
qh_detsimplex
qh_detvnorm
qh_detvridge
qh_detvridge3
qh_dfacet
qh_distnorm
qh_distplane
qh_distround
qh_divzero
qh_dvertex
qh_eachvoronoi
qh_eachvoronoi_all
qh_errexit
qh_errexit2
qh_errexit_rbox
qh_errprint
qh_exit
qh_facet2point
qh_facet3vertex
qh_facetarea
qh_facetarea_simplex
qh_facetcenter
qh_facetintersect
qh_facetvertices
qh_find_newvertex
qh_findbest
qh_findbest_test
qh_findbestfacet
qh_findbesthorizon
qh_findbestlower
qh_findbestneighbor
qh_findbestnew
qh_findfacet_all
qh_findgood
qh_findgood_all
qh_findgooddist
qh_findhorizon
qh_flippedmerges
qh_forcedmerges
qh_fprintf
qh_fprintf_rbox
qh_fprintf_stderr
qh_free
qh_freebuffers
qh_freebuild
qh_freeqhull
qh_freeqhull2
qh_freestatistics
qh_furthestnext
qh_furthestout
qh_gausselim
qh_geomplanes
qh_getangle
qh_getarea
qh_getcenter
qh_getcentrum
qh_getdistance
qh_gethash
qh_getmergeset
qh_getmergeset_initial
qh_gram_schmidt
qh_hashridge
qh_hashridge_find
qh_infiniteloop
qh_init_A
qh_init_B
qh_init_qhull_command
qh_initbuild
qh_initflags
qh_initialhull
qh_initialvertices
qh_initqhull_buffers
qh_initqhull_globals
qh_initqhull_mem
qh_initqhull_outputflags
qh_initqhull_start
qh_initqhull_start2
qh_initstatistics
qh_initthresholds
qh_inthresholds
qh_isvertex
qh_joggleinput
; Mark as DATA, otherwise links a separate qh_last_random. No __declspec.
qh_last_random DATA
qh_lib_check
qh_makenew_nonsimplicial
qh_makenew_simplicial
qh_makenewfacet
qh_makenewfacets
qh_makenewplanes
qh_makeridges
qh_malloc
qh_mark_dupridges
qh_markkeep
qh_markvoronoi
qh_matchduplicates
qh_matchneighbor
qh_matchnewfacets
qh_matchvertices
qh_maxabsval
qh_maxmin
qh_maxouter
qh_maxsimplex
qh_maydropneighbor
qh_memalloc
qh_memfree
qh_memfreeshort
qh_meminit
qh_meminitbuffers
qh_memsetup
qh_memsize
qh_memstatistics
qh_memtotal
qh_merge_degenredundant
qh_merge_nonconvex
qh_mergecycle
qh_mergecycle_all
qh_mergecycle_facets
qh_mergecycle_neighbors
qh_mergecycle_ridges
qh_mergecycle_vneighbors
qh_mergefacet
qh_mergefacet2d
qh_mergeneighbors
qh_mergeridges
qh_mergesimplex
qh_mergevertex_del
qh_mergevertex_neighbors
qh_mergevertices
qh_minabsval
qh_mindiff
qh_nearcoplanar
qh_nearvertex
qh_neighbor_intersections
qh_new_qhull
qh_newfacet
qh_newhashtable
qh_newridge
qh_newstats
qh_newvertex
qh_newvertices
qh_nextfurthest
qh_nextridge3d
qh_normalize
qh_normalize2
qh_nostatistic
qh_option
qh_order_vertexneighbors
qh_orientoutside
qh_out1
qh_out2n
qh_out3n
qh_outcoplanar
qh_outerinner
qh_partitionall
qh_partitioncoplanar
qh_partitionpoint
qh_partitionvisible
qh_point
qh_point_add
qh_pointdist
qh_pointfacet
qh_pointid
qh_pointvertex
qh_postmerge
qh_precision
qh_premerge
qh_prepare_output
qh_prependfacet
qh_printafacet
qh_printallstatistics
qh_printbegin
qh_printcenter
qh_printcentrum
qh_printend
qh_printend4geom
qh_printextremes
qh_printextremes_2d
qh_printextremes_d
qh_printfacet
qh_printfacet2geom
qh_printfacet2geom_points
qh_printfacet2math
qh_printfacet3geom_nonsimplicial
qh_printfacet3geom_points
qh_printfacet3geom_simplicial
qh_printfacet3math
qh_printfacet3vertex
qh_printfacet4geom_nonsimplicial
qh_printfacet4geom_simplicial
qh_printfacetNvertex_nonsimplicial
qh_printfacetNvertex_simplicial
qh_printfacetheader
qh_printfacetlist
qh_printfacetridges
qh_printfacets
qh_printhashtable
qh_printhelp_degenerate
qh_printhelp_narrowhull
qh_printhelp_singular
qh_printhyperplaneintersection
qh_printline3geom
qh_printlists
qh_printmatrix
qh_printneighborhood
qh_printpoint
qh_printpoint3
qh_printpointid
qh_printpoints
qh_printpoints_out
qh_printpointvect
qh_printpointvect2
qh_printridge
qh_printspheres
qh_printstatistics
qh_printstatlevel
qh_printstats
qh_printsummary
qh_printvdiagram
qh_printvdiagram2
qh_printvertex
qh_printvertexlist
qh_printvertices
qh_printvneighbors
qh_printvnorm
qh_printvoronoi
qh_printvridge
qh_produce_output
qh_produce_output2
qh_projectdim3
qh_projectinput
qh_projectpoint
qh_projectpoints
; Mark as DATA, otherwise links a separate qh_qh. qh_qh and qh_qhstat requires __declspec
qh_qh DATA
qh_qhstat DATA
qh_qhull
qh_rand
qh_randomfactor
qh_randommatrix
qh_rboxpoints
qh_readfeasible
qh_readpoints
qh_reducevertices
qh_redundant_vertex
qh_remove_extravertices
qh_removefacet
qh_removevertex
qh_rename_sharedvertex
qh_renameridgevertex
qh_renamevertex
qh_resetlists
qh_restore_qhull
qh_rotateinput
qh_rotatepoints
qh_roundi
qh_save_qhull
qh_scaleinput
qh_scalelast
qh_scalepoints
qh_setaddnth
qh_setaddsorted
qh_setappend
qh_setappend2ndlast
qh_setappend_set
qh_setcheck
qh_setcompact
qh_setcopy
qh_setdel
qh_setdelaunay
qh_setdellast
qh_setdelnth
qh_setdelnthsorted
qh_setdelsorted
qh_setduplicate
qh_setequal
qh_setequal_except
qh_setequal_skip
qh_setfacetplane
qh_setfeasible
qh_setfree
qh_setfree2
qh_setfreelong
qh_sethalfspace
qh_sethalfspace_all
qh_sethyperplane_det
qh_sethyperplane_gauss
qh_setin
qh_setindex
qh_setlarger
qh_setlast
qh_setnew
qh_setnew_delnthsorted
qh_setprint
qh_setreplace
qh_setsize
qh_settemp
qh_settempfree
qh_settempfree_all
qh_settemppop
qh_settemppush
qh_settruncate
qh_setunique
qh_setvoronoi_all
qh_setzero
qh_sharpnewfacets
qh_skipfacet
qh_skipfilename
qh_srand
qh_stddev
qh_strtod
qh_strtol
qh_test_appendmerge
qh_test_vneighbors
qh_tracemerge
qh_tracemerging
qh_triangulate
qh_triangulate_facet
qh_triangulate_link
qh_triangulate_mirror
qh_triangulate_null
qh_updatetested
qh_updatevertices
qh_user_memsizes
qh_version
qh_version2
qh_vertexintersect
qh_vertexintersect_new
qh_vertexneighbors
qh_vertexridges
qh_vertexridges_facet
qh_vertexsubset
qh_voronoi_center
qh_willdelete
; Mark as DATA, otherwise links a separate qhmem. No __declspec
qhmem DATA
rbox DATA
rbox_inuse DATA

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,490 @@
/*<html><pre> -<a href="qh-set.htm"
>-------------------------------</a><a name="TOP">-</a>
qset.h
header file for qset.c that implements set
see qh-set.htm and qset.c
only uses mem.c, malloc/free
for error handling, writes message and calls
qh_errexit(qhmem_ERRqhull, NULL, NULL);
set operations satisfy the following properties:
- sets have a max size, the actual size (if different) is stored at the end
- every set is NULL terminated
- sets may be sorted or unsorted, the caller must distinguish this
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull/qset.h#2 $$Change: 2062 $
$DateTime: 2016/01/17 13:13:18 $$Author: bbarber $
*/
#ifndef qhDEFset
#define qhDEFset 1
#include <stdio.h>
/*================= -structures- ===============*/
#ifndef DEFsetT
#define DEFsetT 1
typedef struct setT setT; /* a set is a sorted or unsorted array of pointers */
#endif
/* [jan'15] Decided not to use countT. Most sets are small. The code uses signed tests */
/*-<a href="qh-set.htm#TOC"
>----------------------------------------</a><a name="setT">-</a>
setT
a set or list of pointers with maximum size and actual size.
variations:
unsorted, unique -- a list of unique pointers with NULL terminator
user guarantees uniqueness
sorted -- a sorted list of unique pointers with NULL terminator
qset.c guarantees uniqueness
unsorted -- a list of pointers terminated with NULL
indexed -- an array of pointers with NULL elements
structure for set of n elements:
--------------
| maxsize
--------------
| e[0] - a pointer, may be NULL for indexed sets
--------------
| e[1]
--------------
| ...
--------------
| e[n-1]
--------------
| e[n] = NULL
--------------
| ...
--------------
| e[maxsize] - n+1 or NULL (determines actual size of set)
--------------
*/
/*-- setelemT -- internal type to allow both pointers and indices
*/
typedef union setelemT setelemT;
union setelemT {
void *p;
int i; /* integer used for e[maxSize] */
};
struct setT {
int maxsize; /* maximum number of elements (except NULL) */
setelemT e[1]; /* array of pointers, tail is NULL */
/* last slot (unless NULL) is actual size+1
e[maxsize]==NULL or e[e[maxsize]-1]==NULL */
/* this may generate a warning since e[] contains
maxsize elements */
};
/*=========== -constants- =========================*/
/*-<a href="qh-set.htm#TOC"
>-----------------------------------</a><a name="SETelemsize">-</a>
SETelemsize
size of a set element in bytes
*/
#define SETelemsize ((int)sizeof(setelemT))
/*=========== -macros- =========================*/
/*-<a href="qh-set.htm#TOC"
>-----------------------------------</a><a name="FOREACHsetelement_">-</a>
FOREACHsetelement_(type, set, variable)
define FOREACH iterator
declare:
assumes *variable and **variablep are declared
no space in "variable)" [DEC Alpha cc compiler]
each iteration:
variable is set element
variablep is one beyond variable.
to repeat an element:
variablep--; / *repeat* /
at exit:
variable is NULL at end of loop
example:
#define FOREACHfacet_( facets ) FOREACHsetelement_( facetT, facets, facet )
notes:
use FOREACHsetelement_i_() if need index or include NULLs
WARNING:
nested loops can't use the same variable (define another FOREACH)
needs braces if nested inside another FOREACH
this includes intervening blocks, e.g. FOREACH...{ if () FOREACH...} )
*/
#define FOREACHsetelement_(type, set, variable) \
if (((variable= NULL), set)) for (\
variable##p= (type **)&((set)->e[0].p); \
(variable= *variable##p++);)
/*-<a href="qh-set.htm#TOC"
>----------------------------------------</a><a name="FOREACHsetelement_i_">-</a>
FOREACHsetelement_i_(type, set, variable)
define indexed FOREACH iterator
declare:
type *variable, variable_n, variable_i;
each iteration:
variable is set element, may be NULL
variable_i is index, variable_n is qh_setsize()
to repeat an element:
variable_i--; variable_n-- repeats for deleted element
at exit:
variable==NULL and variable_i==variable_n
example:
#define FOREACHfacet_i_( facets ) FOREACHsetelement_i_( facetT, facets, facet )
WARNING:
nested loops can't use the same variable (define another FOREACH)
needs braces if nested inside another FOREACH
this includes intervening blocks, e.g. FOREACH...{ if () FOREACH...} )
*/
#define FOREACHsetelement_i_(type, set, variable) \
if (((variable= NULL), set)) for (\
variable##_i= 0, variable= (type *)((set)->e[0].p), \
variable##_n= qh_setsize(set);\
variable##_i < variable##_n;\
variable= (type *)((set)->e[++variable##_i].p) )
/*-<a href="qh-set.htm#TOC"
>--------------------------------------</a><a name="FOREACHsetelementreverse_">-</a>
FOREACHsetelementreverse_(type, set, variable)-
define FOREACH iterator in reverse order
declare:
assumes *variable and **variablep are declared
also declare 'int variabletemp'
each iteration:
variable is set element
to repeat an element:
variabletemp++; / *repeat* /
at exit:
variable is NULL
example:
#define FOREACHvertexreverse_( vertices ) FOREACHsetelementreverse_( vertexT, vertices, vertex )
notes:
use FOREACHsetelementreverse12_() to reverse first two elements
WARNING: needs braces if nested inside another FOREACH
*/
#define FOREACHsetelementreverse_(type, set, variable) \
if (((variable= NULL), set)) for (\
variable##temp= qh_setsize(set)-1, variable= qh_setlast(set);\
variable; variable= \
((--variable##temp >= 0) ? SETelemt_(set, variable##temp, type) : NULL))
/*-<a href="qh-set.htm#TOC"
>-----------------------------------</a><a name="FOREACHsetelementreverse12_">-</a>
FOREACHsetelementreverse12_(type, set, variable)-
define FOREACH iterator with e[1] and e[0] reversed
declare:
assumes *variable and **variablep are declared
each iteration:
variable is set element
variablep is one after variable.
to repeat an element:
variablep--; / *repeat* /
at exit:
variable is NULL at end of loop
example
#define FOREACHvertexreverse12_( vertices ) FOREACHsetelementreverse12_( vertexT, vertices, vertex )
notes:
WARNING: needs braces if nested inside another FOREACH
*/
#define FOREACHsetelementreverse12_(type, set, variable) \
if (((variable= NULL), set)) for (\
variable##p= (type **)&((set)->e[1].p); \
(variable= *variable##p); \
variable##p == ((type **)&((set)->e[0].p))?variable##p += 2: \
(variable##p == ((type **)&((set)->e[1].p))?variable##p--:variable##p++))
/*-<a href="qh-set.htm#TOC"
>-----------------------------------</a><a name="FOREACHelem_">-</a>
FOREACHelem_( set )-
iterate elements in a set
declare:
void *elem, *elemp;
each iteration:
elem is set element
elemp is one beyond
to repeat an element:
elemp--; / *repeat* /
at exit:
elem == NULL at end of loop
example:
FOREACHelem_(set) {
notes:
WARNING: needs braces if nested inside another FOREACH
*/
#define FOREACHelem_(set) FOREACHsetelement_(void, set, elem)
/*-<a href="qh-set.htm#TOC"
>-----------------------------------</a><a name="FOREACHset_">-</a>
FOREACHset_( set )-
iterate a set of sets
declare:
setT *set, **setp;
each iteration:
set is set element
setp is one beyond
to repeat an element:
setp--; / *repeat* /
at exit:
set == NULL at end of loop
example
FOREACHset_(sets) {
notes:
WARNING: needs braces if nested inside another FOREACH
*/
#define FOREACHset_(sets) FOREACHsetelement_(setT, sets, set)
/*-<a href="qh-set.htm#TOC"
>-----------------------------------------</a><a name="SETindex_">-</a>
SETindex_( set, elem )
return index of elem in set
notes:
for use with FOREACH iteration
WARN64 -- Maximum set size is 2G
example:
i= SETindex_(ridges, ridge)
*/
#define SETindex_(set, elem) ((int)((void **)elem##p - (void **)&(set)->e[1].p))
/*-<a href="qh-set.htm#TOC"
>---------------------------------------</a><a name="SETref_">-</a>
SETref_( elem )
l.h.s. for modifying the current element in a FOREACH iteration
example:
SETref_(ridge)= anotherridge;
*/
#define SETref_(elem) (elem##p[-1])
/*-<a href="qh-set.htm#TOC"
>---------------------------------------</a><a name="SETelem_">-</a>
SETelem_(set, n)
return the n'th element of set
notes:
assumes that n is valid [0..size] and that set is defined
use SETelemt_() for type cast
*/
#define SETelem_(set, n) ((set)->e[n].p)
/*-<a href="qh-set.htm#TOC"
>---------------------------------------</a><a name="SETelemt_">-</a>
SETelemt_(set, n, type)
return the n'th element of set as a type
notes:
assumes that n is valid [0..size] and that set is defined
*/
#define SETelemt_(set, n, type) ((type*)((set)->e[n].p))
/*-<a href="qh-set.htm#TOC"
>---------------------------------------</a><a name="SETelemaddr_">-</a>
SETelemaddr_(set, n, type)
return address of the n'th element of a set
notes:
assumes that n is valid [0..size] and set is defined
*/
#define SETelemaddr_(set, n, type) ((type **)(&((set)->e[n].p)))
/*-<a href="qh-set.htm#TOC"
>---------------------------------------</a><a name="SETfirst_">-</a>
SETfirst_(set)
return first element of set
*/
#define SETfirst_(set) ((set)->e[0].p)
/*-<a href="qh-set.htm#TOC"
>---------------------------------------</a><a name="SETfirstt_">-</a>
SETfirstt_(set, type)
return first element of set as a type
*/
#define SETfirstt_(set, type) ((type*)((set)->e[0].p))
/*-<a href="qh-set.htm#TOC"
>---------------------------------------</a><a name="SETsecond_">-</a>
SETsecond_(set)
return second element of set
*/
#define SETsecond_(set) ((set)->e[1].p)
/*-<a href="qh-set.htm#TOC"
>---------------------------------------</a><a name="SETsecondt_">-</a>
SETsecondt_(set, type)
return second element of set as a type
*/
#define SETsecondt_(set, type) ((type*)((set)->e[1].p))
/*-<a href="qh-set.htm#TOC"
>---------------------------------------</a><a name="SETaddr_">-</a>
SETaddr_(set, type)
return address of set's elements
*/
#define SETaddr_(set,type) ((type **)(&((set)->e[0].p)))
/*-<a href="qh-set.htm#TOC"
>---------------------------------------</a><a name="SETreturnsize_">-</a>
SETreturnsize_(set, size)
return size of a set
notes:
set must be defined
use qh_setsize(set) unless speed is critical
*/
#define SETreturnsize_(set, size) (((size)= ((set)->e[(set)->maxsize].i))?(--(size)):((size)= (set)->maxsize))
/*-<a href="qh-set.htm#TOC"
>---------------------------------------</a><a name="SETempty_">-</a>
SETempty_(set)
return true(1) if set is empty
notes:
set may be NULL
*/
#define SETempty_(set) (!set || (SETfirst_(set) ? 0 : 1))
/*-<a href="qh-set.htm#TOC"
>-------------------------------<a name="SETsizeaddr_">-</a>
SETsizeaddr_(set)
return pointer to 'actual size+1' of set (set CANNOT be NULL!!)
Its type is setelemT* for strict aliasing
All SETelemaddr_ must be cast to setelemT
notes:
*SETsizeaddr==NULL or e[*SETsizeaddr-1].p==NULL
*/
#define SETsizeaddr_(set) (&((set)->e[(set)->maxsize]))
/*-<a href="qh-set.htm#TOC"
>---------------------------------------</a><a name="SETtruncate_">-</a>
SETtruncate_(set, size)
truncate set to size
see:
qh_settruncate()
*/
#define SETtruncate_(set, size) {set->e[set->maxsize].i= size+1; /* maybe overwritten */ \
set->e[size].p= NULL;}
/*======= prototypes in alphabetical order ============*/
void qh_setaddsorted(setT **setp, void *elem);
void qh_setaddnth(setT **setp, int nth, void *newelem);
void qh_setappend(setT **setp, void *elem);
void qh_setappend_set(setT **setp, setT *setA);
void qh_setappend2ndlast(setT **setp, void *elem);
void qh_setcheck(setT *set, const char *tname, unsigned id);
void qh_setcompact(setT *set);
setT *qh_setcopy(setT *set, int extra);
void *qh_setdel(setT *set, void *elem);
void *qh_setdellast(setT *set);
void *qh_setdelnth(setT *set, int nth);
void *qh_setdelnthsorted(setT *set, int nth);
void *qh_setdelsorted(setT *set, void *newelem);
setT *qh_setduplicate( setT *set, int elemsize);
void **qh_setendpointer(setT *set);
int qh_setequal(setT *setA, setT *setB);
int qh_setequal_except(setT *setA, void *skipelemA, setT *setB, void *skipelemB);
int qh_setequal_skip(setT *setA, int skipA, setT *setB, int skipB);
void qh_setfree(setT **set);
void qh_setfree2( setT **setp, int elemsize);
void qh_setfreelong(setT **set);
int qh_setin(setT *set, void *setelem);
int qh_setindex(setT *set, void *setelem);
void qh_setlarger(setT **setp);
void *qh_setlast(setT *set);
setT *qh_setnew(int size);
setT *qh_setnew_delnthsorted(setT *set, int size, int nth, int prepend);
void qh_setprint(FILE *fp, const char* string, setT *set);
void qh_setreplace(setT *set, void *oldelem, void *newelem);
int qh_setsize(setT *set);
setT *qh_settemp(int setsize);
void qh_settempfree(setT **set);
void qh_settempfree_all(void);
setT *qh_settemppop(void);
void qh_settemppush(setT *set);
void qh_settruncate(setT *set, int size);
int qh_setunique(setT **set, void *elem);
void qh_setzero(setT *set, int idx, int size);
#endif /* qhDEFset */

View File

@ -0,0 +1,245 @@
/*<html><pre> -<a href="index.htm#TOC"
>-------------------------------</a><a name="TOP">-</a>
random.c and utilities
Park & Miller's minimimal standard random number generator
argc/argv conversion
Used by rbox. Do not use 'qh'
*/
#include "libqhull.h"
#include "random.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef _MSC_VER /* Microsoft Visual C++ -- warning level 4 */
#pragma warning( disable : 4706) /* assignment within conditional function */
#pragma warning( disable : 4996) /* function was declared deprecated(strcpy, localtime, etc.) */
#endif
/*-<a href="qh-globa.htm#TOC"
>-------------------------------</a><a name="argv_to_command">-</a>
qh_argv_to_command( argc, argv, command, max_size )
build command from argc/argv
max_size is at least
returns:
a space-delimited string of options (just as typed)
returns false if max_size is too short
notes:
silently removes
makes option string easy to input and output
matches qh_argv_to_command_size()
argc may be 0
*/
int qh_argv_to_command(int argc, char *argv[], char* command, int max_size) {
int i, remaining;
char *s;
*command= '\0'; /* max_size > 0 */
if (argc) {
if ((s= strrchr( argv[0], '\\')) /* get filename w/o .exe extension */
|| (s= strrchr( argv[0], '/')))
s++;
else
s= argv[0];
if ((int)strlen(s) < max_size) /* WARN64 */
strcpy(command, s);
else
goto error_argv;
if ((s= strstr(command, ".EXE"))
|| (s= strstr(command, ".exe")))
*s= '\0';
}
for (i=1; i < argc; i++) {
s= argv[i];
remaining= max_size - (int)strlen(command) - (int)strlen(s) - 2; /* WARN64 */
if (!*s || strchr(s, ' ')) {
char *t= command + strlen(command);
remaining -= 2;
if (remaining < 0) {
goto error_argv;
}
*t++= ' ';
*t++= '"';
while (*s) {
if (*s == '"') {
if (--remaining < 0)
goto error_argv;
*t++= '\\';
}
*t++= *s++;
}
*t++= '"';
*t= '\0';
}else if (remaining < 0) {
goto error_argv;
}else
strcat(command, " ");
strcat(command, s);
}
return 1;
error_argv:
return 0;
} /* argv_to_command */
/*-<a href="qh-globa.htm#TOC"
>-------------------------------</a><a name="argv_to_command_size">-</a>
qh_argv_to_command_size( argc, argv )
return size to allocate for qh_argv_to_command()
notes:
argc may be 0
actual size is usually shorter
*/
int qh_argv_to_command_size(int argc, char *argv[]) {
unsigned int count= 1; /* null-terminator if argc==0 */
int i;
char *s;
for (i=0; i<argc; i++){
count += (int)strlen(argv[i]) + 1; /* WARN64 */
if (i>0 && strchr(argv[i], ' ')) {
count += 2; /* quote delimiters */
for (s=argv[i]; *s; s++) {
if (*s == '"') {
count++;
}
}
}
}
return count;
} /* argv_to_command_size */
/*-<a href="qh-geom.htm#TOC"
>-------------------------------</a><a name="rand">-</a>
qh_rand()
qh_srand( seed )
generate pseudo-random number between 1 and 2^31 -2
notes:
For qhull and rbox, called from qh_RANDOMint(),etc. [user.h]
From Park & Miller's minimal standard random number generator
Communications of the ACM, 31:1192-1201, 1988.
Does not use 0 or 2^31 -1
this is silently enforced by qh_srand()
Can make 'Rn' much faster by moving qh_rand to qh_distplane
*/
/* Global variables and constants */
int qh_last_random= 1; /* define as global variable instead of using qh */
#define qh_rand_a 16807
#define qh_rand_m 2147483647
#define qh_rand_q 127773 /* m div a */
#define qh_rand_r 2836 /* m mod a */
int qh_rand( void) {
int lo, hi, test;
int seed = qh_last_random;
hi = seed / qh_rand_q; /* seed div q */
lo = seed % qh_rand_q; /* seed mod q */
test = qh_rand_a * lo - qh_rand_r * hi;
if (test > 0)
seed= test;
else
seed= test + qh_rand_m;
qh_last_random= seed;
/* seed = seed < qh_RANDOMmax/2 ? 0 : qh_RANDOMmax; for testing */
/* seed = qh_RANDOMmax; for testing */
return seed;
} /* rand */
void qh_srand( int seed) {
if (seed < 1)
qh_last_random= 1;
else if (seed >= qh_rand_m)
qh_last_random= qh_rand_m - 1;
else
qh_last_random= seed;
} /* qh_srand */
/*-<a href="qh-geom.htm#TOC"
>-------------------------------</a><a name="randomfactor">-</a>
qh_randomfactor( scale, offset )
return a random factor r * scale + offset
notes:
qh.RANDOMa/b are defined in global.c
*/
realT qh_randomfactor(realT scale, realT offset) {
realT randr;
randr= qh_RANDOMint;
return randr * scale + offset;
} /* randomfactor */
/*-<a href="qh-geom.htm#TOC"
>-------------------------------</a><a name="randommatrix">-</a>
qh_randommatrix( buffer, dim, rows )
generate a random dim X dim matrix in range [-1,1]
assumes buffer is [dim+1, dim]
returns:
sets buffer to random numbers
sets rows to rows of buffer
sets row[dim] as scratch row
*/
void qh_randommatrix(realT *buffer, int dim, realT **rows) {
int i, k;
realT **rowi, *coord, realr;
coord= buffer;
rowi= rows;
for (i=0; i < dim; i++) {
*(rowi++)= coord;
for (k=0; k < dim; k++) {
realr= qh_RANDOMint;
*(coord++)= 2.0 * realr/(qh_RANDOMmax+1) - 1.0;
}
}
*rowi= coord;
} /* randommatrix */
/*-<a href="qh-globa.htm#TOC"
>-------------------------------</a><a name="strtol">-</a>
qh_strtol( s, endp) qh_strtod( s, endp)
internal versions of strtol() and strtod()
does not skip trailing spaces
notes:
some implementations of strtol()/strtod() skip trailing spaces
*/
double qh_strtod(const char *s, char **endp) {
double result;
result= strtod(s, endp);
if (s < (*endp) && (*endp)[-1] == ' ')
(*endp)--;
return result;
} /* strtod */
int qh_strtol(const char *s, char **endp) {
int result;
result= (int) strtol(s, endp, 10); /* WARN64 */
if (s< (*endp) && (*endp)[-1] == ' ')
(*endp)--;
return result;
} /* strtol */

View File

@ -0,0 +1,34 @@
/*<html><pre> -<a href="qh-geom.htm"
>-------------------------------</a><a name="TOP">-</a>
random.h
header file for random and utility routines
see qh-geom.htm and random.c
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull/random.h#2 $$Change: 2026 $
$DateTime: 2015/11/07 22:44:39 $$Author: bbarber $
*/
#ifndef qhDEFrandom
#define qhDEFrandom 1
#include "libqhull.h"
/*============= prototypes in alphabetical order ======= */
int qh_argv_to_command(int argc, char *argv[], char* command, int max_size);
int qh_argv_to_command_size(int argc, char *argv[]);
int qh_rand( void);
void qh_srand( int seed);
realT qh_randomfactor(realT scale, realT offset);
void qh_randommatrix(realT *buffer, int dim, realT **row);
int qh_strtol(const char *s, char **endp);
double qh_strtod(const char *s, char **endp);
#endif /* qhDEFrandom */

View File

@ -0,0 +1,870 @@
/*<html><pre> -<a href="index.htm#TOC"
>-------------------------------</a><a name="TOP">-</a>
rboxlib.c
Generate input points
notes:
For documentation, see prompt[] of rbox.c
50 points generated for 'rbox D4'
WARNING:
incorrect range if qh_RANDOMmax is defined wrong (user.h)
*/
#include "libqhull.h" /* First for user.h */
#include "random.h"
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <setjmp.h>
#include <string.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef _MSC_VER /* Microsoft Visual C++ */
#pragma warning( disable : 4706) /* assignment within conditional expression. */
#pragma warning( disable : 4996) /* this function (strncat,sprintf,strcpy) or variable may be unsafe. */
#endif
#define MAXdim 200
#define PI 3.1415926535897932384
/* ------------------------------ prototypes ----------------*/
int qh_roundi( double a);
void qh_out1( double a);
void qh_out2n( double a, double b);
void qh_out3n( double a, double b, double c);
void qh_outcoord(int iscdd, double *coord, int dim);
void qh_outcoincident(int coincidentpoints, double radius, int iscdd, double *coord, int dim);
void qh_fprintf_rbox(FILE *fp, int msgcode, const char *fmt, ... );
void qh_free(void *mem);
void *qh_malloc(size_t size);
int qh_rand( void);
void qh_srand( int seed);
/* ------------------------------ globals -------------------*/
/* No state is carried between rbox requests */
typedef struct rboxT rboxT;
struct rboxT {
FILE *fout;
FILE *ferr;
int isinteger;
double out_offset;
jmp_buf errexit; /* exit label for rboxpoints, defined by setjmp(), called by qh_errexit_rbox() */
char jmpXtra[40]; /* extra bytes in case jmp_buf is defined wrong by compiler */
};
int rbox_inuse= 0;
rboxT rbox;
/*-<a href="qh-qhull.htm#TOC"
>-------------------------------</a><a name="rboxpoints">-</a>
qh_rboxpoints( fout, ferr, rbox_command )
Generate points to fout according to rbox options
Report errors on ferr
returns:
0 (qh_ERRnone) on success
1 (qh_ERRinput) on input error
4 (qh_ERRmem) on memory error
5 (qh_ERRqhull) on internal error
notes:
To avoid using stdio, redefine qh_malloc, qh_free, and qh_fprintf_rbox (user.c)
design:
Straight line code (consider defining a struct and functions):
Parse arguments into variables
Determine the number of points
Generate the points
*/
int qh_rboxpoints(FILE* fout, FILE* ferr, char* rbox_command) {
int i,j,k;
int gendim;
int coincidentcount=0, coincidenttotal=0, coincidentpoints=0;
int cubesize, diamondsize, seed=0, count, apex;
int dim=3, numpoints=0, totpoints, addpoints=0;
int issphere=0, isaxis=0, iscdd=0, islens=0, isregular=0, iswidth=0, addcube=0;
int isgap=0, isspiral=0, NOcommand=0, adddiamond=0;
int israndom=0, istime=0;
int isbox=0, issimplex=0, issimplex2=0, ismesh=0;
double width=0.0, gap=0.0, radius=0.0, coincidentradius=0.0;
double coord[MAXdim], offset, meshm=3.0, meshn=4.0, meshr=5.0;
double *coordp, *simplex= NULL, *simplexp;
int nthroot, mult[MAXdim];
double norm, factor, randr, rangap, lensangle=0, lensbase=1;
double anglediff, angle, x, y, cube=0.0, diamond=0.0;
double box= qh_DEFAULTbox; /* scale all numbers before output */
double randmax= qh_RANDOMmax;
char command[200], seedbuf[200];
char *s= command, *t, *first_point= NULL;
time_t timedata;
int exitcode;
if (rbox_inuse) {
qh_fprintf_rbox(rbox.ferr, 6188, "rbox error: rbox in use by another process. Please lock calls to rbox.\n");
return qh_ERRqhull;
}
rbox_inuse= True;
rbox.ferr= ferr;
rbox.fout= fout;
exitcode= setjmp(rbox.errexit);
if (exitcode) {
/* same code for error exit and normal return. qh.NOerrexit is set */
if (simplex)
qh_free(simplex);
rbox_inuse= False;
return exitcode;
}
*command= '\0';
strncat(command, rbox_command, sizeof(command)-strlen(command)-1);
while (*s && !isspace(*s)) /* skip program name */
s++;
while (*s) {
while (*s && isspace(*s))
s++;
if (*s == '-')
s++;
if (!*s)
break;
if (isdigit(*s)) {
numpoints= qh_strtol(s, &s);
continue;
}
/* ============= read flags =============== */
switch (*s++) {
case 'c':
addcube= 1;
t= s;
while (isspace(*t))
t++;
if (*t == 'G')
cube= qh_strtod(++t, &s);
break;
case 'd':
adddiamond= 1;
t= s;
while (isspace(*t))
t++;
if (*t == 'G')
diamond= qh_strtod(++t, &s);
break;
case 'h':
iscdd= 1;
break;
case 'l':
isspiral= 1;
break;
case 'n':
NOcommand= 1;
break;
case 'r':
isregular= 1;
break;
case 's':
issphere= 1;
break;
case 't':
istime= 1;
if (isdigit(*s)) {
seed= qh_strtol(s, &s);
israndom= 0;
}else
israndom= 1;
break;
case 'x':
issimplex= 1;
break;
case 'y':
issimplex2= 1;
break;
case 'z':
rbox.isinteger= 1;
break;
case 'B':
box= qh_strtod(s, &s);
isbox= 1;
break;
case 'C':
if (*s)
coincidentpoints= qh_strtol(s, &s);
if (*s == ',') {
++s;
coincidentradius= qh_strtod(s, &s);
}
if (*s == ',') {
++s;
coincidenttotal= qh_strtol(s, &s);
}
if (*s && !isspace(*s)) {
qh_fprintf_rbox(rbox.ferr, 7080, "rbox error: arguments for 'Cn,r,m' are not 'int', 'float', and 'int'. Remaining string is '%s'\n", s);
qh_errexit_rbox(qh_ERRinput);
}
if (coincidentpoints==0){
qh_fprintf_rbox(rbox.ferr, 6268, "rbox error: missing arguments for 'Cn,r,m' where n is the number of coincident points, r is the radius (default 0.0), and m is the number of points\n");
qh_errexit_rbox(qh_ERRinput);
}
if (coincidentpoints<0 || coincidenttotal<0 || coincidentradius<0.0){
qh_fprintf_rbox(rbox.ferr, 6269, "rbox error: negative arguments for 'Cn,m,r' where n (%d) is the number of coincident points, m (%d) is the number of points, and r (%.2g) is the radius (default 0.0)\n", coincidentpoints, coincidenttotal, coincidentradius);
qh_errexit_rbox(qh_ERRinput);
}
break;
case 'D':
dim= qh_strtol(s, &s);
if (dim < 1
|| dim > MAXdim) {
qh_fprintf_rbox(rbox.ferr, 6189, "rbox error: dimension, D%d, out of bounds (>=%d or <=0)", dim, MAXdim);
qh_errexit_rbox(qh_ERRinput);
}
break;
case 'G':
if (isdigit(*s))
gap= qh_strtod(s, &s);
else
gap= 0.5;
isgap= 1;
break;
case 'L':
if (isdigit(*s))
radius= qh_strtod(s, &s);
else
radius= 10;
islens= 1;
break;
case 'M':
ismesh= 1;
if (*s)
meshn= qh_strtod(s, &s);
if (*s == ',') {
++s;
meshm= qh_strtod(s, &s);
}else
meshm= 0.0;
if (*s == ',') {
++s;
meshr= qh_strtod(s, &s);
}else
meshr= sqrt(meshn*meshn + meshm*meshm);
if (*s && !isspace(*s)) {
qh_fprintf_rbox(rbox.ferr, 7069, "rbox warning: assuming 'M3,4,5' since mesh args are not integers or reals\n");
meshn= 3.0, meshm=4.0, meshr=5.0;
}
break;
case 'O':
rbox.out_offset= qh_strtod(s, &s);
break;
case 'P':
if (!first_point)
first_point= s-1;
addpoints++;
while (*s && !isspace(*s)) /* read points later */
s++;
break;
case 'W':
width= qh_strtod(s, &s);
iswidth= 1;
break;
case 'Z':
if (isdigit(*s))
radius= qh_strtod(s, &s);
else
radius= 1.0;
isaxis= 1;
break;
default:
qh_fprintf_rbox(rbox.ferr, 7070, "rbox error: unknown flag at %s.\nExecute 'rbox' without arguments for documentation.\n", s);
qh_errexit_rbox(qh_ERRinput);
}
if (*s && !isspace(*s)) {
qh_fprintf_rbox(rbox.ferr, 7071, "rbox error: missing space between flags at %s.\n", s);
qh_errexit_rbox(qh_ERRinput);
}
}
/* ============= defaults, constants, and sizes =============== */
if (rbox.isinteger && !isbox)
box= qh_DEFAULTzbox;
if (addcube) {
cubesize= (int)floor(ldexp(1.0,dim)+0.5);
if (cube == 0.0)
cube= box;
}else
cubesize= 0;
if (adddiamond) {
diamondsize= 2*dim;
if (diamond == 0.0)
diamond= box;
}else
diamondsize= 0;
if (islens) {
if (isaxis) {
qh_fprintf_rbox(rbox.ferr, 6190, "rbox error: can not combine 'Ln' with 'Zn'\n");
qh_errexit_rbox(qh_ERRinput);
}
if (radius <= 1.0) {
qh_fprintf_rbox(rbox.ferr, 6191, "rbox error: lens radius %.2g should be greater than 1.0\n",
radius);
qh_errexit_rbox(qh_ERRinput);
}
lensangle= asin(1.0/radius);
lensbase= radius * cos(lensangle);
}
if (!numpoints) {
if (issimplex2)
; /* ok */
else if (isregular + issimplex + islens + issphere + isaxis + isspiral + iswidth + ismesh) {
qh_fprintf_rbox(rbox.ferr, 6192, "rbox error: missing count\n");
qh_errexit_rbox(qh_ERRinput);
}else if (adddiamond + addcube + addpoints)
; /* ok */
else {
numpoints= 50; /* ./rbox D4 is the test case */
issphere= 1;
}
}
if ((issimplex + islens + isspiral + ismesh > 1)
|| (issimplex + issphere + isspiral + ismesh > 1)) {
qh_fprintf_rbox(rbox.ferr, 6193, "rbox error: can only specify one of 'l', 's', 'x', 'Ln', or 'Mn,m,r' ('Ln s' is ok).\n");
qh_errexit_rbox(qh_ERRinput);
}
if (coincidentpoints>0 && (numpoints == 0 || coincidenttotal > numpoints)) {
qh_fprintf_rbox(rbox.ferr, 6270, "rbox error: 'Cn,r,m' requested n coincident points for each of m points. Either there is no points or m (%d) is greater than the number of points (%d).\n", coincidenttotal, numpoints);
qh_errexit_rbox(qh_ERRinput);
}
if (coincidenttotal == 0)
coincidenttotal= numpoints;
/* ============= print header with total points =============== */
if (issimplex || ismesh)
totpoints= numpoints;
else if (issimplex2)
totpoints= numpoints+dim+1;
else if (isregular) {
totpoints= numpoints;
if (dim == 2) {
if (islens)
totpoints += numpoints - 2;
}else if (dim == 3) {
if (islens)
totpoints += 2 * numpoints;
else if (isgap)
totpoints += 1 + numpoints;
else
totpoints += 2;
}
}else
totpoints= numpoints + isaxis;
totpoints += cubesize + diamondsize + addpoints;
totpoints += coincidentpoints*coincidenttotal;
/* ============= seed randoms =============== */
if (istime == 0) {
for (s=command; *s; s++) {
if (issimplex2 && *s == 'y') /* make 'y' same seed as 'x' */
i= 'x';
else
i= *s;
seed= 11*seed + i;
}
}else if (israndom) {
seed= (int)time(&timedata);
sprintf(seedbuf, " t%d", seed); /* appends an extra t, not worth removing */
strncat(command, seedbuf, sizeof(command)-strlen(command)-1);
t= strstr(command, " t ");
if (t)
strcpy(t+1, t+3); /* remove " t " */
} /* else, seed explicitly set to n */
qh_RANDOMseed_(seed);
/* ============= print header =============== */
if (iscdd)
qh_fprintf_rbox(rbox.fout, 9391, "%s\nbegin\n %d %d %s\n",
NOcommand ? "" : command,
totpoints, dim+1,
rbox.isinteger ? "integer" : "real");
else if (NOcommand)
qh_fprintf_rbox(rbox.fout, 9392, "%d\n%d\n", dim, totpoints);
else
/* qh_fprintf_rbox special cases 9393 to append 'command' to the RboxPoints.comment() */
qh_fprintf_rbox(rbox.fout, 9393, "%d %s\n%d\n", dim, command, totpoints);
/* ============= explicit points =============== */
if ((s= first_point)) {
while (s && *s) { /* 'P' */
count= 0;
if (iscdd)
qh_out1( 1.0);
while (*++s) {
qh_out1( qh_strtod(s, &s));
count++;
if (isspace(*s) || !*s)
break;
if (*s != ',') {
qh_fprintf_rbox(rbox.ferr, 6194, "rbox error: missing comma after coordinate in %s\n\n", s);
qh_errexit_rbox(qh_ERRinput);
}
}
if (count < dim) {
for (k=dim-count; k--; )
qh_out1( 0.0);
}else if (count > dim) {
qh_fprintf_rbox(rbox.ferr, 6195, "rbox error: %d coordinates instead of %d coordinates in %s\n\n",
count, dim, s);
qh_errexit_rbox(qh_ERRinput);
}
qh_fprintf_rbox(rbox.fout, 9394, "\n");
while ((s= strchr(s, 'P'))) {
if (isspace(s[-1]))
break;
}
}
}
/* ============= simplex distribution =============== */
if (issimplex+issimplex2) {
if (!(simplex= (double*)qh_malloc( dim * (dim+1) * sizeof(double)))) {
qh_fprintf_rbox(rbox.ferr, 6196, "rbox error: insufficient memory for simplex\n");
qh_errexit_rbox(qh_ERRmem); /* qh_ERRmem */
}
simplexp= simplex;
if (isregular) {
for (i=0; i<dim; i++) {
for (k=0; k<dim; k++)
*(simplexp++)= i==k ? 1.0 : 0.0;
}
for (k=0; k<dim; k++)
*(simplexp++)= -1.0;
}else {
for (i=0; i<dim+1; i++) {
for (k=0; k<dim; k++) {
randr= qh_RANDOMint;
*(simplexp++)= 2.0 * randr/randmax - 1.0;
}
}
}
if (issimplex2) {
simplexp= simplex;
for (i=0; i<dim+1; i++) {
if (iscdd)
qh_out1( 1.0);
for (k=0; k<dim; k++)
qh_out1( *(simplexp++) * box);
qh_fprintf_rbox(rbox.fout, 9395, "\n");
}
}
for (j=0; j<numpoints; j++) {
if (iswidth)
apex= qh_RANDOMint % (dim+1);
else
apex= -1;
for (k=0; k<dim; k++)
coord[k]= 0.0;
norm= 0.0;
for (i=0; i<dim+1; i++) {
randr= qh_RANDOMint;
factor= randr/randmax;
if (i == apex)
factor *= width;
norm += factor;
for (k=0; k<dim; k++) {
simplexp= simplex + i*dim + k;
coord[k] += factor * (*simplexp);
}
}
for (k=0; k<dim; k++)
coord[k] *= box/norm;
qh_outcoord(iscdd, coord, dim);
if(coincidentcount++ < coincidenttotal)
qh_outcoincident(coincidentpoints, coincidentradius, iscdd, coord, dim);
}
isregular= 0; /* continue with isbox */
numpoints= 0;
}
/* ============= mesh distribution =============== */
if (ismesh) {
nthroot= (int)(pow((double)numpoints, 1.0/dim) + 0.99999);
for (k=dim; k--; )
mult[k]= 0;
for (i=0; i < numpoints; i++) {
coordp= coord;
for (k=0; k < dim; k++) {
if (k == 0)
*(coordp++)= mult[0] * meshn + mult[1] * (-meshm);
else if (k == 1)
*(coordp++)= mult[0] * meshm + mult[1] * meshn;
else
*(coordp++)= mult[k] * meshr;
}
qh_outcoord(iscdd, coord, dim);
if(coincidentcount++ < coincidenttotal)
qh_outcoincident(coincidentpoints, coincidentradius, iscdd, coord, dim);
for (k=0; k < dim; k++) {
if (++mult[k] < nthroot)
break;
mult[k]= 0;
}
}
}
/* ============= regular points for 's' =============== */
else if (isregular && !islens) {
if (dim != 2 && dim != 3) {
qh_free(simplex);
qh_fprintf_rbox(rbox.ferr, 6197, "rbox error: regular points can be used only in 2-d and 3-d\n\n");
qh_errexit_rbox(qh_ERRinput);
}
if (!isaxis || radius == 0.0) {
isaxis= 1;
radius= 1.0;
}
if (dim == 3) {
if (iscdd)
qh_out1( 1.0);
qh_out3n( 0.0, 0.0, -box);
if (!isgap) {
if (iscdd)
qh_out1( 1.0);
qh_out3n( 0.0, 0.0, box);
}
}
angle= 0.0;
anglediff= 2.0 * PI/numpoints;
for (i=0; i < numpoints; i++) {
angle += anglediff;
x= radius * cos(angle);
y= radius * sin(angle);
if (dim == 2) {
if (iscdd)
qh_out1( 1.0);
qh_out2n( x*box, y*box);
}else {
norm= sqrt(1.0 + x*x + y*y);
if (iscdd)
qh_out1( 1.0);
qh_out3n( box*x/norm, box*y/norm, box/norm);
if (isgap) {
x *= 1-gap;
y *= 1-gap;
norm= sqrt(1.0 + x*x + y*y);
if (iscdd)
qh_out1( 1.0);
qh_out3n( box*x/norm, box*y/norm, box/norm);
}
}
}
}
/* ============= regular points for 'r Ln D2' =============== */
else if (isregular && islens && dim == 2) {
double cos_0;
angle= lensangle;
anglediff= 2 * lensangle/(numpoints - 1);
cos_0= cos(lensangle);
for (i=0; i < numpoints; i++, angle -= anglediff) {
x= radius * sin(angle);
y= radius * (cos(angle) - cos_0);
if (iscdd)
qh_out1( 1.0);
qh_out2n( x*box, y*box);
if (i != 0 && i != numpoints - 1) {
if (iscdd)
qh_out1( 1.0);
qh_out2n( x*box, -y*box);
}
}
}
/* ============= regular points for 'r Ln D3' =============== */
else if (isregular && islens && dim != 2) {
if (dim != 3) {
qh_free(simplex);
qh_fprintf_rbox(rbox.ferr, 6198, "rbox error: regular points can be used only in 2-d and 3-d\n\n");
qh_errexit_rbox(qh_ERRinput);
}
angle= 0.0;
anglediff= 2* PI/numpoints;
if (!isgap) {
isgap= 1;
gap= 0.5;
}
offset= sqrt(radius * radius - (1-gap)*(1-gap)) - lensbase;
for (i=0; i < numpoints; i++, angle += anglediff) {
x= cos(angle);
y= sin(angle);
if (iscdd)
qh_out1( 1.0);
qh_out3n( box*x, box*y, 0.0);
x *= 1-gap;
y *= 1-gap;
if (iscdd)
qh_out1( 1.0);
qh_out3n( box*x, box*y, box * offset);
if (iscdd)
qh_out1( 1.0);
qh_out3n( box*x, box*y, -box * offset);
}
}
/* ============= apex of 'Zn' distribution + gendim =============== */
else {
if (isaxis) {
gendim= dim-1;
if (iscdd)
qh_out1( 1.0);
for (j=0; j < gendim; j++)
qh_out1( 0.0);
qh_out1( -box);
qh_fprintf_rbox(rbox.fout, 9398, "\n");
}else if (islens)
gendim= dim-1;
else
gendim= dim;
/* ============= generate random point in unit cube =============== */
for (i=0; i < numpoints; i++) {
norm= 0.0;
for (j=0; j < gendim; j++) {
randr= qh_RANDOMint;
coord[j]= 2.0 * randr/randmax - 1.0;
norm += coord[j] * coord[j];
}
norm= sqrt(norm);
/* ============= dim-1 point of 'Zn' distribution ========== */
if (isaxis) {
if (!isgap) {
isgap= 1;
gap= 1.0;
}
randr= qh_RANDOMint;
rangap= 1.0 - gap * randr/randmax;
factor= radius * rangap / norm;
for (j=0; j<gendim; j++)
coord[j]= factor * coord[j];
/* ============= dim-1 point of 'Ln s' distribution =========== */
}else if (islens && issphere) {
if (!isgap) {
isgap= 1;
gap= 1.0;
}
randr= qh_RANDOMint;
rangap= 1.0 - gap * randr/randmax;
factor= rangap / norm;
for (j=0; j<gendim; j++)
coord[j]= factor * coord[j];
/* ============= dim-1 point of 'Ln' distribution ========== */
}else if (islens && !issphere) {
if (!isgap) {
isgap= 1;
gap= 1.0;
}
j= qh_RANDOMint % gendim;
if (coord[j] < 0)
coord[j]= -1.0 - coord[j] * gap;
else
coord[j]= 1.0 - coord[j] * gap;
/* ============= point of 'l' distribution =============== */
}else if (isspiral) {
if (dim != 3) {
qh_free(simplex);
qh_fprintf_rbox(rbox.ferr, 6199, "rbox error: spiral distribution is available only in 3d\n\n");
qh_errexit_rbox(qh_ERRinput);
}
coord[0]= cos(2*PI*i/(numpoints - 1));
coord[1]= sin(2*PI*i/(numpoints - 1));
coord[2]= 2.0*(double)i/(double)(numpoints-1) - 1.0;
/* ============= point of 's' distribution =============== */
}else if (issphere) {
factor= 1.0/norm;
if (iswidth) {
randr= qh_RANDOMint;
factor *= 1.0 - width * randr/randmax;
}
for (j=0; j<dim; j++)
coord[j]= factor * coord[j];
}
/* ============= project 'Zn s' point in to sphere =============== */
if (isaxis && issphere) {
coord[dim-1]= 1.0;
norm= 1.0;
for (j=0; j<gendim; j++)
norm += coord[j] * coord[j];
norm= sqrt(norm);
for (j=0; j<dim; j++)
coord[j]= coord[j] / norm;
if (iswidth) {
randr= qh_RANDOMint;
coord[dim-1] *= 1 - width * randr/randmax;
}
/* ============= project 'Zn' point onto cube =============== */
}else if (isaxis && !issphere) { /* not very interesting */
randr= qh_RANDOMint;
coord[dim-1]= 2.0 * randr/randmax - 1.0;
/* ============= project 'Ln' point out to sphere =============== */
}else if (islens) {
coord[dim-1]= lensbase;
for (j=0, norm= 0; j<dim; j++)
norm += coord[j] * coord[j];
norm= sqrt(norm);
for (j=0; j<dim; j++)
coord[j]= coord[j] * radius/ norm;
coord[dim-1] -= lensbase;
if (iswidth) {
randr= qh_RANDOMint;
coord[dim-1] *= 1 - width * randr/randmax;
}
if (qh_RANDOMint > randmax/2)
coord[dim-1]= -coord[dim-1];
/* ============= project 'Wn' point toward boundary =============== */
}else if (iswidth && !issphere) {
j= qh_RANDOMint % gendim;
if (coord[j] < 0)
coord[j]= -1.0 - coord[j] * width;
else
coord[j]= 1.0 - coord[j] * width;
}
/* ============= scale point to box =============== */
for (k=0; k<dim; k++)
coord[k]= coord[k] * box;
/* ============= write output =============== */
qh_outcoord(iscdd, coord, dim);
if(coincidentcount++ < coincidenttotal)
qh_outcoincident(coincidentpoints, coincidentradius, iscdd, coord, dim);
}
}
/* ============= write cube vertices =============== */
if (addcube) {
for (j=0; j<cubesize; j++) {
if (iscdd)
qh_out1( 1.0);
for (k=dim-1; k>=0; k--) {
if (j & ( 1 << k))
qh_out1( cube);
else
qh_out1( -cube);
}
qh_fprintf_rbox(rbox.fout, 9400, "\n");
}
}
/* ============= write diamond vertices =============== */
if (adddiamond) {
for (j=0; j<diamondsize; j++) {
if (iscdd)
qh_out1( 1.0);
for (k=dim-1; k>=0; k--) {
if (j/2 != k)
qh_out1( 0.0);
else if (j & 0x1)
qh_out1( diamond);
else
qh_out1( -diamond);
}
qh_fprintf_rbox(rbox.fout, 9401, "\n");
}
}
if (iscdd)
qh_fprintf_rbox(rbox.fout, 9402, "end\nhull\n");
/* same code for error exit and normal return */
qh_free(simplex);
rbox_inuse= False;
return qh_ERRnone;
} /* rboxpoints */
/*------------------------------------------------
outxxx - output functions for qh_rboxpoints
*/
int qh_roundi( double a) {
if (a < 0.0) {
if (a - 0.5 < INT_MIN) {
qh_fprintf_rbox(rbox.ferr, 6200, "rbox input error: negative coordinate %2.2g is too large. Reduce 'Bn'\n", a);
qh_errexit_rbox(qh_ERRinput);
}
return (int)(a - 0.5);
}else {
if (a + 0.5 > INT_MAX) {
qh_fprintf_rbox(rbox.ferr, 6201, "rbox input error: coordinate %2.2g is too large. Reduce 'Bn'\n", a);
qh_errexit_rbox(qh_ERRinput);
}
return (int)(a + 0.5);
}
} /* qh_roundi */
void qh_out1(double a) {
if (rbox.isinteger)
qh_fprintf_rbox(rbox.fout, 9403, "%d ", qh_roundi( a+rbox.out_offset));
else
qh_fprintf_rbox(rbox.fout, 9404, qh_REAL_1, a+rbox.out_offset);
} /* qh_out1 */
void qh_out2n( double a, double b) {
if (rbox.isinteger)
qh_fprintf_rbox(rbox.fout, 9405, "%d %d\n", qh_roundi(a+rbox.out_offset), qh_roundi(b+rbox.out_offset));
else
qh_fprintf_rbox(rbox.fout, 9406, qh_REAL_2n, a+rbox.out_offset, b+rbox.out_offset);
} /* qh_out2n */
void qh_out3n( double a, double b, double c) {
if (rbox.isinteger)
qh_fprintf_rbox(rbox.fout, 9407, "%d %d %d\n", qh_roundi(a+rbox.out_offset), qh_roundi(b+rbox.out_offset), qh_roundi(c+rbox.out_offset));
else
qh_fprintf_rbox(rbox.fout, 9408, qh_REAL_3n, a+rbox.out_offset, b+rbox.out_offset, c+rbox.out_offset);
} /* qh_out3n */
void qh_outcoord(int iscdd, double *coord, int dim) {
double *p= coord;
int k;
if (iscdd)
qh_out1( 1.0);
for (k=0; k < dim; k++)
qh_out1(*(p++));
qh_fprintf_rbox(rbox.fout, 9396, "\n");
} /* qh_outcoord */
void qh_outcoincident(int coincidentpoints, double radius, int iscdd, double *coord, int dim) {
double *p;
double randr, delta;
int i,k;
double randmax= qh_RANDOMmax;
for (i= 0; i<coincidentpoints; i++) {
p= coord;
if (iscdd)
qh_out1( 1.0);
for (k=0; k < dim; k++) {
randr= qh_RANDOMint;
delta= 2.0 * randr/randmax - 1.0; /* -1..+1 */
delta *= radius;
qh_out1(*(p++) + delta);
}
qh_fprintf_rbox(rbox.fout, 9410, "\n");
}
} /* qh_outcoincident */
/*------------------------------------------------
Only called from qh_rboxpoints or qh_fprintf_rbox
qh_fprintf_rbox is only called from qh_rboxpoints
*/
void qh_errexit_rbox(int exitcode)
{
longjmp(rbox.errexit, exitcode);
} /* qh_errexit_rbox */

View File

@ -0,0 +1,717 @@
/*<html><pre> -<a href="qh-stat.htm"
>-------------------------------</a><a name="TOP">-</a>
stat.c
contains all statistics that are collected for qhull
see qh-stat.htm and stat.h
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull/stat.c#5 $$Change: 2062 $
$DateTime: 2016/01/17 13:13:18 $$Author: bbarber $
*/
#include "qhull_a.h"
/*============ global data structure ==========*/
#if qh_QHpointer
qhstatT *qh_qhstat=NULL; /* global data structure */
#else
qhstatT qh_qhstat; /* add "={0}" if this causes a compiler error */
#endif
/*========== functions in alphabetic order ================*/
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="allstatA">-</a>
qh_allstatA()
define statistics in groups of 20
notes:
(otherwise, 'gcc -O2' uses too much memory)
uses qhstat.next
*/
void qh_allstatA(void) {
/* zdef_(type,name,doc,average) */
zzdef_(zdoc, Zdoc2, "precision statistics", -1);
zdef_(zinc, Znewvertex, NULL, -1);
zdef_(wadd, Wnewvertex, "ave. distance of a new vertex to a facet(!0s)", Znewvertex);
zzdef_(wmax, Wnewvertexmax, "max. distance of a new vertex to a facet", -1);
zdef_(wmax, Wvertexmax, "max. distance of an output vertex to a facet", -1);
zdef_(wmin, Wvertexmin, "min. distance of an output vertex to a facet", -1);
zdef_(wmin, Wmindenom, "min. denominator in hyperplane computation", -1);
qhstat precision= qhstat next; /* call qh_precision for each of these */
zzdef_(zdoc, Zdoc3, "precision problems (corrected unless 'Q0' or an error)", -1);
zzdef_(zinc, Zcoplanarridges, "coplanar half ridges in output", -1);
zzdef_(zinc, Zconcaveridges, "concave half ridges in output", -1);
zzdef_(zinc, Zflippedfacets, "flipped facets", -1);
zzdef_(zinc, Zcoplanarhorizon, "coplanar horizon facets for new vertices", -1);
zzdef_(zinc, Zcoplanarpart, "coplanar points during partitioning", -1);
zzdef_(zinc, Zminnorm, "degenerate hyperplanes recomputed with gaussian elimination", -1);
zzdef_(zinc, Znearlysingular, "nearly singular or axis-parallel hyperplanes", -1);
zzdef_(zinc, Zback0, "zero divisors during back substitute", -1);
zzdef_(zinc, Zgauss0, "zero divisors during gaussian elimination", -1);
zzdef_(zinc, Zmultiridge, "ridges with multiple neighbors", -1);
}
void qh_allstatB(void) {
zzdef_(zdoc, Zdoc1, "summary information", -1);
zdef_(zinc, Zvertices, "number of vertices in output", -1);
zdef_(zinc, Znumfacets, "number of facets in output", -1);
zdef_(zinc, Znonsimplicial, "number of non-simplicial facets in output", -1);
zdef_(zinc, Znowsimplicial, "number of simplicial facets that were merged", -1);
zdef_(zinc, Znumridges, "number of ridges in output", -1);
zdef_(zadd, Znumridges, "average number of ridges per facet", Znumfacets);
zdef_(zmax, Zmaxridges, "maximum number of ridges", -1);
zdef_(zadd, Znumneighbors, "average number of neighbors per facet", Znumfacets);
zdef_(zmax, Zmaxneighbors, "maximum number of neighbors", -1);
zdef_(zadd, Znumvertices, "average number of vertices per facet", Znumfacets);
zdef_(zmax, Zmaxvertices, "maximum number of vertices", -1);
zdef_(zadd, Znumvneighbors, "average number of neighbors per vertex", Zvertices);
zdef_(zmax, Zmaxvneighbors, "maximum number of neighbors", -1);
zdef_(wadd, Wcpu, "cpu seconds for qhull after input", -1);
zdef_(zinc, Ztotvertices, "vertices created altogether", -1);
zzdef_(zinc, Zsetplane, "facets created altogether", -1);
zdef_(zinc, Ztotridges, "ridges created altogether", -1);
zdef_(zinc, Zpostfacets, "facets before post merge", -1);
zdef_(zadd, Znummergetot, "average merges per facet(at most 511)", Znumfacets);
zdef_(zmax, Znummergemax, " maximum merges for a facet(at most 511)", -1);
zdef_(zinc, Zangle, NULL, -1);
zdef_(wadd, Wangle, "average angle(cosine) of facet normals for all ridges", Zangle);
zdef_(wmax, Wanglemax, " maximum angle(cosine) of facet normals across a ridge", -1);
zdef_(wmin, Wanglemin, " minimum angle(cosine) of facet normals across a ridge", -1);
zdef_(wadd, Wareatot, "total area of facets", -1);
zdef_(wmax, Wareamax, " maximum facet area", -1);
zdef_(wmin, Wareamin, " minimum facet area", -1);
}
void qh_allstatC(void) {
zdef_(zdoc, Zdoc9, "build hull statistics", -1);
zzdef_(zinc, Zprocessed, "points processed", -1);
zzdef_(zinc, Zretry, "retries due to precision problems", -1);
zdef_(wmax, Wretrymax, " max. random joggle", -1);
zdef_(zmax, Zmaxvertex, "max. vertices at any one time", -1);
zdef_(zinc, Ztotvisible, "ave. visible facets per iteration", Zprocessed);
zdef_(zinc, Zinsidevisible, " ave. visible facets without an horizon neighbor", Zprocessed);
zdef_(zadd, Zvisfacettot, " ave. facets deleted per iteration", Zprocessed);
zdef_(zmax, Zvisfacetmax, " maximum", -1);
zdef_(zadd, Zvisvertextot, "ave. visible vertices per iteration", Zprocessed);
zdef_(zmax, Zvisvertexmax, " maximum", -1);
zdef_(zinc, Ztothorizon, "ave. horizon facets per iteration", Zprocessed);
zdef_(zadd, Znewfacettot, "ave. new or merged facets per iteration", Zprocessed);
zdef_(zmax, Znewfacetmax, " maximum(includes initial simplex)", -1);
zdef_(wadd, Wnewbalance, "average new facet balance", Zprocessed);
zdef_(wadd, Wnewbalance2, " standard deviation", -1);
zdef_(wadd, Wpbalance, "average partition balance", Zpbalance);
zdef_(wadd, Wpbalance2, " standard deviation", -1);
zdef_(zinc, Zpbalance, " number of trials", -1);
zdef_(zinc, Zsearchpoints, "searches of all points for initial simplex", -1);
zdef_(zinc, Zdetsimplex, "determinants computed(area & initial hull)", -1);
zdef_(zinc, Znoarea, "determinants not computed because vertex too low", -1);
zdef_(zinc, Znotmax, "points ignored(!above max_outside)", -1);
zdef_(zinc, Znotgood, "points ignored(!above a good facet)", -1);
zdef_(zinc, Znotgoodnew, "points ignored(didn't create a good new facet)", -1);
zdef_(zinc, Zgoodfacet, "good facets found", -1);
zzdef_(zinc, Znumvisibility, "distance tests for facet visibility", -1);
zdef_(zinc, Zdistvertex, "distance tests to report minimum vertex", -1);
zzdef_(zinc, Ztotcheck, "points checked for facets' outer planes", -1);
zzdef_(zinc, Zcheckpart, " ave. distance tests per check", Ztotcheck);
}
void qh_allstatD(void) {
zdef_(zinc, Zvisit, "resets of visit_id", -1);
zdef_(zinc, Zvvisit, " resets of vertex_visit", -1);
zdef_(zmax, Zvisit2max, " max visit_id/2", -1);
zdef_(zmax, Zvvisit2max, " max vertex_visit/2", -1);
zdef_(zdoc, Zdoc4, "partitioning statistics(see previous for outer planes)", -1);
zzdef_(zadd, Zdelvertextot, "total vertices deleted", -1);
zdef_(zmax, Zdelvertexmax, " maximum vertices deleted per iteration", -1);
zdef_(zinc, Zfindbest, "calls to findbest", -1);
zdef_(zadd, Zfindbesttot, " ave. facets tested", Zfindbest);
zdef_(zmax, Zfindbestmax, " max. facets tested", -1);
zdef_(zadd, Zfindcoplanar, " ave. coplanar search", Zfindbest);
zdef_(zinc, Zfindnew, "calls to findbestnew", -1);
zdef_(zadd, Zfindnewtot, " ave. facets tested", Zfindnew);
zdef_(zmax, Zfindnewmax, " max. facets tested", -1);
zdef_(zinc, Zfindnewjump, " ave. clearly better", Zfindnew);
zdef_(zinc, Zfindnewsharp, " calls due to qh_sharpnewfacets", -1);
zdef_(zinc, Zfindhorizon, "calls to findhorizon", -1);
zdef_(zadd, Zfindhorizontot, " ave. facets tested", Zfindhorizon);
zdef_(zmax, Zfindhorizonmax, " max. facets tested", -1);
zdef_(zinc, Zfindjump, " ave. clearly better", Zfindhorizon);
zdef_(zinc, Zparthorizon, " horizon facets better than bestfacet", -1);
zdef_(zinc, Zpartangle, "angle tests for repartitioned coplanar points", -1);
zdef_(zinc, Zpartflip, " repartitioned coplanar points for flipped orientation", -1);
}
void qh_allstatE(void) {
zdef_(zinc, Zpartinside, "inside points", -1);
zdef_(zinc, Zpartnear, " inside points kept with a facet", -1);
zdef_(zinc, Zcoplanarinside, " inside points that were coplanar with a facet", -1);
zdef_(zinc, Zbestlower, "calls to findbestlower", -1);
zdef_(zinc, Zbestlowerv, " with search of vertex neighbors", -1);
zdef_(zinc, Zbestlowerall, " with rare search of all facets", -1);
zdef_(zmax, Zbestloweralln, " facets per search of all facets", -1);
zdef_(wadd, Wmaxout, "difference in max_outside at final check", -1);
zzdef_(zinc, Zpartitionall, "distance tests for initial partition", -1);
zdef_(zinc, Ztotpartition, "partitions of a point", -1);
zzdef_(zinc, Zpartition, "distance tests for partitioning", -1);
zzdef_(zinc, Zdistcheck, "distance tests for checking flipped facets", -1);
zzdef_(zinc, Zdistconvex, "distance tests for checking convexity", -1);
zdef_(zinc, Zdistgood, "distance tests for checking good point", -1);
zdef_(zinc, Zdistio, "distance tests for output", -1);
zdef_(zinc, Zdiststat, "distance tests for statistics", -1);
zdef_(zinc, Zdistplane, "total number of distance tests", -1);
zdef_(zinc, Ztotpartcoplanar, "partitions of coplanar points or deleted vertices", -1);
zzdef_(zinc, Zpartcoplanar, " distance tests for these partitions", -1);
zdef_(zinc, Zcomputefurthest, "distance tests for computing furthest", -1);
}
void qh_allstatE2(void) {
zdef_(zdoc, Zdoc5, "statistics for matching ridges", -1);
zdef_(zinc, Zhashlookup, "total lookups for matching ridges of new facets", -1);
zdef_(zinc, Zhashtests, "average number of tests to match a ridge", Zhashlookup);
zdef_(zinc, Zhashridge, "total lookups of subridges(duplicates and boundary)", -1);
zdef_(zinc, Zhashridgetest, "average number of tests per subridge", Zhashridge);
zdef_(zinc, Zdupsame, "duplicated ridges in same merge cycle", -1);
zdef_(zinc, Zdupflip, "duplicated ridges with flipped facets", -1);
zdef_(zdoc, Zdoc6, "statistics for determining merges", -1);
zdef_(zinc, Zangletests, "angles computed for ridge convexity", -1);
zdef_(zinc, Zbestcentrum, "best merges used centrum instead of vertices",-1);
zzdef_(zinc, Zbestdist, "distance tests for best merge", -1);
zzdef_(zinc, Zcentrumtests, "distance tests for centrum convexity", -1);
zzdef_(zinc, Zdistzero, "distance tests for checking simplicial convexity", -1);
zdef_(zinc, Zcoplanarangle, "coplanar angles in getmergeset", -1);
zdef_(zinc, Zcoplanarcentrum, "coplanar centrums in getmergeset", -1);
zdef_(zinc, Zconcaveridge, "concave ridges in getmergeset", -1);
}
void qh_allstatF(void) {
zdef_(zdoc, Zdoc7, "statistics for merging", -1);
zdef_(zinc, Zpremergetot, "merge iterations", -1);
zdef_(zadd, Zmergeinittot, "ave. initial non-convex ridges per iteration", Zpremergetot);
zdef_(zadd, Zmergeinitmax, " maximum", -1);
zdef_(zadd, Zmergesettot, " ave. additional non-convex ridges per iteration", Zpremergetot);
zdef_(zadd, Zmergesetmax, " maximum additional in one pass", -1);
zdef_(zadd, Zmergeinittot2, "initial non-convex ridges for post merging", -1);
zdef_(zadd, Zmergesettot2, " additional non-convex ridges", -1);
zdef_(wmax, Wmaxoutside, "max distance of vertex or coplanar point above facet(w/roundoff)", -1);
zdef_(wmin, Wminvertex, "max distance of merged vertex below facet(or roundoff)", -1);
zdef_(zinc, Zwidefacet, "centrums frozen due to a wide merge", -1);
zdef_(zinc, Zwidevertices, "centrums frozen due to extra vertices", -1);
zzdef_(zinc, Ztotmerge, "total number of facets or cycles of facets merged", -1);
zdef_(zinc, Zmergesimplex, "merged a simplex", -1);
zdef_(zinc, Zonehorizon, "simplices merged into coplanar horizon", -1);
zzdef_(zinc, Zcyclehorizon, "cycles of facets merged into coplanar horizon", -1);
zzdef_(zadd, Zcyclefacettot, " ave. facets per cycle", Zcyclehorizon);
zdef_(zmax, Zcyclefacetmax, " max. facets", -1);
zdef_(zinc, Zmergeintohorizon, "new facets merged into horizon", -1);
zdef_(zinc, Zmergenew, "new facets merged", -1);
zdef_(zinc, Zmergehorizon, "horizon facets merged into new facets", -1);
zdef_(zinc, Zmergevertex, "vertices deleted by merging", -1);
zdef_(zinc, Zcyclevertex, "vertices deleted by merging into coplanar horizon", -1);
zdef_(zinc, Zdegenvertex, "vertices deleted by degenerate facet", -1);
zdef_(zinc, Zmergeflipdup, "merges due to flipped facets in duplicated ridge", -1);
zdef_(zinc, Zneighbor, "merges due to redundant neighbors", -1);
zdef_(zadd, Ztestvneighbor, "non-convex vertex neighbors", -1);
}
void qh_allstatG(void) {
zdef_(zinc, Zacoplanar, "merges due to angle coplanar facets", -1);
zdef_(wadd, Wacoplanartot, " average merge distance", Zacoplanar);
zdef_(wmax, Wacoplanarmax, " maximum merge distance", -1);
zdef_(zinc, Zcoplanar, "merges due to coplanar facets", -1);
zdef_(wadd, Wcoplanartot, " average merge distance", Zcoplanar);
zdef_(wmax, Wcoplanarmax, " maximum merge distance", -1);
zdef_(zinc, Zconcave, "merges due to concave facets", -1);
zdef_(wadd, Wconcavetot, " average merge distance", Zconcave);
zdef_(wmax, Wconcavemax, " maximum merge distance", -1);
zdef_(zinc, Zavoidold, "coplanar/concave merges due to avoiding old merge", -1);
zdef_(wadd, Wavoidoldtot, " average merge distance", Zavoidold);
zdef_(wmax, Wavoidoldmax, " maximum merge distance", -1);
zdef_(zinc, Zdegen, "merges due to degenerate facets", -1);
zdef_(wadd, Wdegentot, " average merge distance", Zdegen);
zdef_(wmax, Wdegenmax, " maximum merge distance", -1);
zdef_(zinc, Zflipped, "merges due to removing flipped facets", -1);
zdef_(wadd, Wflippedtot, " average merge distance", Zflipped);
zdef_(wmax, Wflippedmax, " maximum merge distance", -1);
zdef_(zinc, Zduplicate, "merges due to duplicated ridges", -1);
zdef_(wadd, Wduplicatetot, " average merge distance", Zduplicate);
zdef_(wmax, Wduplicatemax, " maximum merge distance", -1);
}
void qh_allstatH(void) {
zdef_(zdoc, Zdoc8, "renamed vertex statistics", -1);
zdef_(zinc, Zrenameshare, "renamed vertices shared by two facets", -1);
zdef_(zinc, Zrenamepinch, "renamed vertices in a pinched facet", -1);
zdef_(zinc, Zrenameall, "renamed vertices shared by multiple facets", -1);
zdef_(zinc, Zfindfail, "rename failures due to duplicated ridges", -1);
zdef_(zinc, Zdupridge, " duplicate ridges detected", -1);
zdef_(zinc, Zdelridge, "deleted ridges due to renamed vertices", -1);
zdef_(zinc, Zdropneighbor, "dropped neighbors due to renamed vertices", -1);
zdef_(zinc, Zdropdegen, "degenerate facets due to dropped neighbors", -1);
zdef_(zinc, Zdelfacetdup, " facets deleted because of no neighbors", -1);
zdef_(zinc, Zremvertex, "vertices removed from facets due to no ridges", -1);
zdef_(zinc, Zremvertexdel, " deleted", -1);
zdef_(zinc, Zintersectnum, "vertex intersections for locating redundant vertices", -1);
zdef_(zinc, Zintersectfail, "intersections failed to find a redundant vertex", -1);
zdef_(zinc, Zintersect, "intersections found redundant vertices", -1);
zdef_(zadd, Zintersecttot, " ave. number found per vertex", Zintersect);
zdef_(zmax, Zintersectmax, " max. found for a vertex", -1);
zdef_(zinc, Zvertexridge, NULL, -1);
zdef_(zadd, Zvertexridgetot, " ave. number of ridges per tested vertex", Zvertexridge);
zdef_(zmax, Zvertexridgemax, " max. number of ridges per tested vertex", -1);
zdef_(zdoc, Zdoc10, "memory usage statistics(in bytes)", -1);
zdef_(zadd, Zmemfacets, "for facets and their normals, neighbor and vertex sets", -1);
zdef_(zadd, Zmemvertices, "for vertices and their neighbor sets", -1);
zdef_(zadd, Zmempoints, "for input points and outside and coplanar sets",-1);
zdef_(zadd, Zmemridges, "for ridges and their vertex sets", -1);
} /* allstat */
void qh_allstatI(void) {
qhstat vridges= qhstat next;
zzdef_(zdoc, Zdoc11, "Voronoi ridge statistics", -1);
zzdef_(zinc, Zridge, "non-simplicial Voronoi vertices for all ridges", -1);
zzdef_(wadd, Wridge, " ave. distance to ridge", Zridge);
zzdef_(wmax, Wridgemax, " max. distance to ridge", -1);
zzdef_(zinc, Zridgemid, "bounded ridges", -1);
zzdef_(wadd, Wridgemid, " ave. distance of midpoint to ridge", Zridgemid);
zzdef_(wmax, Wridgemidmax, " max. distance of midpoint to ridge", -1);
zzdef_(zinc, Zridgeok, "bounded ridges with ok normal", -1);
zzdef_(wadd, Wridgeok, " ave. angle to ridge", Zridgeok);
zzdef_(wmax, Wridgeokmax, " max. angle to ridge", -1);
zzdef_(zinc, Zridge0, "bounded ridges with near-zero normal", -1);
zzdef_(wadd, Wridge0, " ave. angle to ridge", Zridge0);
zzdef_(wmax, Wridge0max, " max. angle to ridge", -1);
zdef_(zdoc, Zdoc12, "Triangulation statistics(Qt)", -1);
zdef_(zinc, Ztricoplanar, "non-simplicial facets triangulated", -1);
zdef_(zadd, Ztricoplanartot, " ave. new facets created(may be deleted)", Ztricoplanar);
zdef_(zmax, Ztricoplanarmax, " max. new facets created", -1);
zdef_(zinc, Ztrinull, "null new facets deleted(duplicated vertex)", -1);
zdef_(zinc, Ztrimirror, "mirrored pairs of new facets deleted(same vertices)", -1);
zdef_(zinc, Ztridegen, "degenerate new facets in output(same ridge)", -1);
} /* allstat */
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="allstatistics">-</a>
qh_allstatistics()
reset printed flag for all statistics
*/
void qh_allstatistics(void) {
int i;
for(i=ZEND; i--; )
qhstat printed[i]= False;
} /* allstatistics */
#if qh_KEEPstatistics
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="collectstatistics">-</a>
qh_collectstatistics()
collect statistics for qh.facet_list
*/
void qh_collectstatistics(void) {
facetT *facet, *neighbor, **neighborp;
vertexT *vertex, **vertexp;
realT dotproduct, dist;
int sizneighbors, sizridges, sizvertices, i;
qh old_randomdist= qh RANDOMdist;
qh RANDOMdist= False;
zval_(Zmempoints)= qh num_points * qh normal_size +
sizeof(qhT) + sizeof(qhstatT);
zval_(Zmemfacets)= 0;
zval_(Zmemridges)= 0;
zval_(Zmemvertices)= 0;
zval_(Zangle)= 0;
wval_(Wangle)= 0.0;
zval_(Znumridges)= 0;
zval_(Znumfacets)= 0;
zval_(Znumneighbors)= 0;
zval_(Znumvertices)= 0;
zval_(Znumvneighbors)= 0;
zval_(Znummergetot)= 0;
zval_(Znummergemax)= 0;
zval_(Zvertices)= qh num_vertices - qh_setsize(qh del_vertices);
if (qh MERGING || qh APPROXhull || qh JOGGLEmax < REALmax/2)
wmax_(Wmaxoutside, qh max_outside);
if (qh MERGING)
wmin_(Wminvertex, qh min_vertex);
FORALLfacets
facet->seen= False;
if (qh DELAUNAY) {
FORALLfacets {
if (facet->upperdelaunay != qh UPPERdelaunay)
facet->seen= True; /* remove from angle statistics */
}
}
FORALLfacets {
if (facet->visible && qh NEWfacets)
continue;
sizvertices= qh_setsize(facet->vertices);
sizneighbors= qh_setsize(facet->neighbors);
sizridges= qh_setsize(facet->ridges);
zinc_(Znumfacets);
zadd_(Znumvertices, sizvertices);
zmax_(Zmaxvertices, sizvertices);
zadd_(Znumneighbors, sizneighbors);
zmax_(Zmaxneighbors, sizneighbors);
zadd_(Znummergetot, facet->nummerge);
i= facet->nummerge; /* avoid warnings */
zmax_(Znummergemax, i);
if (!facet->simplicial) {
if (sizvertices == qh hull_dim) {
zinc_(Znowsimplicial);
}else {
zinc_(Znonsimplicial);
}
}
if (sizridges) {
zadd_(Znumridges, sizridges);
zmax_(Zmaxridges, sizridges);
}
zadd_(Zmemfacets, sizeof(facetT) + qh normal_size + 2*sizeof(setT)
+ SETelemsize * (sizneighbors + sizvertices));
if (facet->ridges) {
zadd_(Zmemridges,
sizeof(setT) + SETelemsize * sizridges + sizridges *
(sizeof(ridgeT) + sizeof(setT) + SETelemsize * (qh hull_dim-1))/2);
}
if (facet->outsideset)
zadd_(Zmempoints, sizeof(setT) + SETelemsize * qh_setsize(facet->outsideset));
if (facet->coplanarset)
zadd_(Zmempoints, sizeof(setT) + SETelemsize * qh_setsize(facet->coplanarset));
if (facet->seen) /* Delaunay upper envelope */
continue;
facet->seen= True;
FOREACHneighbor_(facet) {
if (neighbor == qh_DUPLICATEridge || neighbor == qh_MERGEridge
|| neighbor->seen || !facet->normal || !neighbor->normal)
continue;
dotproduct= qh_getangle(facet->normal, neighbor->normal);
zinc_(Zangle);
wadd_(Wangle, dotproduct);
wmax_(Wanglemax, dotproduct)
wmin_(Wanglemin, dotproduct)
}
if (facet->normal) {
FOREACHvertex_(facet->vertices) {
zinc_(Zdiststat);
qh_distplane(vertex->point, facet, &dist);
wmax_(Wvertexmax, dist);
wmin_(Wvertexmin, dist);
}
}
}
FORALLvertices {
if (vertex->deleted)
continue;
zadd_(Zmemvertices, sizeof(vertexT));
if (vertex->neighbors) {
sizneighbors= qh_setsize(vertex->neighbors);
zadd_(Znumvneighbors, sizneighbors);
zmax_(Zmaxvneighbors, sizneighbors);
zadd_(Zmemvertices, sizeof(vertexT) + SETelemsize * sizneighbors);
}
}
qh RANDOMdist= qh old_randomdist;
} /* collectstatistics */
#endif /* qh_KEEPstatistics */
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="freestatistics">-</a>
qh_freestatistics( )
free memory used for statistics
*/
void qh_freestatistics(void) {
#if qh_QHpointer
qh_free(qh_qhstat);
qh_qhstat= NULL;
#endif
} /* freestatistics */
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="initstatistics">-</a>
qh_initstatistics( )
allocate and initialize statistics
notes:
uses qh_malloc() instead of qh_memalloc() since mem.c not set up yet
NOerrors -- qh_initstatistics can not use qh_errexit(), qh_fprintf, or qh.ferr
On first call, only qhmem.ferr is defined. qh_memalloc is not setup.
Also invoked by QhullQh().
*/
void qh_initstatistics(void) {
int i;
realT realx;
int intx;
#if qh_QHpointer
if(qh_qhstat){ /* qh_initstatistics may be called from Qhull::resetStatistics() */
qh_free(qh_qhstat);
qh_qhstat= 0;
}
if (!(qh_qhstat= (qhstatT *)qh_malloc(sizeof(qhstatT)))) {
qh_fprintf_stderr(6183, "qhull error (qh_initstatistics): insufficient memory\n");
qh_exit(qh_ERRmem); /* can not use qh_errexit() */
}
#endif
qhstat next= 0;
qh_allstatA();
qh_allstatB();
qh_allstatC();
qh_allstatD();
qh_allstatE();
qh_allstatE2();
qh_allstatF();
qh_allstatG();
qh_allstatH();
qh_allstatI();
if (qhstat next > (int)sizeof(qhstat id)) {
qh_fprintf(qhmem.ferr, 6184, "qhull error (qh_initstatistics): increase size of qhstat.id[].\n\
qhstat.next %d should be <= sizeof(qhstat id) %d\n", qhstat next, (int)sizeof(qhstat id));
#if 0 /* for locating error, Znumridges should be duplicated */
for(i=0; i < ZEND; i++) {
int j;
for(j=i+1; j < ZEND; j++) {
if (qhstat id[i] == qhstat id[j]) {
qh_fprintf(qhmem.ferr, 6185, "qhull error (qh_initstatistics): duplicated statistic %d at indices %d and %d\n",
qhstat id[i], i, j);
}
}
}
#endif
qh_exit(qh_ERRqhull); /* can not use qh_errexit() */
}
qhstat init[zinc].i= 0;
qhstat init[zadd].i= 0;
qhstat init[zmin].i= INT_MAX;
qhstat init[zmax].i= INT_MIN;
qhstat init[wadd].r= 0;
qhstat init[wmin].r= REALmax;
qhstat init[wmax].r= -REALmax;
for(i=0; i < ZEND; i++) {
if (qhstat type[i] > ZTYPEreal) {
realx= qhstat init[(unsigned char)(qhstat type[i])].r;
qhstat stats[i].r= realx;
}else if (qhstat type[i] != zdoc) {
intx= qhstat init[(unsigned char)(qhstat type[i])].i;
qhstat stats[i].i= intx;
}
}
} /* initstatistics */
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="newstats">-</a>
qh_newstats( )
returns True if statistics for zdoc
returns:
next zdoc
*/
boolT qh_newstats(int idx, int *nextindex) {
boolT isnew= False;
int start, i;
if (qhstat type[qhstat id[idx]] == zdoc)
start= idx+1;
else
start= idx;
for(i= start; i < qhstat next && qhstat type[qhstat id[i]] != zdoc; i++) {
if (!qh_nostatistic(qhstat id[i]) && !qhstat printed[qhstat id[i]])
isnew= True;
}
*nextindex= i;
return isnew;
} /* newstats */
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="nostatistic">-</a>
qh_nostatistic( index )
true if no statistic to print
*/
boolT qh_nostatistic(int i) {
if ((qhstat type[i] > ZTYPEreal
&&qhstat stats[i].r == qhstat init[(unsigned char)(qhstat type[i])].r)
|| (qhstat type[i] < ZTYPEreal
&&qhstat stats[i].i == qhstat init[(unsigned char)(qhstat type[i])].i))
return True;
return False;
} /* nostatistic */
#if qh_KEEPstatistics
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="printallstatistics">-</a>
qh_printallstatistics( fp, string )
print all statistics with header 'string'
*/
void qh_printallstatistics(FILE *fp, const char *string) {
qh_allstatistics();
qh_collectstatistics();
qh_printstatistics(fp, string);
qh_memstatistics(fp);
}
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="printstatistics">-</a>
qh_printstatistics( fp, string )
print statistics to a file with header 'string'
skips statistics with qhstat.printed[] (reset with qh_allstatistics)
see:
qh_printallstatistics()
*/
void qh_printstatistics(FILE *fp, const char *string) {
int i, k;
realT ave;
if (qh num_points != qh num_vertices) {
wval_(Wpbalance)= 0;
wval_(Wpbalance2)= 0;
}else
wval_(Wpbalance2)= qh_stddev(zval_(Zpbalance), wval_(Wpbalance),
wval_(Wpbalance2), &ave);
wval_(Wnewbalance2)= qh_stddev(zval_(Zprocessed), wval_(Wnewbalance),
wval_(Wnewbalance2), &ave);
qh_fprintf(fp, 9350, "\n\
%s\n\
qhull invoked by: %s | %s\n%s with options:\n%s\n", string, qh rbox_command,
qh qhull_command, qh_version, qh qhull_options);
qh_fprintf(fp, 9351, "\nprecision constants:\n\
%6.2g max. abs. coordinate in the (transformed) input('Qbd:n')\n\
%6.2g max. roundoff error for distance computation('En')\n\
%6.2g max. roundoff error for angle computations\n\
%6.2g min. distance for outside points ('Wn')\n\
%6.2g min. distance for visible facets ('Vn')\n\
%6.2g max. distance for coplanar facets ('Un')\n\
%6.2g max. facet width for recomputing centrum and area\n\
",
qh MAXabs_coord, qh DISTround, qh ANGLEround, qh MINoutside,
qh MINvisible, qh MAXcoplanar, qh WIDEfacet);
if (qh KEEPnearinside)
qh_fprintf(fp, 9352, "\
%6.2g max. distance for near-inside points\n", qh NEARinside);
if (qh premerge_cos < REALmax/2) qh_fprintf(fp, 9353, "\
%6.2g max. cosine for pre-merge angle\n", qh premerge_cos);
if (qh PREmerge) qh_fprintf(fp, 9354, "\
%6.2g radius of pre-merge centrum\n", qh premerge_centrum);
if (qh postmerge_cos < REALmax/2) qh_fprintf(fp, 9355, "\
%6.2g max. cosine for post-merge angle\n", qh postmerge_cos);
if (qh POSTmerge) qh_fprintf(fp, 9356, "\
%6.2g radius of post-merge centrum\n", qh postmerge_centrum);
qh_fprintf(fp, 9357, "\
%6.2g max. distance for merging two simplicial facets\n\
%6.2g max. roundoff error for arithmetic operations\n\
%6.2g min. denominator for divisions\n\
zero diagonal for Gauss: ", qh ONEmerge, REALepsilon, qh MINdenom);
for(k=0; k < qh hull_dim; k++)
qh_fprintf(fp, 9358, "%6.2e ", qh NEARzero[k]);
qh_fprintf(fp, 9359, "\n\n");
for(i=0 ; i < qhstat next; )
qh_printstats(fp, i, &i);
} /* printstatistics */
#endif /* qh_KEEPstatistics */
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="printstatlevel">-</a>
qh_printstatlevel( fp, id )
print level information for a statistic
notes:
nop if id >= ZEND, printed, or same as initial value
*/
void qh_printstatlevel(FILE *fp, int id) {
#define NULLfield " "
if (id >= ZEND || qhstat printed[id])
return;
if (qhstat type[id] == zdoc) {
qh_fprintf(fp, 9360, "%s\n", qhstat doc[id]);
return;
}
if (qh_nostatistic(id) || !qhstat doc[id])
return;
qhstat printed[id]= True;
if (qhstat count[id] != -1
&& qhstat stats[(unsigned char)(qhstat count[id])].i == 0)
qh_fprintf(fp, 9361, " *0 cnt*");
else if (qhstat type[id] >= ZTYPEreal && qhstat count[id] == -1)
qh_fprintf(fp, 9362, "%7.2g", qhstat stats[id].r);
else if (qhstat type[id] >= ZTYPEreal && qhstat count[id] != -1)
qh_fprintf(fp, 9363, "%7.2g", qhstat stats[id].r/ qhstat stats[(unsigned char)(qhstat count[id])].i);
else if (qhstat type[id] < ZTYPEreal && qhstat count[id] == -1)
qh_fprintf(fp, 9364, "%7d", qhstat stats[id].i);
else if (qhstat type[id] < ZTYPEreal && qhstat count[id] != -1)
qh_fprintf(fp, 9365, "%7.3g", (realT) qhstat stats[id].i / qhstat stats[(unsigned char)(qhstat count[id])].i);
qh_fprintf(fp, 9366, " %s\n", qhstat doc[id]);
} /* printstatlevel */
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="printstats">-</a>
qh_printstats( fp, index, nextindex )
print statistics for a zdoc group
returns:
next zdoc if non-null
*/
void qh_printstats(FILE *fp, int idx, int *nextindex) {
int j, nexti;
if (qh_newstats(idx, &nexti)) {
qh_fprintf(fp, 9367, "\n");
for (j=idx; j<nexti; j++)
qh_printstatlevel(fp, qhstat id[j]);
}
if (nextindex)
*nextindex= nexti;
} /* printstats */
#if qh_KEEPstatistics
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="stddev">-</a>
qh_stddev( num, tot, tot2, ave )
compute the standard deviation and average from statistics
tot2 is the sum of the squares
notes:
computes r.m.s.:
(x-ave)^2
== x^2 - 2x tot/num + (tot/num)^2
== tot2 - 2 tot tot/num + tot tot/num
== tot2 - tot ave
*/
realT qh_stddev(int num, realT tot, realT tot2, realT *ave) {
realT stddev;
*ave= tot/num;
stddev= sqrt(tot2/num - *ave * *ave);
return stddev;
} /* stddev */
#endif /* qh_KEEPstatistics */
#if !qh_KEEPstatistics
void qh_collectstatistics(void) {}
void qh_printallstatistics(FILE *fp, char *string) {};
void qh_printstatistics(FILE *fp, char *string) {}
#endif

View File

@ -0,0 +1,543 @@
/*<html><pre> -<a href="qh-stat.htm"
>-------------------------------</a><a name="TOP">-</a>
stat.h
contains all statistics that are collected for qhull
see qh-stat.htm and stat.c
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull/stat.h#4 $$Change: 2062 $
$DateTime: 2016/01/17 13:13:18 $$Author: bbarber $
recompile qhull if you change this file
Integer statistics are Z* while real statistics are W*.
define maydebugx to call a routine at every statistic event
*/
#ifndef qhDEFstat
#define qhDEFstat 1
#include "libqhull.h"
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="KEEPstatistics">-</a>
qh_KEEPstatistics
0 turns off statistic gathering (except zzdef/zzinc/zzadd/zzval/wwval)
*/
#ifndef qh_KEEPstatistics
#define qh_KEEPstatistics 1
#endif
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="statistics">-</a>
Zxxx for integers, Wxxx for reals
notes:
be sure that all statistics are defined in stat.c
otherwise initialization may core dump
can pick up all statistics by:
grep '[zw].*_[(][ZW]' *.c >z.x
remove trailers with query">-</a>
remove leaders with query-replace-regexp [ ^I]+ (
*/
#if qh_KEEPstatistics
enum qh_statistics { /* alphabetical after Z/W */
Zacoplanar,
Wacoplanarmax,
Wacoplanartot,
Zangle,
Wangle,
Wanglemax,
Wanglemin,
Zangletests,
Wareatot,
Wareamax,
Wareamin,
Zavoidold,
Wavoidoldmax,
Wavoidoldtot,
Zback0,
Zbestcentrum,
Zbestdist,
Zbestlower,
Zbestlowerall,
Zbestloweralln,
Zbestlowerv,
Zcentrumtests,
Zcheckpart,
Zcomputefurthest,
Zconcave,
Wconcavemax,
Wconcavetot,
Zconcaveridges,
Zconcaveridge,
Zcoplanar,
Wcoplanarmax,
Wcoplanartot,
Zcoplanarangle,
Zcoplanarcentrum,
Zcoplanarhorizon,
Zcoplanarinside,
Zcoplanarpart,
Zcoplanarridges,
Wcpu,
Zcyclefacetmax,
Zcyclefacettot,
Zcyclehorizon,
Zcyclevertex,
Zdegen,
Wdegenmax,
Wdegentot,
Zdegenvertex,
Zdelfacetdup,
Zdelridge,
Zdelvertextot,
Zdelvertexmax,
Zdetsimplex,
Zdistcheck,
Zdistconvex,
Zdistgood,
Zdistio,
Zdistplane,
Zdiststat,
Zdistvertex,
Zdistzero,
Zdoc1,
Zdoc2,
Zdoc3,
Zdoc4,
Zdoc5,
Zdoc6,
Zdoc7,
Zdoc8,
Zdoc9,
Zdoc10,
Zdoc11,
Zdoc12,
Zdropdegen,
Zdropneighbor,
Zdupflip,
Zduplicate,
Wduplicatemax,
Wduplicatetot,
Zdupridge,
Zdupsame,
Zflipped,
Wflippedmax,
Wflippedtot,
Zflippedfacets,
Zfindbest,
Zfindbestmax,
Zfindbesttot,
Zfindcoplanar,
Zfindfail,
Zfindhorizon,
Zfindhorizonmax,
Zfindhorizontot,
Zfindjump,
Zfindnew,
Zfindnewmax,
Zfindnewtot,
Zfindnewjump,
Zfindnewsharp,
Zgauss0,
Zgoodfacet,
Zhashlookup,
Zhashridge,
Zhashridgetest,
Zhashtests,
Zinsidevisible,
Zintersect,
Zintersectfail,
Zintersectmax,
Zintersectnum,
Zintersecttot,
Zmaxneighbors,
Wmaxout,
Wmaxoutside,
Zmaxridges,
Zmaxvertex,
Zmaxvertices,
Zmaxvneighbors,
Zmemfacets,
Zmempoints,
Zmemridges,
Zmemvertices,
Zmergeflipdup,
Zmergehorizon,
Zmergeinittot,
Zmergeinitmax,
Zmergeinittot2,
Zmergeintohorizon,
Zmergenew,
Zmergesettot,
Zmergesetmax,
Zmergesettot2,
Zmergesimplex,
Zmergevertex,
Wmindenom,
Wminvertex,
Zminnorm,
Zmultiridge,
Znearlysingular,
Zneighbor,
Wnewbalance,
Wnewbalance2,
Znewfacettot,
Znewfacetmax,
Znewvertex,
Wnewvertex,
Wnewvertexmax,
Znoarea,
Znonsimplicial,
Znowsimplicial,
Znotgood,
Znotgoodnew,
Znotmax,
Znumfacets,
Znummergemax,
Znummergetot,
Znumneighbors,
Znumridges,
Znumvertices,
Znumvisibility,
Znumvneighbors,
Zonehorizon,
Zpartangle,
Zpartcoplanar,
Zpartflip,
Zparthorizon,
Zpartinside,
Zpartition,
Zpartitionall,
Zpartnear,
Zpbalance,
Wpbalance,
Wpbalance2,
Zpostfacets,
Zpremergetot,
Zprocessed,
Zremvertex,
Zremvertexdel,
Zrenameall,
Zrenamepinch,
Zrenameshare,
Zretry,
Wretrymax,
Zridge,
Wridge,
Wridgemax,
Zridge0,
Wridge0,
Wridge0max,
Zridgemid,
Wridgemid,
Wridgemidmax,
Zridgeok,
Wridgeok,
Wridgeokmax,
Zsearchpoints,
Zsetplane,
Ztestvneighbor,
Ztotcheck,
Ztothorizon,
Ztotmerge,
Ztotpartcoplanar,
Ztotpartition,
Ztotridges,
Ztotvertices,
Ztotvisible,
Ztricoplanar,
Ztricoplanarmax,
Ztricoplanartot,
Ztridegen,
Ztrimirror,
Ztrinull,
Wvertexmax,
Wvertexmin,
Zvertexridge,
Zvertexridgetot,
Zvertexridgemax,
Zvertices,
Zvisfacettot,
Zvisfacetmax,
Zvisit,
Zvisit2max,
Zvisvertextot,
Zvisvertexmax,
Zvvisit,
Zvvisit2max,
Zwidefacet,
Zwidevertices,
ZEND};
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="ZZstat">-</a>
Zxxx/Wxxx statistics that remain defined if qh_KEEPstatistics=0
notes:
be sure to use zzdef, zzinc, etc. with these statistics (no double checking!)
*/
#else
enum qh_statistics { /* for zzdef etc. macros */
Zback0,
Zbestdist,
Zcentrumtests,
Zcheckpart,
Zconcaveridges,
Zcoplanarhorizon,
Zcoplanarpart,
Zcoplanarridges,
Zcyclefacettot,
Zcyclehorizon,
Zdelvertextot,
Zdistcheck,
Zdistconvex,
Zdistzero,
Zdoc1,
Zdoc2,
Zdoc3,
Zdoc11,
Zflippedfacets,
Zgauss0,
Zminnorm,
Zmultiridge,
Znearlysingular,
Wnewvertexmax,
Znumvisibility,
Zpartcoplanar,
Zpartition,
Zpartitionall,
Zprocessed,
Zretry,
Zridge,
Wridge,
Wridgemax,
Zridge0,
Wridge0,
Wridge0max,
Zridgemid,
Wridgemid,
Wridgemidmax,
Zridgeok,
Wridgeok,
Wridgeokmax,
Zsetplane,
Ztotcheck,
Ztotmerge,
ZEND};
#endif
/*-<a href="qh-stat.htm#TOC"
>-------------------------------</a><a name="ztype">-</a>
ztype
the type of a statistic sets its initial value.
notes:
The type should be the same as the macro for collecting the statistic
*/
enum ztypes {zdoc,zinc,zadd,zmax,zmin,ZTYPEreal,wadd,wmax,wmin,ZTYPEend};
/*========== macros and constants =============*/
/*-<a href="qh-stat.htm#TOC"
>--------------------------------</a><a name="MAYdebugx">-</a>
MAYdebugx
define as maydebug() to be called frequently for error trapping
*/
#define MAYdebugx
/*-<a href="qh-stat.htm#TOC"
>--------------------------------</a><a name="zdef_">-</a>
zzdef_, zdef_( type, name, doc, -1)
define a statistic (assumes 'qhstat.next= 0;')
zdef_( type, name, doc, count)
define an averaged statistic
printed as name/count
*/
#define zzdef_(stype,name,string,cnt) qhstat id[qhstat next++]=name; \
qhstat doc[name]= string; qhstat count[name]= cnt; qhstat type[name]= stype
#if qh_KEEPstatistics
#define zdef_(stype,name,string,cnt) qhstat id[qhstat next++]=name; \
qhstat doc[name]= string; qhstat count[name]= cnt; qhstat type[name]= stype
#else
#define zdef_(type,name,doc,count)
#endif
/*-<a href="qh-stat.htm#TOC"
>--------------------------------</a><a name="zinc_">-</a>
zzinc_( name ), zinc_( name)
increment an integer statistic
*/
#define zzinc_(id) {MAYdebugx; qhstat stats[id].i++;}
#if qh_KEEPstatistics
#define zinc_(id) {MAYdebugx; qhstat stats[id].i++;}
#else
#define zinc_(id) {}
#endif
/*-<a href="qh-stat.htm#TOC"
>--------------------------------</a><a name="zadd_">-</a>
zzadd_( name, value ), zadd_( name, value ), wadd_( name, value )
add value to an integer or real statistic
*/
#define zzadd_(id, val) {MAYdebugx; qhstat stats[id].i += (val);}
#define wwadd_(id, val) {MAYdebugx; qhstat stats[id].r += (val);}
#if qh_KEEPstatistics
#define zadd_(id, val) {MAYdebugx; qhstat stats[id].i += (val);}
#define wadd_(id, val) {MAYdebugx; qhstat stats[id].r += (val);}
#else
#define zadd_(id, val) {}
#define wadd_(id, val) {}
#endif
/*-<a href="qh-stat.htm#TOC"
>--------------------------------</a><a name="zval_">-</a>
zzval_( name ), zval_( name ), wwval_( name )
set or return value of a statistic
*/
#define zzval_(id) ((qhstat stats[id]).i)
#define wwval_(id) ((qhstat stats[id]).r)
#if qh_KEEPstatistics
#define zval_(id) ((qhstat stats[id]).i)
#define wval_(id) ((qhstat stats[id]).r)
#else
#define zval_(id) qhstat tempi
#define wval_(id) qhstat tempr
#endif
/*-<a href="qh-stat.htm#TOC"
>--------------------------------</a><a name="zmax_">-</a>
zmax_( id, val ), wmax_( id, value )
maximize id with val
*/
#define wwmax_(id, val) {MAYdebugx; maximize_(qhstat stats[id].r,(val));}
#if qh_KEEPstatistics
#define zmax_(id, val) {MAYdebugx; maximize_(qhstat stats[id].i,(val));}
#define wmax_(id, val) {MAYdebugx; maximize_(qhstat stats[id].r,(val));}
#else
#define zmax_(id, val) {}
#define wmax_(id, val) {}
#endif
/*-<a href="qh-stat.htm#TOC"
>--------------------------------</a><a name="zmin_">-</a>
zmin_( id, val ), wmin_( id, value )
minimize id with val
*/
#if qh_KEEPstatistics
#define zmin_(id, val) {MAYdebugx; minimize_(qhstat stats[id].i,(val));}
#define wmin_(id, val) {MAYdebugx; minimize_(qhstat stats[id].r,(val));}
#else
#define zmin_(id, val) {}
#define wmin_(id, val) {}
#endif
/*================== stat.h types ==============*/
/*-<a href="qh-stat.htm#TOC"
>--------------------------------</a><a name="intrealT">-</a>
intrealT
union of integer and real, used for statistics
*/
typedef union intrealT intrealT; /* union of int and realT */
union intrealT {
int i;
realT r;
};
/*-<a href="qh-stat.htm#TOC"
>--------------------------------</a><a name="qhstat">-</a>
qhstat
global data structure for statistics, similar to qh and qhrbox
notes:
access to qh_qhstat is via the "qhstat" macro. There are two choices
qh_QHpointer = 1 access globals via a pointer
enables qh_saveqhull() and qh_restoreqhull()
= 0 qh_qhstat is a static data structure
only one instance of qhull() can be active at a time
default value
qh_QHpointer is defined in libqhull.h
qh_QHpointer_dllimport and qh_dllimport define qh_qh as __declspec(dllimport) [libqhull.h]
allocated in stat.c using qh_malloc()
*/
#ifndef DEFqhstatT
#define DEFqhstatT 1
typedef struct qhstatT qhstatT;
#endif
#if qh_QHpointer_dllimport
#define qhstat qh_qhstat->
__declspec(dllimport) extern qhstatT *qh_qhstat;
#elif qh_QHpointer
#define qhstat qh_qhstat->
extern qhstatT *qh_qhstat;
#elif qh_dllimport
#define qhstat qh_qhstat.
__declspec(dllimport) extern qhstatT qh_qhstat;
#else
#define qhstat qh_qhstat.
extern qhstatT qh_qhstat;
#endif
struct qhstatT {
intrealT stats[ZEND]; /* integer and real statistics */
unsigned char id[ZEND+10]; /* id's in print order */
const char *doc[ZEND]; /* array of documentation strings */
short int count[ZEND]; /* -1 if none, else index of count to use */
char type[ZEND]; /* type, see ztypes above */
char printed[ZEND]; /* true, if statistic has been printed */
intrealT init[ZTYPEend]; /* initial values by types, set initstatistics */
int next; /* next index for zdef_ */
int precision; /* index for precision problems */
int vridges; /* index for Voronoi ridges */
int tempi;
realT tempr;
};
/*========== function prototypes ===========*/
void qh_allstatA(void);
void qh_allstatB(void);
void qh_allstatC(void);
void qh_allstatD(void);
void qh_allstatE(void);
void qh_allstatE2(void);
void qh_allstatF(void);
void qh_allstatG(void);
void qh_allstatH(void);
void qh_allstatI(void);
void qh_allstatistics(void);
void qh_collectstatistics(void);
void qh_freestatistics(void);
void qh_initstatistics(void);
boolT qh_newstats(int idx, int *nextindex);
boolT qh_nostatistic(int i);
void qh_printallstatistics(FILE *fp, const char *string);
void qh_printstatistics(FILE *fp, const char *string);
void qh_printstatlevel(FILE *fp, int id);
void qh_printstats(FILE *fp, int idx, int *nextindex);
realT qh_stddev(int num, realT tot, realT tot2, realT *ave);
#endif /* qhDEFstat */

View File

@ -0,0 +1,538 @@
/*<html><pre> -<a href="qh-user.htm"
>-------------------------------</a><a name="TOP">-</a>
user.c
user redefinable functions
see user2.c for qh_fprintf, qh_malloc, qh_free
see README.txt see COPYING.txt for copyright information.
see libqhull.h for data structures, macros, and user-callable functions.
see user_eg.c, user_eg2.c, and unix.c for examples.
see user.h for user-definable constants
use qh_NOmem in mem.h to turn off memory management
use qh_NOmerge in user.h to turn off facet merging
set qh_KEEPstatistics in user.h to 0 to turn off statistics
This is unsupported software. You're welcome to make changes,
but you're on your own if something goes wrong. Use 'Tc' to
check frequently. Usually qhull will report an error if
a data structure becomes inconsistent. If so, it also reports
the last point added to the hull, e.g., 102. You can then trace
the execution of qhull with "T4P102".
Please report any errors that you fix to qhull@qhull.org
Qhull-template is a template for calling qhull from within your application
if you recompile and load this module, then user.o will not be loaded
from qhull.a
you can add additional quick allocation sizes in qh_user_memsizes
if the other functions here are redefined to not use qh_print...,
then io.o will not be loaded from qhull.a. See user_eg.c for an
example. We recommend keeping io.o for the extra debugging
information it supplies.
*/
#include "qhull_a.h"
#include <stdarg.h>
/*-<a href="qh-user.htm#TOC"
>-------------------------------</a><a name="qhull_template">-</a>
Qhull-template
Template for calling qhull from inside your program
returns:
exit code(see qh_ERR... in libqhull.h)
all memory freed
notes:
This can be called any number of times.
*/
#if 0
{
int dim; /* dimension of points */
int numpoints; /* number of points */
coordT *points; /* array of coordinates for each point */
boolT ismalloc; /* True if qhull should free points in qh_freeqhull() or reallocation */
char flags[]= "qhull Tv"; /* option flags for qhull, see qh_opt.htm */
FILE *outfile= stdout; /* output from qh_produce_output()
use NULL to skip qh_produce_output() */
FILE *errfile= stderr; /* error messages from qhull code */
int exitcode; /* 0 if no error from qhull */
facetT *facet; /* set by FORALLfacets */
int curlong, totlong; /* memory remaining after qh_memfreeshort */
QHULL_LIB_CHECK /* Check for compatible library */
#if qh_QHpointer /* see user.h */
if (qh_qh){ /* should be NULL */
qh_printf_stderr(6238, "Qhull link error. The global variable qh_qh was not initialized\n\
to NULL by global.c. Please compile this program with -Dqh_QHpointer_dllimport\n\
as well as -Dqh_QHpointer, or use libqhullstatic, or use a different tool chain.\n\n");
exit(1);
}
#endif
/* initialize dim, numpoints, points[], ismalloc here */
exitcode= qh_new_qhull(dim, numpoints, points, ismalloc,
flags, outfile, errfile);
if (!exitcode) { /* if no error */
/* 'qh facet_list' contains the convex hull */
FORALLfacets {
/* ... your code ... */
}
}
qh_freeqhull(!qh_ALL);
qh_memfreeshort(&curlong, &totlong);
if (curlong || totlong)
qh_fprintf(errfile, 7068, "qhull internal warning (main): did not free %d bytes of long memory(%d pieces)\n", totlong, curlong);
}
#endif
/*-<a href="qh-user.htm#TOC"
>-------------------------------</a><a name="new_qhull">-</a>
qh_new_qhull( dim, numpoints, points, ismalloc, qhull_cmd, outfile, errfile )
build new qhull data structure and return exitcode (0 if no errors)
if numpoints=0 and points=NULL, initializes qhull
notes:
do not modify points until finished with results.
The qhull data structure contains pointers into the points array.
do not call qhull functions before qh_new_qhull().
The qhull data structure is not initialized until qh_new_qhull().
Default errfile is stderr, outfile may be null
qhull_cmd must start with "qhull "
projects points to a new point array for Delaunay triangulations ('d' and 'v')
transforms points into a new point array for halfspace intersection ('H')
To allow multiple, concurrent calls to qhull()
- set qh_QHpointer in user.h
- use qh_save_qhull and qh_restore_qhull to swap the global data structure between calls.
- use qh_freeqhull(qh_ALL) to free intermediate convex hulls
see:
Qhull-template at the beginning of this file.
An example of using qh_new_qhull is user_eg.c
*/
int qh_new_qhull(int dim, int numpoints, coordT *points, boolT ismalloc,
char *qhull_cmd, FILE *outfile, FILE *errfile) {
/* 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 */
int exitcode, hulldim;
boolT new_ismalloc;
static boolT firstcall = True;
coordT *new_points;
if(!errfile){
errfile= stderr;
}
if (firstcall) {
qh_meminit(errfile);
firstcall= False;
} else {
qh_memcheck();
}
if (strncmp(qhull_cmd, "qhull ", (size_t)6)) {
qh_fprintf(errfile, 6186, "qhull error (qh_new_qhull): start qhull_cmd argument with \"qhull \"\n");
return qh_ERRinput;
}
qh_initqhull_start(NULL, outfile, errfile);
if(numpoints==0 && points==NULL){
trace1((qh ferr, 1047, "qh_new_qhull: initialize Qhull\n"));
return 0;
}
trace1((qh ferr, 1044, "qh_new_qhull: build new Qhull for %d %d-d points with %s\n", numpoints, dim, qhull_cmd));
exitcode = setjmp(qh errexit);
if (!exitcode)
{
qh NOerrexit = False;
qh_initflags(qhull_cmd);
if (qh DELAUNAY)
qh PROJECTdelaunay= True;
if (qh HALFspace) {
/* points is an array of halfspaces,
the last coordinate of each halfspace is its offset */
hulldim= dim-1;
qh_setfeasible(hulldim);
new_points= qh_sethalfspace_all(dim, numpoints, points, qh feasible_point);
new_ismalloc= True;
if (ismalloc)
qh_free(points);
}else {
hulldim= dim;
new_points= points;
new_ismalloc= ismalloc;
}
qh_init_B(new_points, numpoints, hulldim, new_ismalloc);
qh_qhull();
qh_check_output();
if (outfile) {
qh_produce_output();
}else {
qh_prepare_output();
}
if (qh VERIFYoutput && !qh STOPpoint && !qh STOPcone)
qh_check_points();
}
qh NOerrexit = True;
return exitcode;
} /* new_qhull */
/*-<a href="qh-user.htm#TOC"
>-------------------------------</a><a name="errexit">-</a>
qh_errexit( exitcode, facet, ridge )
report and exit from an error
report facet and ridge if non-NULL
reports useful information such as last point processed
set qh.FORCEoutput to print neighborhood of facet
see:
qh_errexit2() in libqhull.c for printing 2 facets
design:
check for error within error processing
compute qh.hulltime
print facet and ridge (if any)
report commandString, options, qh.furthest_id
print summary and statistics (including precision statistics)
if qh_ERRsingular
print help text for singular data set
exit program via long jump (if defined) or exit()
*/
void qh_errexit(int exitcode, facetT *facet, ridgeT *ridge) {
if (qh ERREXITcalled) {
qh_fprintf(qh ferr, 8126, "\nqhull error while processing previous error. Exit program\n");
qh_exit(qh_ERRqhull);
}
qh ERREXITcalled= True;
if (!qh QHULLfinished)
qh hulltime= qh_CPUclock - qh hulltime;
qh_errprint("ERRONEOUS", facet, NULL, ridge, NULL);
qh_fprintf(qh ferr, 8127, "\nWhile executing: %s | %s\n", qh rbox_command, qh qhull_command);
qh_fprintf(qh ferr, 8128, "Options selected for Qhull %s:\n%s\n", qh_version, qh qhull_options);
if (qh furthest_id >= 0) {
qh_fprintf(qh ferr, 8129, "Last point added to hull was p%d.", qh furthest_id);
if (zzval_(Ztotmerge))
qh_fprintf(qh ferr, 8130, " Last merge was #%d.", zzval_(Ztotmerge));
if (qh QHULLfinished)
qh_fprintf(qh ferr, 8131, "\nQhull has finished constructing the hull.");
else if (qh POSTmerging)
qh_fprintf(qh ferr, 8132, "\nQhull has started post-merging.");
qh_fprintf(qh ferr, 8133, "\n");
}
if (qh FORCEoutput && (qh QHULLfinished || (!facet && !ridge)))
qh_produce_output();
else if (exitcode != qh_ERRinput) {
if (exitcode != qh_ERRsingular && zzval_(Zsetplane) > qh hull_dim+1) {
qh_fprintf(qh ferr, 8134, "\nAt error exit:\n");
qh_printsummary(qh ferr);
if (qh PRINTstatistics) {
qh_collectstatistics();
qh_printstatistics(qh ferr, "at error exit");
qh_memstatistics(qh ferr);
}
}
if (qh PRINTprecision)
qh_printstats(qh ferr, qhstat precision, NULL);
}
if (!exitcode)
exitcode= qh_ERRqhull;
else if (exitcode == qh_ERRsingular)
qh_printhelp_singular(qh ferr);
else if (exitcode == qh_ERRprec && !qh PREmerge)
qh_printhelp_degenerate(qh ferr);
if (qh NOerrexit) {
qh_fprintf(qh ferr, 6187, "qhull error while ending program, or qh->NOerrexit not cleared after setjmp(). Exit program with error.\n");
qh_exit(qh_ERRqhull);
}
qh ERREXITcalled= False;
qh NOerrexit= True;
qh ALLOWrestart= False; /* longjmp will undo qh_build_withrestart */
longjmp(qh errexit, exitcode);
} /* errexit */
/*-<a href="qh-user.htm#TOC"
>-------------------------------</a><a name="errprint">-</a>
qh_errprint( fp, string, atfacet, otherfacet, atridge, atvertex )
prints out the information of facets and ridges to fp
also prints neighbors and geomview output
notes:
except for string, any parameter may be NULL
*/
void qh_errprint(const char *string, facetT *atfacet, facetT *otherfacet, ridgeT *atridge, vertexT *atvertex) {
int i;
if (atfacet) {
qh_fprintf(qh ferr, 8135, "%s FACET:\n", string);
qh_printfacet(qh ferr, atfacet);
}
if (otherfacet) {
qh_fprintf(qh ferr, 8136, "%s OTHER FACET:\n", string);
qh_printfacet(qh ferr, otherfacet);
}
if (atridge) {
qh_fprintf(qh ferr, 8137, "%s RIDGE:\n", string);
qh_printridge(qh ferr, atridge);
if (atridge->top && atridge->top != atfacet && atridge->top != otherfacet)
qh_printfacet(qh ferr, atridge->top);
if (atridge->bottom
&& atridge->bottom != atfacet && atridge->bottom != otherfacet)
qh_printfacet(qh ferr, atridge->bottom);
if (!atfacet)
atfacet= atridge->top;
if (!otherfacet)
otherfacet= otherfacet_(atridge, atfacet);
}
if (atvertex) {
qh_fprintf(qh ferr, 8138, "%s VERTEX:\n", string);
qh_printvertex(qh ferr, atvertex);
}
if (qh fout && qh FORCEoutput && atfacet && !qh QHULLfinished && !qh IStracing) {
qh_fprintf(qh ferr, 8139, "ERRONEOUS and NEIGHBORING FACETS to output\n");
for (i=0; i < qh_PRINTEND; i++) /* use fout for geomview output */
qh_printneighborhood(qh fout, qh PRINTout[i], atfacet, otherfacet,
!qh_ALL);
}
} /* errprint */
/*-<a href="qh-user.htm#TOC"
>-------------------------------</a><a name="printfacetlist">-</a>
qh_printfacetlist( fp, facetlist, facets, printall )
print all fields for a facet list and/or set of facets to fp
if !printall,
only prints good facets
notes:
also prints all vertices
*/
void qh_printfacetlist(facetT *facetlist, setT *facets, boolT printall) {
facetT *facet, **facetp;
qh_printbegin(qh ferr, qh_PRINTfacets, facetlist, facets, printall);
FORALLfacet_(facetlist)
qh_printafacet(qh ferr, qh_PRINTfacets, facet, printall);
FOREACHfacet_(facets)
qh_printafacet(qh ferr, qh_PRINTfacets, facet, printall);
qh_printend(qh ferr, qh_PRINTfacets, facetlist, facets, printall);
} /* printfacetlist */
/*-<a href="qh-io.htm#TOC"
>-------------------------------</a><a name="printhelp_degenerate">-</a>
qh_printhelp_degenerate( fp )
prints descriptive message for precision error
notes:
no message if qh_QUICKhelp
*/
void qh_printhelp_degenerate(FILE *fp) {
if (qh MERGEexact || qh PREmerge || qh JOGGLEmax < REALmax/2)
qh_fprintf(fp, 9368, "\n\
A Qhull error has occurred. Qhull should have corrected the above\n\
precision error. Please send the input and all of the output to\n\
qhull_bug@qhull.org\n");
else if (!qh_QUICKhelp) {
qh_fprintf(fp, 9369, "\n\
Precision problems were detected during construction of the convex hull.\n\
This occurs because convex hull algorithms assume that calculations are\n\
exact, but floating-point arithmetic has roundoff errors.\n\
\n\
To correct for precision problems, do not use 'Q0'. By default, Qhull\n\
selects 'C-0' or 'Qx' and merges non-convex facets. With option 'QJ',\n\
Qhull joggles the input to prevent precision problems. See \"Imprecision\n\
in Qhull\" (qh-impre.htm).\n\
\n\
If you use 'Q0', the output may include\n\
coplanar ridges, concave ridges, and flipped facets. In 4-d and higher,\n\
Qhull may produce a ridge with four neighbors or two facets with the same \n\
vertices. Qhull reports these events when they occur. It stops when a\n\
concave ridge, flipped facet, or duplicate facet occurs.\n");
#if REALfloat
qh_fprintf(fp, 9370, "\
\n\
Qhull is currently using single precision arithmetic. The following\n\
will probably remove the precision problems:\n\
- recompile qhull for realT precision(#define REALfloat 0 in user.h).\n");
#endif
if (qh DELAUNAY && !qh SCALElast && qh MAXabs_coord > 1e4)
qh_fprintf(fp, 9371, "\
\n\
When computing the Delaunay triangulation of coordinates > 1.0,\n\
- use 'Qbb' to scale the last coordinate to [0,m] (max previous coordinate)\n");
if (qh DELAUNAY && !qh ATinfinity)
qh_fprintf(fp, 9372, "\
When computing the Delaunay triangulation:\n\
- use 'Qz' to add a point at-infinity. This reduces precision problems.\n");
qh_fprintf(fp, 9373, "\
\n\
If you need triangular output:\n\
- use option 'Qt' to triangulate the output\n\
- use option 'QJ' to joggle the input points and remove precision errors\n\
- use option 'Ft'. It triangulates non-simplicial facets with added points.\n\
\n\
If you must use 'Q0',\n\
try one or more of the following options. They can not guarantee an output.\n\
- use 'QbB' to scale the input to a cube.\n\
- use 'Po' to produce output and prevent partitioning for flipped facets\n\
- use 'V0' to set min. distance to visible facet as 0 instead of roundoff\n\
- use 'En' to specify a maximum roundoff error less than %2.2g.\n\
- options 'Qf', 'Qbb', and 'QR0' may also help\n",
qh DISTround);
qh_fprintf(fp, 9374, "\
\n\
To guarantee simplicial output:\n\
- use option 'Qt' to triangulate the output\n\
- use option 'QJ' to joggle the input points and remove precision errors\n\
- use option 'Ft' to triangulate the output by adding points\n\
- use exact arithmetic (see \"Imprecision in Qhull\", qh-impre.htm)\n\
");
}
} /* printhelp_degenerate */
/*-<a href="qh-globa.htm#TOC"
>-------------------------------</a><a name="printhelp_narrowhull">-</a>
qh_printhelp_narrowhull( minangle )
Warn about a narrow hull
notes:
Alternatively, reduce qh_WARNnarrow in user.h
*/
void qh_printhelp_narrowhull(FILE *fp, realT minangle) {
qh_fprintf(fp, 9375, "qhull precision warning: \n\
The initial hull is narrow (cosine of min. angle is %.16f).\n\
Is the input lower dimensional (e.g., on a plane in 3-d)? Qhull may\n\
produce a wide facet. Options 'QbB' (scale to unit box) or 'Qbb' (scale\n\
last coordinate) may remove this warning. Use 'Pp' to skip this warning.\n\
See 'Limitations' in qh-impre.htm.\n",
-minangle); /* convert from angle between normals to angle between facets */
} /* printhelp_narrowhull */
/*-<a href="qh-io.htm#TOC"
>-------------------------------</a><a name="printhelp_singular">-</a>
qh_printhelp_singular( fp )
prints descriptive message for singular input
*/
void qh_printhelp_singular(FILE *fp) {
facetT *facet;
vertexT *vertex, **vertexp;
realT min, max, *coord, dist;
int i,k;
qh_fprintf(fp, 9376, "\n\
The input to qhull appears to be less than %d dimensional, or a\n\
computation has overflowed.\n\n\
Qhull could not construct a clearly convex simplex from points:\n",
qh hull_dim);
qh_printvertexlist(fp, "", qh facet_list, NULL, qh_ALL);
if (!qh_QUICKhelp)
qh_fprintf(fp, 9377, "\n\
The center point is coplanar with a facet, or a vertex is coplanar\n\
with a neighboring facet. The maximum round off error for\n\
computing distances is %2.2g. The center point, facets and distances\n\
to the center point are as follows:\n\n", qh DISTround);
qh_printpointid(fp, "center point", qh hull_dim, qh interior_point, qh_IDunknown);
qh_fprintf(fp, 9378, "\n");
FORALLfacets {
qh_fprintf(fp, 9379, "facet");
FOREACHvertex_(facet->vertices)
qh_fprintf(fp, 9380, " p%d", qh_pointid(vertex->point));
zinc_(Zdistio);
qh_distplane(qh interior_point, facet, &dist);
qh_fprintf(fp, 9381, " distance= %4.2g\n", dist);
}
if (!qh_QUICKhelp) {
if (qh HALFspace)
qh_fprintf(fp, 9382, "\n\
These points are the dual of the given halfspaces. They indicate that\n\
the intersection is degenerate.\n");
qh_fprintf(fp, 9383,"\n\
These points either have a maximum or minimum x-coordinate, or\n\
they maximize the determinant for k coordinates. Trial points\n\
are first selected from points that maximize a coordinate.\n");
if (qh hull_dim >= qh_INITIALmax)
qh_fprintf(fp, 9384, "\n\
Because of the high dimension, the min x-coordinate and max-coordinate\n\
points are used if the determinant is non-zero. Option 'Qs' will\n\
do a better, though much slower, job. Instead of 'Qs', you can change\n\
the points by randomly rotating the input with 'QR0'.\n");
}
qh_fprintf(fp, 9385, "\nThe min and max coordinates for each dimension are:\n");
for (k=0; k < qh hull_dim; k++) {
min= REALmax;
max= -REALmin;
for (i=qh num_points, coord= qh first_point+k; i--; coord += qh hull_dim) {
maximize_(max, *coord);
minimize_(min, *coord);
}
qh_fprintf(fp, 9386, " %d: %8.4g %8.4g difference= %4.4g\n", k, min, max, max-min);
}
if (!qh_QUICKhelp) {
qh_fprintf(fp, 9387, "\n\
If the input should be full dimensional, you have several options that\n\
may determine an initial simplex:\n\
- use 'QJ' to joggle the input and make it full dimensional\n\
- use 'QbB' to scale the points to the unit cube\n\
- use 'QR0' to randomly rotate the input for different maximum points\n\
- use 'Qs' to search all points for the initial simplex\n\
- use 'En' to specify a maximum roundoff error less than %2.2g.\n\
- trace execution with 'T3' to see the determinant for each point.\n",
qh DISTround);
#if REALfloat
qh_fprintf(fp, 9388, "\
- recompile qhull for realT precision(#define REALfloat 0 in libqhull.h).\n");
#endif
qh_fprintf(fp, 9389, "\n\
If the input is lower dimensional:\n\
- use 'QJ' to joggle the input and make it full dimensional\n\
- use 'Qbk:0Bk:0' to delete coordinate k from the input. You should\n\
pick the coordinate with the least range. The hull will have the\n\
correct topology.\n\
- determine the flat containing the points, rotate the points\n\
into a coordinate plane, and delete the other coordinates.\n\
- add one or more points to make the input full dimensional.\n\
");
}
} /* printhelp_singular */
/*-<a href="qh-globa.htm#TOC"
>-------------------------------</a><a name="user_memsizes">-</a>
qh_user_memsizes()
allocate up to 10 additional, quick allocation sizes
notes:
increase maximum number of allocations in qh_initqhull_mem()
*/
void qh_user_memsizes(void) {
/* qh_memsize(size); */
} /* user_memsizes */

View File

@ -0,0 +1,909 @@
/*<html><pre> -<a href="qh-user.htm"
>-------------------------------</a><a name="TOP">-</a>
user.h
user redefinable constants
for each source file, user.h is included first
see qh-user.htm. see COPYING for copyright information.
See user.c for sample code.
before reading any code, review libqhull.h for data structure definitions and
the "qh" macro.
Sections:
============= qhull library constants ======================
============= data types and configuration macros ==========
============= performance related constants ================
============= memory constants =============================
============= joggle constants =============================
============= conditional compilation ======================
============= -merge constants- ============================
Code flags --
NOerrors -- the code does not call qh_errexit()
WARN64 -- the code may be incompatible with 64-bit pointers
*/
#include <time.h>
#ifndef qhDEFuser
#define qhDEFuser 1
/* Derived from Qt's corelib/global/qglobal.h */
#if !defined(SAG_COM) && !defined(__CYGWIN__) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
# define QHULL_OS_WIN
#elif defined(__MWERKS__) && defined(__INTEL__) /* Metrowerks discontinued before the release of Intel Macs */
# define QHULL_OS_WIN
#endif
/*============================================================*/
/*============= qhull library constants ======================*/
/*============================================================*/
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="filenamelen">-</a>
FILENAMElen -- max length for TI and TO filenames
*/
#define qh_FILENAMElen 500
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="msgcode">-</a>
msgcode -- Unique message codes for qh_fprintf
If add new messages, assign these values and increment in user.h and user_r.h
See QhullError.h for 10000 errors.
def counters = [27, 1048, 2059, 3026, 4068, 5003,
6273, 7081, 8147, 9411, 10000, 11029]
See: qh_ERR* [libqhull.h]
*/
#define MSG_TRACE0 0
#define MSG_TRACE1 1000
#define MSG_TRACE2 2000
#define MSG_TRACE3 3000
#define MSG_TRACE4 4000
#define MSG_TRACE5 5000
#define MSG_ERROR 6000 /* errors written to qh.ferr */
#define MSG_WARNING 7000
#define MSG_STDERR 8000 /* log messages Written to qh.ferr */
#define MSG_OUTPUT 9000
#define MSG_QHULL_ERROR 10000 /* errors thrown by QhullError.cpp (QHULLlastError is in QhullError.h) */
#define MSG_FIXUP 11000 /* FIXUP QH11... */
#define MSG_MAXLEN 3000 /* qh_printhelp_degenerate() in user.c */
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="qh_OPTIONline">-</a>
qh_OPTIONline -- max length of an option line 'FO'
*/
#define qh_OPTIONline 80
/*============================================================*/
/*============= data types and configuration macros ==========*/
/*============================================================*/
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="realT">-</a>
realT
set the size of floating point numbers
qh_REALdigits
maximimum number of significant digits
qh_REAL_1, qh_REAL_2n, qh_REAL_3n
format strings for printf
qh_REALmax, qh_REALmin
maximum and minimum (near zero) values
qh_REALepsilon
machine roundoff. Maximum roundoff error for addition and multiplication.
notes:
Select whether to store floating point numbers in single precision (float)
or double precision (double).
Use 'float' to save about 8% in time and 25% in space. This is particularly
helpful if high-d where convex hulls are space limited. Using 'float' also
reduces the printed size of Qhull's output since numbers have 8 digits of
precision.
Use 'double' when greater arithmetic precision is needed. This is needed
for Delaunay triangulations and Voronoi diagrams when you are not merging
facets.
If 'double' gives insufficient precision, your data probably includes
degeneracies. If so you should use facet merging (done by default)
or exact arithmetic (see imprecision section of manual, qh-impre.htm).
You may also use option 'Po' to force output despite precision errors.
You may use 'long double', but many format statements need to be changed
and you may need a 'long double' square root routine. S. Grundmann
(sg@eeiwzb.et.tu-dresden.de) has done this. He reports that the code runs
much slower with little gain in precision.
WARNING: on some machines, int f(){realT a= REALmax;return (a == REALmax);}
returns False. Use (a > REALmax/2) instead of (a == REALmax).
REALfloat = 1 all numbers are 'float' type
= 0 all numbers are 'double' type
*/
#define REALfloat 0
#if (REALfloat == 1)
#define realT float
#define REALmax FLT_MAX
#define REALmin FLT_MIN
#define REALepsilon FLT_EPSILON
#define qh_REALdigits 8 /* maximum number of significant digits */
#define qh_REAL_1 "%6.8g "
#define qh_REAL_2n "%6.8g %6.8g\n"
#define qh_REAL_3n "%6.8g %6.8g %6.8g\n"
#elif (REALfloat == 0)
#define realT double
#define REALmax DBL_MAX
#define REALmin DBL_MIN
#define REALepsilon DBL_EPSILON
#define qh_REALdigits 16 /* maximum number of significant digits */
#define qh_REAL_1 "%6.16g "
#define qh_REAL_2n "%6.16g %6.16g\n"
#define qh_REAL_3n "%6.16g %6.16g %6.16g\n"
#else
#error unknown float option
#endif
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="CPUclock">-</a>
qh_CPUclock
define the clock() function for reporting the total time spent by Qhull
returns CPU ticks as a 'long int'
qh_CPUclock is only used for reporting the total time spent by Qhull
qh_SECticks
the number of clock ticks per second
notes:
looks for CLOCKS_PER_SEC, CLOCKS_PER_SECOND, or assumes microseconds
to define a custom clock, set qh_CLOCKtype to 0
if your system does not use clock() to return CPU ticks, replace
qh_CPUclock with the corresponding function. It is converted
to 'unsigned long' to prevent wrap-around during long runs. By default,
<time.h> defines clock_t as 'long'
Set qh_CLOCKtype to
1 for CLOCKS_PER_SEC, CLOCKS_PER_SECOND, or microsecond
Note: may fail if more than 1 hour elapsed time
2 use qh_clock() with POSIX times() (see global.c)
*/
#define qh_CLOCKtype 1 /* change to the desired number */
#if (qh_CLOCKtype == 1)
#if defined(CLOCKS_PER_SECOND)
#define qh_CPUclock ((unsigned long)clock()) /* return CPU clock */
#define qh_SECticks CLOCKS_PER_SECOND
#elif defined(CLOCKS_PER_SEC)
#define qh_CPUclock ((unsigned long)clock()) /* return CPU clock */
#define qh_SECticks CLOCKS_PER_SEC
#elif defined(CLK_TCK)
#define qh_CPUclock ((unsigned long)clock()) /* return CPU clock */
#define qh_SECticks CLK_TCK
#else
#define qh_CPUclock ((unsigned long)clock()) /* return CPU clock */
#define qh_SECticks 1E6
#endif
#elif (qh_CLOCKtype == 2)
#define qh_CPUclock qh_clock() /* return CPU clock */
#define qh_SECticks 100
#else /* qh_CLOCKtype == ? */
#error unknown clock option
#endif
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="RANDOM">-</a>
qh_RANDOMtype, qh_RANDOMmax, qh_RANDOMseed
define random number generator
qh_RANDOMint generates a random integer between 0 and qh_RANDOMmax.
qh_RANDOMseed sets the random number seed for qh_RANDOMint
Set qh_RANDOMtype (default 5) to:
1 for random() with 31 bits (UCB)
2 for rand() with RAND_MAX or 15 bits (system 5)
3 for rand() with 31 bits (Sun)
4 for lrand48() with 31 bits (Solaris)
5 for qh_rand() with 31 bits (included with Qhull)
notes:
Random numbers are used by rbox to generate point sets. Random
numbers are used by Qhull to rotate the input ('QRn' option),
simulate a randomized algorithm ('Qr' option), and to simulate
roundoff errors ('Rn' option).
Random number generators differ between systems. Most systems provide
rand() but the period varies. The period of rand() is not critical
since qhull does not normally use random numbers.
The default generator is Park & Miller's minimal standard random
number generator [CACM 31:1195 '88]. It is included with Qhull.
If qh_RANDOMmax is wrong, qhull will report a warning and Geomview
output will likely be invisible.
*/
#define qh_RANDOMtype 5 /* *** change to the desired number *** */
#if (qh_RANDOMtype == 1)
#define qh_RANDOMmax ((realT)0x7fffffffUL) /* 31 bits, random()/MAX */
#define qh_RANDOMint random()
#define qh_RANDOMseed_(seed) srandom(seed);
#elif (qh_RANDOMtype == 2)
#ifdef RAND_MAX
#define qh_RANDOMmax ((realT)RAND_MAX)
#else
#define qh_RANDOMmax ((realT)32767) /* 15 bits (System 5) */
#endif
#define qh_RANDOMint rand()
#define qh_RANDOMseed_(seed) srand((unsigned)seed);
#elif (qh_RANDOMtype == 3)
#define qh_RANDOMmax ((realT)0x7fffffffUL) /* 31 bits, Sun */
#define qh_RANDOMint rand()
#define qh_RANDOMseed_(seed) srand((unsigned)seed);
#elif (qh_RANDOMtype == 4)
#define qh_RANDOMmax ((realT)0x7fffffffUL) /* 31 bits, lrand38()/MAX */
#define qh_RANDOMint lrand48()
#define qh_RANDOMseed_(seed) srand48(seed);
#elif (qh_RANDOMtype == 5)
#define qh_RANDOMmax ((realT)2147483646UL) /* 31 bits, qh_rand/MAX */
#define qh_RANDOMint qh_rand()
#define qh_RANDOMseed_(seed) qh_srand(seed);
/* unlike rand(), never returns 0 */
#else
#error: unknown random option
#endif
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="ORIENTclock">-</a>
qh_ORIENTclock
0 for inward pointing normals by Geomview convention
*/
#define qh_ORIENTclock 0
/*============================================================*/
/*============= joggle constants =============================*/
/*============================================================*/
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="JOGGLEdefault">-</a>
qh_JOGGLEdefault
default qh.JOGGLEmax is qh.DISTround * qh_JOGGLEdefault
notes:
rbox s r 100 | qhull QJ1e-15 QR0 generates 90% faults at distround 7e-16
rbox s r 100 | qhull QJ1e-14 QR0 generates 70% faults
rbox s r 100 | qhull QJ1e-13 QR0 generates 35% faults
rbox s r 100 | qhull QJ1e-12 QR0 generates 8% faults
rbox s r 100 | qhull QJ1e-11 QR0 generates 1% faults
rbox s r 100 | qhull QJ1e-10 QR0 generates 0% faults
rbox 1000 W0 | qhull QJ1e-12 QR0 generates 86% faults
rbox 1000 W0 | qhull QJ1e-11 QR0 generates 20% faults
rbox 1000 W0 | qhull QJ1e-10 QR0 generates 2% faults
the later have about 20 points per facet, each of which may interfere
pick a value large enough to avoid retries on most inputs
*/
#define qh_JOGGLEdefault 30000.0
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="JOGGLEincrease">-</a>
qh_JOGGLEincrease
factor to increase qh.JOGGLEmax on qh_JOGGLEretry or qh_JOGGLEagain
*/
#define qh_JOGGLEincrease 10.0
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="JOGGLEretry">-</a>
qh_JOGGLEretry
if ZZretry = qh_JOGGLEretry, increase qh.JOGGLEmax
notes:
try twice at the original value in case of bad luck the first time
*/
#define qh_JOGGLEretry 2
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="JOGGLEagain">-</a>
qh_JOGGLEagain
every following qh_JOGGLEagain, increase qh.JOGGLEmax
notes:
1 is OK since it's already failed qh_JOGGLEretry times
*/
#define qh_JOGGLEagain 1
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="JOGGLEmaxincrease">-</a>
qh_JOGGLEmaxincrease
maximum qh.JOGGLEmax due to qh_JOGGLEincrease
relative to qh.MAXwidth
notes:
qh.joggleinput will retry at this value until qh_JOGGLEmaxretry
*/
#define qh_JOGGLEmaxincrease 1e-2
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="JOGGLEmaxretry">-</a>
qh_JOGGLEmaxretry
stop after qh_JOGGLEmaxretry attempts
*/
#define qh_JOGGLEmaxretry 100
/*============================================================*/
/*============= performance related constants ================*/
/*============================================================*/
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="HASHfactor">-</a>
qh_HASHfactor
total hash slots / used hash slots. Must be at least 1.1.
notes:
=2 for at worst 50% occupancy for qh.hash_table and normally 25% occupancy
*/
#define qh_HASHfactor 2
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="VERIFYdirect">-</a>
qh_VERIFYdirect
with 'Tv' verify all points against all facets if op count is smaller
notes:
if greater, calls qh_check_bestdist() instead
*/
#define qh_VERIFYdirect 1000000
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="INITIALsearch">-</a>
qh_INITIALsearch
if qh_INITIALmax, search points up to this dimension
*/
#define qh_INITIALsearch 6
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="INITIALmax">-</a>
qh_INITIALmax
if dim >= qh_INITIALmax, use min/max coordinate points for initial simplex
notes:
from points with non-zero determinants
use option 'Qs' to override (much slower)
*/
#define qh_INITIALmax 8
/*============================================================*/
/*============= memory constants =============================*/
/*============================================================*/
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="MEMalign">-</a>
qh_MEMalign
memory alignment for qh_meminitbuffers() in global.c
notes:
to avoid bus errors, memory allocation must consider alignment requirements.
malloc() automatically takes care of alignment. Since mem.c manages
its own memory, we need to explicitly specify alignment in
qh_meminitbuffers().
A safe choice is sizeof(double). sizeof(float) may be used if doubles
do not occur in data structures and pointers are the same size. Be careful
of machines (e.g., DEC Alpha) with large pointers.
If using gcc, best alignment is [fmax_() is defined in geom_r.h]
#define qh_MEMalign fmax_(__alignof__(realT),__alignof__(void *))
*/
#define qh_MEMalign ((int)(fmax_(sizeof(realT), sizeof(void *))))
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="MEMbufsize">-</a>
qh_MEMbufsize
size of additional memory buffers
notes:
used for qh_meminitbuffers() in global.c
*/
#define qh_MEMbufsize 0x10000 /* allocate 64K memory buffers */
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="MEMinitbuf">-</a>
qh_MEMinitbuf
size of initial memory buffer
notes:
use for qh_meminitbuffers() in global.c
*/
#define qh_MEMinitbuf 0x20000 /* initially allocate 128K buffer */
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="INFINITE">-</a>
qh_INFINITE
on output, indicates Voronoi center at infinity
*/
#define qh_INFINITE -10.101
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="DEFAULTbox">-</a>
qh_DEFAULTbox
default box size (Geomview expects 0.5)
qh_DEFAULTbox
default box size for integer coorindate (rbox only)
*/
#define qh_DEFAULTbox 0.5
#define qh_DEFAULTzbox 1e6
/*============================================================*/
/*============= conditional compilation ======================*/
/*============================================================*/
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="compiler">-</a>
__cplusplus
defined by C++ compilers
__MSC_VER
defined by Microsoft Visual C++
__MWERKS__ && __INTEL__
defined by Metrowerks when compiling for Windows (not Intel-based Macintosh)
__MWERKS__ && __POWERPC__
defined by Metrowerks when compiling for PowerPC-based Macintosh
__STDC__
defined for strict ANSI C
*/
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="COMPUTEfurthest">-</a>
qh_COMPUTEfurthest
compute furthest distance to an outside point instead of storing it with the facet
=1 to compute furthest
notes:
computing furthest saves memory but costs time
about 40% more distance tests for partitioning
removes facet->furthestdist
*/
#define qh_COMPUTEfurthest 0
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="KEEPstatistics">-</a>
qh_KEEPstatistics
=0 removes most of statistic gathering and reporting
notes:
if 0, code size is reduced by about 4%.
*/
#define qh_KEEPstatistics 1
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="MAXoutside">-</a>
qh_MAXoutside
record outer plane for each facet
=1 to record facet->maxoutside
notes:
this takes a realT per facet and slightly slows down qhull
it produces better outer planes for geomview output
*/
#define qh_MAXoutside 1
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="NOmerge">-</a>
qh_NOmerge
disables facet merging if defined
notes:
This saves about 10% space.
Unless 'Q0'
qh_NOmerge sets 'QJ' to avoid precision errors
#define qh_NOmerge
see:
<a href="mem.h#NOmem">qh_NOmem</a> in mem.c
see user.c/user_eg.c for removing io.o
*/
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="NOtrace">-</a>
qh_NOtrace
no tracing if defined
notes:
This saves about 5% space.
#define qh_NOtrace
*/
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="QHpointer">-</a>
qh_QHpointer
access global data with pointer or static structure
qh_QHpointer = 1 access globals via a pointer to allocated memory
enables qh_saveqhull() and qh_restoreqhull()
[2010, gcc] costs about 4% in time and 4% in space
[2003, msvc] costs about 8% in time and 2% in space
= 0 qh_qh and qh_qhstat are static data structures
only one instance of qhull() can be active at a time
default value
qh_QHpointer_dllimport and qh_dllimport define qh_qh as __declspec(dllimport) [libqhull.h]
It is required for msvc-2005. It is not needed for gcc.
notes:
[jan'16] qh_QHpointer is deprecated for Qhull. Use libqhull_r instead.
all global variables for qhull are in qh, qhmem, and qhstat
qh is defined in libqhull.h
qhmem is defined in mem.h
qhstat is defined in stat.h
*/
#ifdef qh_QHpointer
#if qh_dllimport
#error QH6207 Qhull error: Use qh_QHpointer_dllimport instead of qh_dllimport with qh_QHpointer
#endif
#else
#define qh_QHpointer 0
#if qh_QHpointer_dllimport
#error QH6234 Qhull error: Use qh_dllimport instead of qh_QHpointer_dllimport when qh_QHpointer is not defined
#endif
#endif
#if 0 /* sample code */
qhT *oldqhA, *oldqhB;
exitcode= qh_new_qhull(dim, numpoints, points, ismalloc,
flags, outfile, errfile);
/* use results from first call to qh_new_qhull */
oldqhA= qh_save_qhull();
exitcode= qh_new_qhull(dimB, numpointsB, pointsB, ismalloc,
flags, outfile, errfile);
/* use results from second call to qh_new_qhull */
oldqhB= qh_save_qhull();
qh_restore_qhull(&oldqhA);
/* use results from first call to qh_new_qhull */
qh_freeqhull(qh_ALL); /* frees all memory used by first call */
qh_restore_qhull(&oldqhB);
/* use results from second call to qh_new_qhull */
qh_freeqhull(!qh_ALL); /* frees long memory used by second call */
qh_memfreeshort(&curlong, &totlong); /* frees short memory and memory allocator */
#endif
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="QUICKhelp">-</a>
qh_QUICKhelp
=1 to use abbreviated help messages, e.g., for degenerate inputs
*/
#define qh_QUICKhelp 0
/*============================================================*/
/*============= -merge constants- ============================*/
/*============================================================*/
/*
These constants effect facet merging. You probably will not need
to modify them. They effect the performance of facet merging.
*/
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="DIMmergeVertex">-</a>
qh_DIMmergeVertex
max dimension for vertex merging (it is not effective in high-d)
*/
#define qh_DIMmergeVertex 6
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="DIMreduceBuild">-</a>
qh_DIMreduceBuild
max dimension for vertex reduction during build (slow in high-d)
*/
#define qh_DIMreduceBuild 5
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="BESTcentrum">-</a>
qh_BESTcentrum
if > 2*dim+n vertices, qh_findbestneighbor() tests centrums (faster)
else, qh_findbestneighbor() tests all vertices (much better merges)
qh_BESTcentrum2
if qh_BESTcentrum2 * DIM3 + BESTcentrum < #vertices tests centrums
*/
#define qh_BESTcentrum 20
#define qh_BESTcentrum2 2
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="BESTnonconvex">-</a>
qh_BESTnonconvex
if > dim+n neighbors, qh_findbestneighbor() tests nonconvex ridges.
notes:
It is needed because qh_findbestneighbor is slow for large facets
*/
#define qh_BESTnonconvex 15
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="MAXnewmerges">-</a>
qh_MAXnewmerges
if >n newmerges, qh_merge_nonconvex() calls qh_reducevertices_centrums.
notes:
It is needed because postmerge can merge many facets at once
*/
#define qh_MAXnewmerges 2
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="MAXnewcentrum">-</a>
qh_MAXnewcentrum
if <= dim+n vertices (n approximates the number of merges),
reset the centrum in qh_updatetested() and qh_mergecycle_facets()
notes:
needed to reduce cost and because centrums may move too much if
many vertices in high-d
*/
#define qh_MAXnewcentrum 5
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="COPLANARratio">-</a>
qh_COPLANARratio
for 3-d+ merging, qh.MINvisible is n*premerge_centrum
notes:
for non-merging, it's DISTround
*/
#define qh_COPLANARratio 3
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="DISToutside">-</a>
qh_DISToutside
When is a point clearly outside of a facet?
Stops search in qh_findbestnew or qh_partitionall
qh_findbest uses qh.MINoutside since since it is only called if no merges.
notes:
'Qf' always searches for best facet
if !qh.MERGING, same as qh.MINoutside.
if qh_USEfindbestnew, increase value since neighboring facets may be ill-behaved
[Note: Zdelvertextot occurs normally with interior points]
RBOX 1000 s Z1 G1e-13 t1001188774 | QHULL Tv
When there is a sharp edge, need to move points to a
clearly good facet; otherwise may be lost in another partitioning.
if too big then O(n^2) behavior for partitioning in cone
if very small then important points not processed
Needed in qh_partitionall for
RBOX 1000 s Z1 G1e-13 t1001032651 | QHULL Tv
Needed in qh_findbestnew for many instances of
RBOX 1000 s Z1 G1e-13 t | QHULL Tv
See:
qh_DISToutside -- when is a point clearly outside of a facet
qh_SEARCHdist -- when is facet coplanar with the best facet?
qh_USEfindbestnew -- when to use qh_findbestnew for qh_partitionpoint()
*/
#define qh_DISToutside ((qh_USEfindbestnew ? 2 : 1) * \
fmax_((qh MERGING ? 2 : 1)*qh MINoutside, qh max_outside))
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="RATIOnearinside">-</a>
qh_RATIOnearinside
ratio of qh.NEARinside to qh.ONEmerge for retaining inside points for
qh_check_maxout().
notes:
This is overkill since do not know the correct value.
It effects whether 'Qc' reports all coplanar points
Not used for 'd' since non-extreme points are coplanar
*/
#define qh_RATIOnearinside 5
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="SEARCHdist">-</a>
qh_SEARCHdist
When is a facet coplanar with the best facet?
qh_findbesthorizon: all coplanar facets of the best facet need to be searched.
See:
qh_DISToutside -- when is a point clearly outside of a facet
qh_SEARCHdist -- when is facet coplanar with the best facet?
qh_USEfindbestnew -- when to use qh_findbestnew for qh_partitionpoint()
*/
#define qh_SEARCHdist ((qh_USEfindbestnew ? 2 : 1) * \
(qh max_outside + 2 * qh DISTround + fmax_( qh MINvisible, qh MAXcoplanar)));
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="USEfindbestnew">-</a>
qh_USEfindbestnew
Always use qh_findbestnew for qh_partitionpoint, otherwise use
qh_findbestnew if merged new facet or sharpnewfacets.
See:
qh_DISToutside -- when is a point clearly outside of a facet
qh_SEARCHdist -- when is facet coplanar with the best facet?
qh_USEfindbestnew -- when to use qh_findbestnew for qh_partitionpoint()
*/
#define qh_USEfindbestnew (zzval_(Ztotmerge) > 50)
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="WIDEcoplanar">-</a>
qh_WIDEcoplanar
n*MAXcoplanar or n*MINvisible for a WIDEfacet
if vertex is further than qh.WIDEfacet from the hyperplane
then its ridges are not counted in computing the area, and
the facet's centrum is frozen.
notes:
qh.WIDEfacet= max(qh.MAXoutside,qh_WIDEcoplanar*qh.MAXcoplanar,
qh_WIDEcoplanar * qh.MINvisible);
*/
#define qh_WIDEcoplanar 6
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="WIDEduplicate">-</a>
qh_WIDEduplicate
Merge ratio for errexit from qh_forcedmerges due to duplicate ridge
Override with option Q12 no-wide-duplicate
Notes:
Merging a duplicate ridge can lead to very wide facets.
A future release of qhull will avoid duplicate ridges by removing duplicate sub-ridges from the horizon
*/
#define qh_WIDEduplicate 100
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="MAXnarrow">-</a>
qh_MAXnarrow
max. cosine in initial hull that sets qh.NARROWhull
notes:
If qh.NARROWhull, the initial partition does not make
coplanar points. If narrow, a coplanar point can be
coplanar to two facets of opposite orientations and
distant from the exact convex hull.
Conservative estimate. Don't actually see problems until it is -1.0
*/
#define qh_MAXnarrow -0.99999999
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="WARNnarrow">-</a>
qh_WARNnarrow
max. cosine in initial hull to warn about qh.NARROWhull
notes:
this is a conservative estimate.
Don't actually see problems until it is -1.0. See qh-impre.htm
*/
#define qh_WARNnarrow -0.999999999999999
/*-<a href="qh-user.htm#TOC"
>--------------------------------</a><a name="ZEROdelaunay">-</a>
qh_ZEROdelaunay
a zero Delaunay facet occurs for input sites coplanar with their convex hull
the last normal coefficient of a zero Delaunay facet is within
qh_ZEROdelaunay * qh.ANGLEround of 0
notes:
qh_ZEROdelaunay does not allow for joggled input ('QJ').
You can avoid zero Delaunay facets by surrounding the input with a box.
Use option 'PDk:-n' to explicitly define zero Delaunay facets
k= dimension of input sites (e.g., 3 for 3-d Delaunay triangulation)
n= the cutoff for zero Delaunay facets (e.g., 'PD3:-1e-12')
*/
#define qh_ZEROdelaunay 2
/*============================================================*/
/*============= Microsoft DevStudio ==========================*/
/*============================================================*/
/*
Finding Memory Leaks Using the CRT Library
https://msdn.microsoft.com/en-us/library/x98tx3cf(v=vs.100).aspx
Reports enabled in qh_lib_check for Debug window and stderr
From 2005=>msvcr80d, 2010=>msvcr100d, 2012=>msvcr110d
Watch: {,,msvcr80d.dll}_crtBreakAlloc Value from {n} in the leak report
_CrtSetBreakAlloc(689); // qh_lib_check() [global_r.c]
Examples
http://free-cad.sourceforge.net/SrcDocu/d2/d7f/MemDebug_8cpp_source.html
https://github.com/illlust/Game/blob/master/library/MemoryLeak.cpp
*/
#if 0 /* off (0) by default for QHULL_CRTDBG */
#define QHULL_CRTDBG
#endif
#if defined(_MSC_VER) && defined(_DEBUG) && defined(QHULL_CRTDBG)
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#endif
#endif /* qh_DEFuser */

View File

@ -0,0 +1,94 @@
/*<html><pre> -<a href="qh-user.htm"
>-------------------------------</a><a name="TOP">-</a>
usermem.c
qh_exit(), qh_free(), and qh_malloc()
See README.txt.
If you redefine one of these functions you must redefine all of them.
If you recompile and load this file, then usermem.o will not be loaded
from qhull.a or qhull.lib
See libqhull.h for data structures, macros, and user-callable functions.
See user.c for qhull-related, redefinable functions
see user.h for user-definable constants
See userprintf.c for qh_fprintf and userprintf_rbox.c for qh_fprintf_rbox
Please report any errors that you fix to qhull@qhull.org
*/
#include "libqhull.h"
#include <stdarg.h>
#include <stdlib.h>
/*-<a href="qh-user.htm#TOC"
>-------------------------------</a><a name="qh_exit">-</a>
qh_exit( exitcode )
exit program
notes:
qh_exit() is called when qh_errexit() and longjmp() are not available.
This is the only use of exit() in Qhull
To replace qh_exit with 'throw', see libqhullcpp/usermem_r-cpp.cpp
*/
void qh_exit(int exitcode) {
exit(exitcode);
} /* exit */
/*-<a href="qh-user.htm#TOC"
>-------------------------------</a><a name="qh_fprintf_stderr">-</a>
qh_fprintf_stderr( msgcode, format, list of args )
fprintf to stderr with msgcode (non-zero)
notes:
qh_fprintf_stderr() is called when qh.ferr is not defined, usually due to an initialization error
It is typically followed by qh_errexit().
Redefine this function to avoid using stderr
Use qh_fprintf [userprintf.c] for normal printing
*/
void qh_fprintf_stderr(int msgcode, const char *fmt, ... ) {
va_list args;
va_start(args, fmt);
if(msgcode)
fprintf(stderr, "QH%.4d ", msgcode);
vfprintf(stderr, fmt, args);
va_end(args);
} /* fprintf_stderr */
/*-<a href="qh-user.htm#TOC"
>-------------------------------</a><a name="qh_free">-</a>
qh_free( mem )
free memory
notes:
same as free()
No calls to qh_errexit()
*/
void qh_free(void *mem) {
free(mem);
} /* free */
/*-<a href="qh-user.htm#TOC"
>-------------------------------</a><a name="qh_malloc">-</a>
qh_malloc( mem )
allocate memory
notes:
same as malloc()
*/
void *qh_malloc(size_t size) {
return malloc(size);
} /* malloc */

View File

@ -0,0 +1,66 @@
/*<html><pre> -<a href="qh-user.htm"
>-------------------------------</a><a name="TOP">-</a>
userprintf.c
qh_fprintf()
see README.txt see COPYING.txt for copyright information.
If you recompile and load this file, then userprintf.o will not be loaded
from qhull.a or qhull.lib
See libqhull.h for data structures, macros, and user-callable functions.
See user.c for qhull-related, redefinable functions
see user.h for user-definable constants
See usermem.c for qh_exit(), qh_free(), and qh_malloc()
see Qhull.cpp and RboxPoints.cpp for examples.
Please report any errors that you fix to qhull@qhull.org
*/
#include "libqhull.h"
#include "mem.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
/*-<a href="qh-user.htm#TOC"
>-------------------------------</a><a name="qh_fprintf">-</a>
qh_fprintf(fp, msgcode, format, list of args )
print arguments to *fp according to format
Use qh_fprintf_rbox() for rboxlib.c
notes:
same as fprintf()
fgets() is not trapped like fprintf()
exit qh_fprintf via qh_errexit()
may be called for errors in qh_initstatistics and qh_meminit
*/
void qh_fprintf(FILE *fp, int msgcode, const char *fmt, ... ) {
va_list args;
if (!fp) {
/* could use qhmem.ferr, but probably better to be cautious */
qh_fprintf_stderr(6232, "Qhull internal error (userprintf.c): fp is 0. Wrong qh_fprintf called.\n");
qh_errexit(6232, NULL, NULL);
}
va_start(args, fmt);
#if qh_QHpointer
if (qh_qh && qh ANNOTATEoutput) {
#else
if (qh ANNOTATEoutput) {
#endif
fprintf(fp, "[QH%.4d]", msgcode);
}else if (msgcode >= MSG_ERROR && msgcode < MSG_STDERR ) {
fprintf(fp, "QH%.4d ", msgcode);
}
vfprintf(fp, fmt, args);
va_end(args);
/* Place debugging traps here. Use with option 'Tn' */
} /* qh_fprintf */

View File

@ -0,0 +1,53 @@
/*<html><pre> -<a href="qh-user.htm"
>-------------------------------</a><a name="TOP">-</a>
userprintf_rbox.c
qh_fprintf_rbox()
see README.txt see COPYING.txt for copyright information.
If you recompile and load this file, then userprintf_rbox.o will not be loaded
from qhull.a or qhull.lib
See libqhull.h for data structures, macros, and user-callable functions.
See user.c for qhull-related, redefinable functions
see user.h for user-definable constants
See usermem.c for qh_exit(), qh_free(), and qh_malloc()
see Qhull.cpp and RboxPoints.cpp for examples.
Please report any errors that you fix to qhull@qhull.org
*/
#include "libqhull.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
/*-<a href="qh-user.htm#TOC"
>-------------------------------</a><a name="qh_fprintf_rbox">-</a>
qh_fprintf_rbox(fp, msgcode, format, list of args )
print arguments to *fp according to format
Use qh_fprintf_rbox() for rboxlib.c
notes:
same as fprintf()
fgets() is not trapped like fprintf()
exit qh_fprintf_rbox via qh_errexit_rbox()
*/
void qh_fprintf_rbox(FILE *fp, int msgcode, const char *fmt, ... ) {
va_list args;
if (!fp) {
qh_fprintf_stderr(6231, "Qhull internal error (userprintf_rbox.c): fp is 0. Wrong qh_fprintf_rbox called.\n");
qh_errexit_rbox(6231);
}
if (msgcode >= MSG_ERROR && msgcode < MSG_STDERR)
fprintf(fp, "QH%.4d ", msgcode);
va_start(args, fmt);
vfprintf(fp, fmt, args);
va_end(args);
} /* qh_fprintf_rbox */

View File

@ -0,0 +1,240 @@
# Simple gcc Makefile for reentrant qhull and rbox (default gcc/g++)
#
# make help
# See README.txt and ../../Makefile
#
# Variables
# BINDIR directory where to copy executables
# DESTDIR destination directory for 'make install'
# DOCDIR directory where to copy html documentation
# INCDIR directory where to copy headers
# LIBDIR directory where to copy libraries
# MANDIR directory where to copy manual pages
# PRINTMAN command for printing manual pages
# PRINTC command for printing C files
# CC ANSI C or C++ compiler
# CC_OPTS1 options used to compile .c files
# CC_OPTS2 options used to link .o files
# CC_OPTS3 options to build shared libraries
#
# LIBQHULL_OBJS .o files for linking
# LIBQHULL_HDRS .h files for printing
# CFILES .c files for printing
# DOCFILES documentation files
# FILES miscellaneous files for printing
# TFILES .txt versions of html files
# FILES all other files
# LIBQHULL_OBJS specifies the object files of libqhullstatic_r.a
#
# Results
# rbox Generates points sets for qhull, qconvex, etc.
# qhull Computes convex hulls and related structures
# qconvex, qdelaunay, qhalf, qvoronoi
# Specializations of qhull for each geometric structure
# libqhullstatic_r.a Static library for reentrant qhull
# testqset_r Standalone test of reentrant qset_r.c with mem_r.c
# user_eg An example of using qhull (reentrant)
# user_eg2 An example of using qhull (reentrant)
#
# Make targets
# make Build results using gcc or another compiler
# make clean Remove object files
# make cleanall Remove generated files
# make doc Print documentation
# make help
# make install Copy qhull, rbox, qhull.1, rbox.1 to BINDIR, MANDIR
# make new Rebuild qhull and rbox from source
# make printall Print all files
# make qtest Quick test of qset, rbox, and qhull
# make test Quck test of qhull, qconvex, etc.
#
# Do not replace tabs with spaces. Needed for build rules
# Unix line endings (\n)
# $Id: //main/2015/qhull/src/libqhull_r/Makefile#6 $
DESTDIR = /usr/local
BINDIR = $(DESTDIR)/bin
INCDIR = $(DESTDIR)/include
LIBDIR = $(DESTDIR)/lib
DOCDIR = $(DESTDIR)/share/doc/qhull
MANDIR = $(DESTDIR)/share/man/man1
# if you do not have enscript, try a2ps or just use lpr. The files are text.
PRINTMAN = enscript -2rl
PRINTC = enscript -2r
# PRINTMAN = lpr
# PRINTC = lpr
#for Gnu's gcc compiler, -O3 for optimization, -g for debugging, -pg for profiling
# -fpic needed for gcc x86_64-linux-gnu. Not needed for mingw
CC = gcc
CC_OPTS1 = -O3 -ansi -I../../src -fpic $(CC_WARNINGS)
# for Sun's cc compiler, -fast or O2 for optimization, -g for debugging, -Xc for ANSI
#CC = cc
#CC_OPTS1 = -Xc -v -fast -I../../src
# for Silicon Graphics cc compiler, -O2 for optimization, -g for debugging
#CC = cc
#CC_OPTS1 = -ansi -O2 -I../../src
# for Next cc compiler with fat executable
#CC = cc
#CC_OPTS1 = -ansi -O2 -I../../src -arch m68k -arch i386 -arch hppa
# For loader, ld,
CC_OPTS2 = $(CC_OPTS1)
# Default targets for make
all: qhull_links qhull_all qtest
help:
head -n 50 Makefile
clean:
rm -f *.o
# Delete linked files from other directories [qhull_links]
rm -f qconvex_r.c unix_r.c qdelaun_r.c qhalf_r.c qvoronoi_r.c rbox_r.c
rm -f user_eg_r.c user_eg2_r.c testqset_r.c
cleanall: clean
rm -f qconvex qdelaunay qhalf qvoronoi qhull *.exe
rm -f core user_eg_r user_eg2_r testqset_r libqhullstatic_r.a
doc:
$(PRINTMAN) $(TXTFILES) $(DOCFILES)
install:
mkdir -p $(BINDIR)
mkdir -p $(DOCDIR)
mkdir -p $(INCDIR)/libqhull
mkdir -p $(MANDIR)
cp -p qconvex qdelaunay qhalf qhull qvoronoi rbox $(BINDIR)
cp -p libqhullstatic_r.a $(LIBDIR)
cp -p ../../html/qhull.man $(MANDIR)/qhull.1
cp -p ../../html/rbox.man $(MANDIR)/rbox.1
cp -p ../../html/* $(DOCDIR)
cp *.h $(INCDIR)/libqhull_r
new: cleanall all
printall: doc printh printc printf
printh:
$(PRINTC) $(LIBQHULL_HDRS)
printc:
$(PRINTC) $(CFILES)
# LIBQHULL_OBJS_1 ordered by frequency of execution with small files at end. Better locality.
# Same definitions as ../../Makefile
LIBQHULLS_OBJS_1= global_r.o stat_r.o geom2_r.o poly2_r.o merge_r.o \
libqhull_r.o geom_r.o poly_r.o qset_r.o mem_r.o random_r.o
LIBQHULLS_OBJS_2= $(LIBQHULLS_OBJS_1) usermem_r.o userprintf_r.o io_r.o user_r.o
LIBQHULLS_OBJS= $(LIBQHULLS_OBJS_2) rboxlib_r.o userprintf_rbox_r.o
LIBQHULL_HDRS= user_r.h libqhull_r.h qhull_ra.h geom_r.h \
io_r.h mem_r.h merge_r.h poly_r.h random_r.h \
qset_r.h stat_r.h
# CFILES ordered alphabetically after libqhull.c
CFILES= ../qhull/unix_r.c libqhull_r.c geom_r.c geom2_r.c global_r.c io_r.c \
mem_r.c merge_r.c poly_r.c poly2_r.c random_r.c rboxlib_r.c \
qset_r.c stat_r.c user_r.c usermem_r.c userprintf_r.c \
../qconvex/qconvex.c ../qdelaunay/qdelaun.c ../qhalf/qhalf.c ../qvoronoi/qvoronoi.c
TXTFILES= ../../Announce.txt ../../REGISTER.txt ../../COPYING.txt ../../README.txt ../Changes.txt
DOCFILES= ../../html/rbox.txt ../../html/qhull.txt
.c.o:
$(CC) -c $(CC_OPTS1) -o $@ $<
# Work around problems with ../ in Red Hat Linux
qhull_links:
# On MINSYS, 'ln -s' may create a copy instead of a symbolic link
[ -f qconvex_r.c ] || ln -s ../qconvex/qconvex_r.c
[ -f qdelaun_r.c ] || ln -s ../qdelaunay/qdelaun_r.c
[ -f qhalf_r.c ] || ln -s ../qhalf/qhalf_r.c
[ -f qvoronoi_r.c ] || ln -s ../qvoronoi/qvoronoi_r.c
[ -f rbox_r.c ] || ln -s ../rbox/rbox_r.c
[ -f testqset_r.c ] || ln -s ../testqset_r/testqset_r.c
[ -f unix_r.c ] || ln -s ../qhull/unix_r.c
[ -f user_eg_r.c ] || ln -s ../user_eg/user_eg_r.c
[ -f user_eg2_r.c ] || ln -s ../user_eg2/user_eg2_r.c
# compile qhull without using bin/libqhullstatic_r.a
qhull_all: qconvex_r.o qdelaun_r.o qhalf_r.o qvoronoi_r.o unix_r.o user_eg_r.o user_eg2_r.o rbox_r.o testqset_r.o $(LIBQHULLS_OBJS)
$(CC) -o qconvex $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) qconvex_r.o
$(CC) -o qdelaunay $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) qdelaun_r.o
$(CC) -o qhalf $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) qhalf_r.o
$(CC) -o qvoronoi $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) qvoronoi_r.o
$(CC) -o qhull $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) unix_r.o
$(CC) -o rbox $(CC_OPTS2) -lm $(LIBQHULLS_OBJS) rbox_r.o
$(CC) -o user_eg $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) user_eg_r.o
$(CC) -o user_eg2 $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_1) user_eg2_r.o usermem_r.o userprintf_r.o io_r.o
$(CC) -o testqset_r $(CC_OPTS2) -lm mem_r.o qset_r.o usermem_r.o testqset_r.o
-ar -rs libqhullstatic_r.a $(LIBQHULLS_OBJS)
#libqhullstatic_r.a is not needed for qhull
#If 'ar -rs' fails try using 'ar -s' with 'ranlib'
#ranlib libqhullstatic_r.a
qtest:
@echo ============================================
@echo == make qtest ==============================
@echo ============================================
@echo -n "== "
@date
@echo
@echo Testing qset.c and mem.c with testqset
./testqset_r 10000
@echo Run the qhull smoketest
./rbox D4 | ./qhull
@echo ============================================
@echo == To smoketest qhull programs
@echo '== make test'
@echo ============================================
@echo
@echo ============================================
@echo == For all make targets
@echo '== make help'
@echo ============================================
@echo
test: qtest
@echo ==============================
@echo ========= qconvex ============
@echo ==============================
-./rbox 10 | ./qconvex Tv
@echo
@echo ==============================
@echo ========= qdelaunay ==========
@echo ==============================
-./rbox 10 | ./qdelaunay Tv
@echo
@echo ==============================
@echo ========= qhalf ==============
@echo ==============================
-./rbox 10 | ./qconvex FQ FV n Tv | ./qhalf Tv
@echo
@echo ==============================
@echo ========= qvoronoi ===========
@echo ==============================
-./rbox 10 | ./qvoronoi Tv
@echo
@echo ==============================
@echo ========= user_eg ============
@echo == w/o shared library ========
@echo ==============================
-./user_eg
@echo
@echo ==============================
@echo ========= user_eg2 ===========
@echo ==============================
-./user_eg2
@echo
# end of Makefile

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,184 @@
/*<html><pre> -<a href="qh-geom_r.htm"
>-------------------------------</a><a name="TOP">-</a>
geom_r.h
header file for geometric routines
see qh-geom_r.htm and geom_r.c
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull_r/geom_r.h#3 $$Change: 2079 $
$DateTime: 2016/02/07 17:43:34 $$Author: bbarber $
*/
#ifndef qhDEFgeom
#define qhDEFgeom 1
#include "libqhull_r.h"
/* ============ -macros- ======================== */
/*-<a href="qh-geom_r.htm#TOC"
>--------------------------------</a><a name="fabs_">-</a>
fabs_(a)
returns the absolute value of a
*/
#define fabs_( a ) ((( a ) < 0 ) ? -( a ):( a ))
/*-<a href="qh-geom_r.htm#TOC"
>--------------------------------</a><a name="fmax_">-</a>
fmax_(a,b)
returns the maximum value of a and b
*/
#define fmax_( a,b ) ( ( a ) < ( b ) ? ( b ) : ( a ) )
/*-<a href="qh-geom_r.htm#TOC"
>--------------------------------</a><a name="fmin_">-</a>
fmin_(a,b)
returns the minimum value of a and b
*/
#define fmin_( a,b ) ( ( a ) > ( b ) ? ( b ) : ( a ) )
/*-<a href="qh-geom_r.htm#TOC"
>--------------------------------</a><a name="maximize_">-</a>
maximize_(maxval, val)
set maxval to val if val is greater than maxval
*/
#define maximize_( maxval, val ) { if (( maxval ) < ( val )) ( maxval )= ( val ); }
/*-<a href="qh-geom_r.htm#TOC"
>--------------------------------</a><a name="minimize_">-</a>
minimize_(minval, val)
set minval to val if val is less than minval
*/
#define minimize_( minval, val ) { if (( minval ) > ( val )) ( minval )= ( val ); }
/*-<a href="qh-geom_r.htm#TOC"
>--------------------------------</a><a name="det2_">-</a>
det2_(a1, a2,
b1, b2)
compute a 2-d determinate
*/
#define det2_( a1,a2,b1,b2 ) (( a1 )*( b2 ) - ( a2 )*( b1 ))
/*-<a href="qh-geom_r.htm#TOC"
>--------------------------------</a><a name="det3_">-</a>
det3_(a1, a2, a3,
b1, b2, b3,
c1, c2, c3)
compute a 3-d determinate
*/
#define det3_( a1,a2,a3,b1,b2,b3,c1,c2,c3 ) ( ( a1 )*det2_( b2,b3,c2,c3 ) \
- ( b1 )*det2_( a2,a3,c2,c3 ) + ( c1 )*det2_( a2,a3,b2,b3 ) )
/*-<a href="qh-geom_r.htm#TOC"
>--------------------------------</a><a name="dX">-</a>
dX( p1, p2 )
dY( p1, p2 )
dZ( p1, p2 )
given two indices into rows[],
compute the difference between X, Y, or Z coordinates
*/
#define dX( p1,p2 ) ( *( rows[p1] ) - *( rows[p2] ))
#define dY( p1,p2 ) ( *( rows[p1]+1 ) - *( rows[p2]+1 ))
#define dZ( p1,p2 ) ( *( rows[p1]+2 ) - *( rows[p2]+2 ))
#define dW( p1,p2 ) ( *( rows[p1]+3 ) - *( rows[p2]+3 ))
/*============= prototypes in alphabetical order, infrequent at end ======= */
#ifdef __cplusplus
extern "C" {
#endif
void qh_backnormal(qhT *qh, realT **rows, int numrow, int numcol, boolT sign, coordT *normal, boolT *nearzero);
void qh_distplane(qhT *qh, pointT *point, facetT *facet, realT *dist);
facetT *qh_findbest(qhT *qh, pointT *point, facetT *startfacet,
boolT bestoutside, boolT isnewfacets, boolT noupper,
realT *dist, boolT *isoutside, int *numpart);
facetT *qh_findbesthorizon(qhT *qh, boolT ischeckmax, pointT *point,
facetT *startfacet, boolT noupper, realT *bestdist, int *numpart);
facetT *qh_findbestnew(qhT *qh, pointT *point, facetT *startfacet, realT *dist,
boolT bestoutside, boolT *isoutside, int *numpart);
void qh_gausselim(qhT *qh, realT **rows, int numrow, int numcol, boolT *sign, boolT *nearzero);
realT qh_getangle(qhT *qh, pointT *vect1, pointT *vect2);
pointT *qh_getcenter(qhT *qh, setT *vertices);
pointT *qh_getcentrum(qhT *qh, facetT *facet);
realT qh_getdistance(qhT *qh, facetT *facet, facetT *neighbor, realT *mindist, realT *maxdist);
void qh_normalize(qhT *qh, coordT *normal, int dim, boolT toporient);
void qh_normalize2(qhT *qh, coordT *normal, int dim, boolT toporient,
realT *minnorm, boolT *ismin);
pointT *qh_projectpoint(qhT *qh, pointT *point, facetT *facet, realT dist);
void qh_setfacetplane(qhT *qh, facetT *newfacets);
void qh_sethyperplane_det(qhT *qh, int dim, coordT **rows, coordT *point0,
boolT toporient, coordT *normal, realT *offset, boolT *nearzero);
void qh_sethyperplane_gauss(qhT *qh, int dim, coordT **rows, pointT *point0,
boolT toporient, coordT *normal, coordT *offset, boolT *nearzero);
boolT qh_sharpnewfacets(qhT *qh);
/*========= infrequently used code in geom2_r.c =============*/
coordT *qh_copypoints(qhT *qh, coordT *points, int numpoints, int dimension);
void qh_crossproduct(int dim, realT vecA[3], realT vecB[3], realT vecC[3]);
realT qh_determinant(qhT *qh, realT **rows, int dim, boolT *nearzero);
realT qh_detjoggle(qhT *qh, pointT *points, int numpoints, int dimension);
void qh_detroundoff(qhT *qh);
realT qh_detsimplex(qhT *qh, pointT *apex, setT *points, int dim, boolT *nearzero);
realT qh_distnorm(int dim, pointT *point, pointT *normal, realT *offsetp);
realT qh_distround(qhT *qh, int dimension, realT maxabs, realT maxsumabs);
realT qh_divzero(realT numer, realT denom, realT mindenom1, boolT *zerodiv);
realT qh_facetarea(qhT *qh, facetT *facet);
realT qh_facetarea_simplex(qhT *qh, int dim, coordT *apex, setT *vertices,
vertexT *notvertex, boolT toporient, coordT *normal, realT *offset);
pointT *qh_facetcenter(qhT *qh, setT *vertices);
facetT *qh_findgooddist(qhT *qh, pointT *point, facetT *facetA, realT *distp, facetT **facetlist);
void qh_getarea(qhT *qh, facetT *facetlist);
boolT qh_gram_schmidt(qhT *qh, int dim, realT **rows);
boolT qh_inthresholds(qhT *qh, coordT *normal, realT *angle);
void qh_joggleinput(qhT *qh);
realT *qh_maxabsval(realT *normal, int dim);
setT *qh_maxmin(qhT *qh, pointT *points, int numpoints, int dimension);
realT qh_maxouter(qhT *qh);
void qh_maxsimplex(qhT *qh, int dim, setT *maxpoints, pointT *points, int numpoints, setT **simplex);
realT qh_minabsval(realT *normal, int dim);
int qh_mindiff(realT *vecA, realT *vecB, int dim);
boolT qh_orientoutside(qhT *qh, facetT *facet);
void qh_outerinner(qhT *qh, facetT *facet, realT *outerplane, realT *innerplane);
coordT qh_pointdist(pointT *point1, pointT *point2, int dim);
void qh_printmatrix(qhT *qh, FILE *fp, const char *string, realT **rows, int numrow, int numcol);
void qh_printpoints(qhT *qh, FILE *fp, const char *string, setT *points);
void qh_projectinput(qhT *qh);
void qh_projectpoints(qhT *qh, signed char *project, int n, realT *points,
int numpoints, int dim, realT *newpoints, int newdim);
void qh_rotateinput(qhT *qh, realT **rows);
void qh_rotatepoints(qhT *qh, realT *points, int numpoints, int dim, realT **rows);
void qh_scaleinput(qhT *qh);
void qh_scalelast(qhT *qh, coordT *points, int numpoints, int dim, coordT low,
coordT high, coordT newhigh);
void qh_scalepoints(qhT *qh, pointT *points, int numpoints, int dim,
realT *newlows, realT *newhighs);
boolT qh_sethalfspace(qhT *qh, int dim, coordT *coords, coordT **nextp,
coordT *normal, coordT *offset, coordT *feasible);
coordT *qh_sethalfspace_all(qhT *qh, int dim, int count, coordT *halfspaces, pointT *feasible);
pointT *qh_voronoi_center(qhT *qh, int dim, setT *points);
#ifdef __cplusplus
} /* extern "C"*/
#endif
#endif /* qhDEFgeom */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,266 @@
<!-- Do not edit with Front Page, it adds too many spaces -->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>Reentrant Qhull functions, macros, and data structures</title>
</head>
<body>
<!-- Navigation links -->
<p><a name="TOP"><b>Up:</b></a> <a
href="http://www.qhull.org">Home page</a> for Qhull<br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual</a>: Table of Contents <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code</a><br>
<b>To:</b> <a href="#TOC">Qhull files</a><br>
<b>To:</b> <a href="qh-geom_r.htm">Geom</a> &#149; <a href="qh-globa_r.htm">Global</a>
&#149; <a href="qh-io_r.htm">Io</a> &#149; <a href="qh-mem_r.htm">Mem</a>
&#149; <a href="qh-merge_r.htm">Merge</a> &#149; <a href="qh-poly_r.htm">Poly</a>
&#149; <a href="qh-qhull_r.htm">Qhull</a> &#149; <a href="qh-set_r.htm">Set</a>
&#149; <a href="qh-stat_r.htm">Stat</a> &#149; <a href="qh-user_r.htm">User</a>
<hr>
<!-- Main text of document. -->
<h1>Reentrant Qhull functions, macros, and data structures</h1>
<blockquote>
<p>The following sections provide an overview and index to
reentrant Qhull's functions, macros, and data structures.
Each section starts with an introduction.
See also <a href=../../html/qh-code.htm#library>Calling
Qhull from C programs</a> and <a href="../../html/qh-code.htm#cpp">Calling Qhull from C++ programs</a>.</p>
<p>Qhull uses the following conventions:</p>
<blockquote>
<ul>
<li>in code, global variables start with &quot;qh &quot;
<li>in documentation, global variables start with 'qh.'
<li>constants start with an upper case word
<li>important globals include an '_'
<li>functions, macros, and constants start with &quot;qh_&quot;</li>
<li>data types end in &quot;T&quot;</li>
<li>macros with arguments end in &quot;_&quot;</li>
<li>iterators are macros that use local variables</li>
<li>iterators for sets start with &quot;FOREACH&quot;</li>
<li>iterators for lists start with &quot;FORALL&quot;</li>
<li>qhull options are in single quotes (e.g., 'Pdn')</li>
<li>lists are sorted alphabetically</li>
<li>preprocessor directives on left margin for older compilers</li>
</ul>
</blockquote>
<p>
Reentrant Qhull is nearly the same as non-reentrant Qhull. In reentrant
Qhull, the qhT data structure is the first parameter to most functions. Qhull accesses
this data structure with 'qh->...'.
In non-reentrant Qhull, the global data structure is either a struct (qh_QHpointer==0)
or a pointer (qh_QHpointer==1). The non-reentrant code looks different because this data
structure is accessed via the 'qh' macro. This macro expands to 'qh_qh.' or 'qh_qh->' (resp.).
<p>
When reading code with an editor, a search for
'<i>&quot;function</i>'
will locate the header of <i>qh_function</i>. A search for '<i>* function</i>'
will locate the tail of <i>qh_function</i>.
<p>A useful starting point is <a href="libqhull_r.h">libqhull_r.h</a>. It defines most
of Qhull data structures and top-level functions. Search for <i>'PFn'</i> to
determine the corresponding constant in Qhull. Search for <i>'Fp'</i> to
determine the corresponding <a href="libqhull_r.h#qh_PRINT">qh_PRINT...</a> constant.
Search <a href="io_r.c">io_r.c</a> to learn how the print function is implemented.</p>
<p>If your web browser is configured for .c and .h files, the function, macro, and data type links
go to the corresponding source location. To configure your web browser for .c and .h files.
<ul>
<li>In the Download Preferences or Options panel, add file extensions 'c' and 'h' to mime type 'text/html'.
<li>Opera 12.10
<ol>
<li>In Tools > Preferences > Advanced > Downloads
<li>Uncheck 'Hide file types opened with Opera'
<li>Quick find 'html'
<li>Select 'text/html' > Edit
<li>Add File extensions 'c,h,'
<li>Click 'OK'
</ol>
<li>Internet Explorer -- Mime types are not available from 'Internet Options'. Is there a registry key for these settings?
<li>Firefox -- Mime types are not available from 'Preferences'. Is there an add-on to change the file extensions for a mime type?
<li>Chrome -- Can Chrome be configured?
</ul>
<p>
Please report documentation and link errors
to <a href="mailto:qhull-bug@qhull.org">qhull-bug@qhull.org</a>.
</blockquote>
<p><b>Copyright &copy; 1997-2015 C.B. Barber</b></p>
<hr>
<h2><a href="#TOP">&#187;</a><a name="TOC">Qhull files</a> </h2>
<blockquote>
<p>This sections lists the .c and .h files for Qhull. Please
refer to these files for detailed information.</p>
<blockquote>
<dl>
<dt><a href="../../Makefile"><b>Makefile</b></a><b>, </b><a href="../../CMakeLists.txt"><b>CMakeLists.txt</b></a></dt>
<dd><tt>Makefile</tt> is preconfigured for gcc. <tt>CMakeLists.txt</tt> supports multiple
platforms with <a href=http://www.cmake.org/>CMake</a>.
Qhull includes project files for Visual Studio and Qt.
</dd>
<dt>&nbsp;</dt>
<dt><a href="libqhull_r.h"><b>libqhull_r.h</b></a> </dt>
<dd>Include file for the Qhull library (<tt>libqhull.so</tt>, <tt>qhull.dll</tt>, <tt>libqhullstatic.a</tt>).
Data structures are documented under <a href="qh-poly_r.htm">Poly</a>.
Global variables are documented under <a href="qh-globa_r.htm">Global</a>.
Other data structures and variables are documented under
<a href="qh-qhull_r.htm#TOC">Qhull</a> or <a href="qh-geom_r.htm"><b>Geom</b></a><b>.</b></dd>
<dt>&nbsp;</dt>
<dt><a href="qh-geom_r.htm"><b>Geom</b></a><b>, </b>
<a href="geom_r.h"><b>geom_r.h</b></a><b>, </b>
<a href="geom_r.c"><b>geom_r.c</b></a><b>, </b>
<a href="geom2_r.c"><b>geom2_r.c</b></a><b>, </b>
<a href="random_r.c"><b>random_r.c</b></a><b>, </b>
<a href="random_r.h"><b>random_r.h</b></a></dt>
<dd>Geometric routines. These routines implement mathematical
functions such as Gaussian elimination and geometric
routines needed for Qhull. Frequently used routines are
in <tt>geom_r.c</tt> while infrequent ones are in <tt>geom2_r.c</tt>.
</dd>
<dt>&nbsp;</dt>
<dt><a href="qh-globa_r.htm"><b>Global</b></a><b>, </b>
<a href="global_r.c"><b>global_r.c</b></a><b>, </b>
<a href="libqhull_r.h"><b>libqhull_r.h</b></a> </dt>
<dd>Global routines. Qhull uses a global data structure, <tt>qh</tt>,
to store globally defined constants, lists, sets, and
variables.
<tt>global_r.c</tt> initializes and frees these
structures. </dd>
<dt>&nbsp;</dt>
<dt><a href="qh-io_r.htm"><b>Io</b></a><b>, </b><a href="io_r.h"><b>io_r.h</b></a><b>,
</b><a href="io_r.c"><b>io_r.c</b></a> </dt>
<dd>Input and output routines. Qhull provides a wide range of
input and output options.</dd>
<dt>&nbsp;</dt>
<dt><a href="qh-mem_r.htm"><b>Mem</b></a><b>, </b>
<a href="mem_r.h"><b>mem_r.h</b></a><b>, </b>
<a href="mem_r.c"><b>mem_r.c</b></a> </dt>
<dd>Memory routines. Qhull provides memory allocation and
deallocation. It uses quick-fit allocation.</dd>
<dt>&nbsp;</dt>
<dt><a href="qh-merge_r.htm"><b>Merge</b></a><b>, </b>
<a href="merge_r.h"><b>merge_r.h</b></a><b>, </b>
<a href="merge_r.c"><b>merge_r.c</b></a> </dt>
<dd>Merge routines. Qhull handles precision problems by
merged facets or joggled input. These routines merge simplicial facets,
merge non-simplicial facets, merge cycles of facets, and
rename redundant vertices.</dd>
<dt>&nbsp;</dt>
<dt><a href="qh-poly_r.htm"><b>Poly</b></a><b>, </b>
<a href="poly_r.h"><b>poly_r.h</b></a><b>, </b>
<a href="poly_r.c"><b>poly_r.c</b></a><b>, </b>
<a href="poly2_r.c"><b>poly2_r.c</b></a><b>, </b>
<a href="libqhull_r.h"><b>libqhull_r.h</b></a> </dt>
<dd>Polyhedral routines. Qhull produces a polyhedron as a
list of facets with vertices, neighbors, ridges, and
geometric information. <tt>libqhull_r.h</tt> defines the main
data structures. Frequently used routines are in <tt>poly_r.c</tt>
while infrequent ones are in <tt>poly2_r.c</tt>.</dd>
<dt>&nbsp;</dt>
<dt><a href="qh-qhull_r.htm#TOC"><b>Qhull</b></a><b>, </b>
<a href="libqhull_r.c"><b>libqhull_r.c</b></a><b>, </b>
<a href="libqhull_r.h"><b>libqhull_r.h</b></a><b>, </b>
<a href="qhull_ra.h"><b>qhull_ra.h</b></a><b>, </b>
<a href="../qhull/unix_r.c"><b>unix_r.c</b></a> <b>, </b>
<a href="../qconvex/qconvex_r.c"><b>qconvex_r.c</b></a> <b>, </b>
<a href="../qdelaunay/qdelaun_r.c"><b>qdelaun_r.c</b></a> <b>, </b>
<a href="../qhalf/qhalf_r.c"><b>qhalf_r.c</b></a> <b>, </b>
<a href="../qvoronoi/qvoronoi_r.c"><b>qvoronoi_r.c</b></a> </dt>
<dd>Top-level routines. The Quickhull algorithm is
implemented by <tt>libqhull_r.c</tt>. <tt>qhull_ra.h</tt>
includes all header files. </dd>
<dt>&nbsp;</dt>
<dt><a href="qh-set_r.htm"><b>Set</b></a><b>, </b>
<a href="qset_r.h"><b>qset_r.h</b></a><b>, </b>
<a href="qset_r.c"><b>qset_r.c</b></a> </dt>
<dd>Set routines. Qhull implements its data structures as
sets. A set is an array of pointers that is expanded as
needed. This is a separate package that may be used in
other applications. </dd>
<dt>&nbsp;</dt>
<dt><a href="qh-stat_r.htm"><b>Stat</b></a><b>, </b>
<a href="stat_r.h"><b>stat_r.h</b></a><b>, </b>
<a href="stat_r.c"><b>stat_r.c</b></a> </dt>
<dd>Statistical routines. Qhull maintains statistics about
its implementation. </dd>
<dt>&nbsp;</dt>
<dt><a href="qh-user_r.htm"><b>User</b></a><b>, </b>
<a href="user_r.h"><b>user_r.h</b></a><b>, </b>
<a href="user_r.c"><b>user_r.c</b></a><b>, </b>
<a href="../user_eg/user_eg_r.c"><b>user_eg_r.c</b></a><b>, </b>
<a href="../user_eg2/user_eg2_r.c"><b>user_eg2_r.c</b></a><b>, </b>
<a href="../user_eg3/user_eg3_r.cpp"><b>user_eg3_r.cpp</b></a><b>, </b>
</dt>
<dd>User-defined routines. Qhull allows the user to configure
the code with defined constants and specialized routines.
</dd>
</dl>
</blockquote>
</blockquote>
<p><!-- Navigation links --> </p>
<hr>
<p><b>Up:</b>
<a href="http://www.qhull.org">Home page for
Qhull</a> <br>
<b>Up:</b> <a href="../../html/index.htm#TOC">Qhull manual: Table of Contents</a> <br>
<b>Up:</b> <a href="../../html/qh-quick.htm#programs">Programs</a>
&#149; <a href="../../html/qh-quick.htm#options">Options</a>
&#149; <a href="../../html/qh-opto.htm#output">Output</a>
&#149; <a href="../../html/qh-optf.htm#format">Formats</a>
&#149; <a href="../../html/qh-optg.htm#geomview">Geomview</a>
&#149; <a href="../../html/qh-optp.htm#print">Print</a>
&#149; <a href="../../html/qh-optq.htm#qhull">Qhull</a>
&#149; <a href="../../html/qh-optc.htm#prec">Precision</a>
&#149; <a href="../../html/qh-optt.htm#trace">Trace</a>
&#149; <a href="index.htm">Functions</a><br>
<b>Up:</b> <a href="../../html/qh-code.htm#TOC">Qhull code: Table of Contents</a> <br>
<b>To:</b> <a href="#TOC">Qhull files</a><br>
<b>To:</b> <a href="qh-geom_r.htm">Geom</a> &#149;
<a href="qh-globa_r.htm">Global</a> &#149; <a href="qh-io_r.htm">Io</a>
&#149; <a href="qh-mem_r.htm">Mem</a> &#149; <a href="qh-merge_r.htm">Merge</a>
&#149; <a href="qh-poly_r.htm">Poly</a> &#149; <a href="qh-qhull_r.htm#TOC">Qhull</a>
&#149; <a href="qh-set_r.htm">Set</a> &#149; <a href="qh-stat_r.htm">Stat</a>
&#149; <a href="qh-user_r.htm">User</a><br>
<p><!-- GC common information --> </p>
<hr>
<p><a href="http://www.geom.uiuc.edu/"><img
src="../../html/qh--geom.gif" align="middle" width="40" height="40"></a><i>The
Geometry Center Home Page </i></p>
<p>Comments to: <a href=mailto:qhull@qhull.org>qhull@qhull.org</a>
</a><br>
Created: May 2, 1997 --- <!-- hhmts start --> Last modified: see top <!-- hhmts end --> </p>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,167 @@
/*<html><pre> -<a href="qh-io_r.htm"
>-------------------------------</a><a name="TOP">-</a>
io_r.h
declarations of Input/Output functions
see README, libqhull_r.h and io_r.c
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull_r/io_r.h#3 $$Change: 2079 $
$DateTime: 2016/02/07 17:43:34 $$Author: bbarber $
*/
#ifndef qhDEFio
#define qhDEFio 1
#include "libqhull_r.h"
/*============ constants and flags ==================*/
/*-<a href="qh-io_r.htm#TOC"
>--------------------------------</a><a name="qh_MAXfirst">-</a>
qh_MAXfirst
maximum length of first two lines of stdin
*/
#define qh_MAXfirst 200
/*-<a href="qh-io_r.htm#TOC"
>--------------------------------</a><a name="qh_MINradius">-</a>
qh_MINradius
min radius for Gp and Gv, fraction of maxcoord
*/
#define qh_MINradius 0.02
/*-<a href="qh-io_r.htm#TOC"
>--------------------------------</a><a name="qh_GEOMepsilon">-</a>
qh_GEOMepsilon
adjust outer planes for 'lines closer' and geomview roundoff.
This prevents bleed through.
*/
#define qh_GEOMepsilon 2e-3
/*-<a href="qh-io_r.htm#TOC"
>--------------------------------</a><a name="qh_WHITESPACE">-</a>
qh_WHITESPACE
possible values of white space
*/
#define qh_WHITESPACE " \n\t\v\r\f"
/*-<a href="qh-io_r.htm#TOC"
>--------------------------------</a><a name="RIDGE">-</a>
qh_RIDGE
to select which ridges to print in qh_eachvoronoi
*/
typedef enum
{
qh_RIDGEall = 0, qh_RIDGEinner, qh_RIDGEouter
}
qh_RIDGE;
/*-<a href="qh-io_r.htm#TOC"
>--------------------------------</a><a name="printvridgeT">-</a>
printvridgeT
prints results of qh_printvdiagram
see:
<a href="io_r.c#printvridge">qh_printvridge</a> for an example
*/
typedef void (*printvridgeT)(qhT *qh, FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded);
/*============== -prototypes in alphabetical order =========*/
#ifdef __cplusplus
extern "C" {
#endif
void qh_dfacet(qhT *qh, unsigned id);
void qh_dvertex(qhT *qh, unsigned id);
int qh_compare_facetarea(const void *p1, const void *p2);
int qh_compare_facetmerge(const void *p1, const void *p2);
int qh_compare_facetvisit(const void *p1, const void *p2);
/* int qh_compare_vertexpoint(const void *p1, const void *p2); Not useable since it depends on qh */
void qh_copyfilename(qhT *qh, char *filename, int size, const char* source, int length);
void qh_countfacets(qhT *qh, facetT *facetlist, setT *facets, boolT printall,
int *numfacetsp, int *numsimplicialp, int *totneighborsp,
int *numridgesp, int *numcoplanarsp, int *numnumtricoplanarsp);
pointT *qh_detvnorm(qhT *qh, vertexT *vertex, vertexT *vertexA, setT *centers, realT *offsetp);
setT *qh_detvridge(qhT *qh, vertexT *vertex);
setT *qh_detvridge3(qhT *qh, vertexT *atvertex, vertexT *vertex);
int qh_eachvoronoi(qhT *qh, FILE *fp, printvridgeT printvridge, vertexT *atvertex, boolT visitall, qh_RIDGE innerouter, boolT inorder);
int qh_eachvoronoi_all(qhT *qh, FILE *fp, printvridgeT printvridge, boolT isUpper, qh_RIDGE innerouter, boolT inorder);
void qh_facet2point(qhT *qh, facetT *facet, pointT **point0, pointT **point1, realT *mindist);
setT *qh_facetvertices(qhT *qh, facetT *facetlist, setT *facets, boolT allfacets);
void qh_geomplanes(qhT *qh, facetT *facet, realT *outerplane, realT *innerplane);
void qh_markkeep(qhT *qh, facetT *facetlist);
setT *qh_markvoronoi(qhT *qh, facetT *facetlist, setT *facets, boolT printall, boolT *isLowerp, int *numcentersp);
void qh_order_vertexneighbors(qhT *qh, vertexT *vertex);
void qh_prepare_output(qhT *qh);
void qh_printafacet(qhT *qh, FILE *fp, qh_PRINT format, facetT *facet, boolT printall);
void qh_printbegin(qhT *qh, FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
void qh_printcenter(qhT *qh, FILE *fp, qh_PRINT format, const char *string, facetT *facet);
void qh_printcentrum(qhT *qh, FILE *fp, facetT *facet, realT radius);
void qh_printend(qhT *qh, FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
void qh_printend4geom(qhT *qh, FILE *fp, facetT *facet, int *num, boolT printall);
void qh_printextremes(qhT *qh, FILE *fp, facetT *facetlist, setT *facets, boolT printall);
void qh_printextremes_2d(qhT *qh, FILE *fp, facetT *facetlist, setT *facets, boolT printall);
void qh_printextremes_d(qhT *qh, FILE *fp, facetT *facetlist, setT *facets, boolT printall);
void qh_printfacet(qhT *qh, FILE *fp, facetT *facet);
void qh_printfacet2math(qhT *qh, FILE *fp, facetT *facet, qh_PRINT format, int notfirst);
void qh_printfacet2geom(qhT *qh, FILE *fp, facetT *facet, realT color[3]);
void qh_printfacet2geom_points(qhT *qh, FILE *fp, pointT *point1, pointT *point2,
facetT *facet, realT offset, realT color[3]);
void qh_printfacet3math(qhT *qh, FILE *fp, facetT *facet, qh_PRINT format, int notfirst);
void qh_printfacet3geom_nonsimplicial(qhT *qh, FILE *fp, facetT *facet, realT color[3]);
void qh_printfacet3geom_points(qhT *qh, FILE *fp, setT *points, facetT *facet, realT offset, realT color[3]);
void qh_printfacet3geom_simplicial(qhT *qh, FILE *fp, facetT *facet, realT color[3]);
void qh_printfacet3vertex(qhT *qh, FILE *fp, facetT *facet, qh_PRINT format);
void qh_printfacet4geom_nonsimplicial(qhT *qh, FILE *fp, facetT *facet, realT color[3]);
void qh_printfacet4geom_simplicial(qhT *qh, FILE *fp, facetT *facet, realT color[3]);
void qh_printfacetNvertex_nonsimplicial(qhT *qh, FILE *fp, facetT *facet, int id, qh_PRINT format);
void qh_printfacetNvertex_simplicial(qhT *qh, FILE *fp, facetT *facet, qh_PRINT format);
void qh_printfacetheader(qhT *qh, FILE *fp, facetT *facet);
void qh_printfacetridges(qhT *qh, FILE *fp, facetT *facet);
void qh_printfacets(qhT *qh, FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
void qh_printhyperplaneintersection(qhT *qh, FILE *fp, facetT *facet1, facetT *facet2,
setT *vertices, realT color[3]);
void qh_printneighborhood(qhT *qh, FILE *fp, qh_PRINT format, facetT *facetA, facetT *facetB, boolT printall);
void qh_printline3geom(qhT *qh, FILE *fp, pointT *pointA, pointT *pointB, realT color[3]);
void qh_printpoint(qhT *qh, FILE *fp, const char *string, pointT *point);
void qh_printpointid(qhT *qh, FILE *fp, const char *string, int dim, pointT *point, int id);
void qh_printpoint3(qhT *qh, FILE *fp, pointT *point);
void qh_printpoints_out(qhT *qh, FILE *fp, facetT *facetlist, setT *facets, boolT printall);
void qh_printpointvect(qhT *qh, FILE *fp, pointT *point, coordT *normal, pointT *center, realT radius, realT color[3]);
void qh_printpointvect2(qhT *qh, FILE *fp, pointT *point, coordT *normal, pointT *center, realT radius);
void qh_printridge(qhT *qh, FILE *fp, ridgeT *ridge);
void qh_printspheres(qhT *qh, FILE *fp, setT *vertices, realT radius);
void qh_printvdiagram(qhT *qh, FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
int qh_printvdiagram2(qhT *qh, FILE *fp, printvridgeT printvridge, setT *vertices, qh_RIDGE innerouter, boolT inorder);
void qh_printvertex(qhT *qh, FILE *fp, vertexT *vertex);
void qh_printvertexlist(qhT *qh, FILE *fp, const char* string, facetT *facetlist,
setT *facets, boolT printall);
void qh_printvertices(qhT *qh, FILE *fp, const char* string, setT *vertices);
void qh_printvneighbors(qhT *qh, FILE *fp, facetT* facetlist, setT *facets, boolT printall);
void qh_printvoronoi(qhT *qh, FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
void qh_printvnorm(qhT *qh, FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded);
void qh_printvridge(qhT *qh, FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded);
void qh_produce_output(qhT *qh);
void qh_produce_output2(qhT *qh);
void qh_projectdim3(qhT *qh, pointT *source, pointT *destination);
int qh_readfeasible(qhT *qh, int dim, const char *curline);
coordT *qh_readpoints(qhT *qh, int *numpoints, int *dimension, boolT *ismalloc);
void qh_setfeasible(qhT *qh, int dim);
boolT qh_skipfacet(qhT *qh, facetT *facet);
char *qh_skipfilename(qhT *qh, char *filename);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* qhDEFio */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,67 @@
# -------------------------------------------------
# libqhull_r.pro -- Qt project for Qhull shared library
#
# It uses reentrant Qhull
# -------------------------------------------------
include(../qhull-warn.pri)
DESTDIR = ../../lib
DLLDESTDIR = ../../bin
TEMPLATE = lib
CONFIG += shared warn_on
CONFIG -= qt
build_pass:CONFIG(debug, debug|release):{
TARGET = qhull_rd
OBJECTS_DIR = Debug
}else:build_pass:CONFIG(release, debug|release):{
TARGET = qhull_r
OBJECTS_DIR = Release
}
win32-msvc* : QMAKE_LFLAGS += /INCREMENTAL:NO
win32-msvc* : DEF_FILE += ../../src/libqhull_r/qhull_r-exports.def
# libqhull_r/libqhull_r.pro and ../qhull-libqhull-src_r.pri have the same SOURCES and HEADERS
SOURCES += ../libqhull_r/global_r.c
SOURCES += ../libqhull_r/stat_r.c
SOURCES += ../libqhull_r/geom2_r.c
SOURCES += ../libqhull_r/poly2_r.c
SOURCES += ../libqhull_r/merge_r.c
SOURCES += ../libqhull_r/libqhull_r.c
SOURCES += ../libqhull_r/geom_r.c
SOURCES += ../libqhull_r/poly_r.c
SOURCES += ../libqhull_r/qset_r.c
SOURCES += ../libqhull_r/mem_r.c
SOURCES += ../libqhull_r/random_r.c
SOURCES += ../libqhull_r/usermem_r.c
SOURCES += ../libqhull_r/userprintf_r.c
SOURCES += ../libqhull_r/io_r.c
SOURCES += ../libqhull_r/user_r.c
SOURCES += ../libqhull_r/rboxlib_r.c
SOURCES += ../libqhull_r/userprintf_rbox_r.c
HEADERS += ../libqhull_r/geom_r.h
HEADERS += ../libqhull_r/io_r.h
HEADERS += ../libqhull_r/libqhull_r.h
HEADERS += ../libqhull_r/mem_r.h
HEADERS += ../libqhull_r/merge_r.h
HEADERS += ../libqhull_r/poly_r.h
HEADERS += ../libqhull_r/random_r.h
HEADERS += ../libqhull_r/qhull_ra.h
HEADERS += ../libqhull_r/qset_r.h
HEADERS += ../libqhull_r/stat_r.h
HEADERS += ../libqhull_r/user_r.h
OTHER_FILES += qh-geom_r.htm
OTHER_FILES += qh-globa_r.htm
OTHER_FILES += qh-io_r.htm
OTHER_FILES += qh-mem_r.htm
OTHER_FILES += qh-merge_r.htm
OTHER_FILES += qh-poly_r.htm
OTHER_FILES += qh-qhull_r.htm
OTHER_FILES += qh-set_r.htm
OTHER_FILES += qh-stat_r.htm
OTHER_FILES += qh-user_r.htm

View File

@ -0,0 +1,562 @@
/*<html><pre> -<a href="qh-mem_r.htm"
>-------------------------------</a><a name="TOP">-</a>
mem_r.c
memory management routines for qhull
See libqhull/mem_r.c for a standalone program.
To initialize memory:
qh_meminit(qh, stderr);
qh_meminitbuffers(qh, qh->IStracing, qh_MEMalign, 7, qh_MEMbufsize,qh_MEMinitbuf);
qh_memsize(qh, (int)sizeof(facetT));
qh_memsize(qh, (int)sizeof(facetT));
...
qh_memsetup(qh);
To free up all memory buffers:
qh_memfreeshort(qh, &curlong, &totlong);
if qh_NOmem,
malloc/free is used instead of mem.c
notes:
uses Quickfit algorithm (freelists for commonly allocated sizes)
assumes small sizes for freelists (it discards the tail of memory buffers)
see:
qh-mem_r.htm and mem_r.h
global_r.c (qh_initbuffers) for an example of using mem_r.c
Copyright (c) 1993-2015 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull_r/mem_r.c#5 $$Change: 2065 $
$DateTime: 2016/01/18 13:51:04 $$Author: bbarber $
*/
#include "libqhull_r.h" /* includes user_r.h and mem_r.h */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef qh_NOmem
/*============= internal functions ==============*/
static int qh_intcompare(const void *i, const void *j);
/*========== functions in alphabetical order ======== */
/*-<a href="qh-mem_r.htm#TOC"
>-------------------------------</a><a name="intcompare">-</a>
qh_intcompare( i, j )
used by qsort and bsearch to compare two integers
*/
static int qh_intcompare(const void *i, const void *j) {
return(*((const int *)i) - *((const int *)j));
} /* intcompare */
/*-<a href="qh-mem_r.htm#TOC"
>--------------------------------</a><a name="memalloc">-</a>
qh_memalloc( qh, insize )
returns object of insize bytes
qhmem is the global memory structure
returns:
pointer to allocated memory
errors if insufficient memory
notes:
use explicit type conversion to avoid type warnings on some compilers
actual object may be larger than insize
use qh_memalloc_() for inline code for quick allocations
logs allocations if 'T5'
caller is responsible for freeing the memory.
short memory is freed on shutdown by qh_memfreeshort unless qh_NOmem
design:
if size < qh->qhmem.LASTsize
if qh->qhmem.freelists[size] non-empty
return first object on freelist
else
round up request to size of qh->qhmem.freelists[size]
allocate new allocation buffer if necessary
allocate object from allocation buffer
else
allocate object with qh_malloc() in user.c
*/
void *qh_memalloc(qhT *qh, int insize) {
void **freelistp, *newbuffer;
int idx, size, n;
int outsize, bufsize;
void *object;
if (insize<0) {
qh_fprintf(qh, qh->qhmem.ferr, 6235, "qhull error (qh_memalloc): negative request size (%d). Did int overflow due to high-D?\n", insize); /* WARN64 */
qh_errexit(qh, qhmem_ERRmem, NULL, NULL);
}
if (insize>=0 && insize <= qh->qhmem.LASTsize) {
idx= qh->qhmem.indextable[insize];
outsize= qh->qhmem.sizetable[idx];
qh->qhmem.totshort += outsize;
freelistp= qh->qhmem.freelists+idx;
if ((object= *freelistp)) {
qh->qhmem.cntquick++;
qh->qhmem.totfree -= outsize;
*freelistp= *((void **)*freelistp); /* replace freelist with next object */
#ifdef qh_TRACEshort
n= qh->qhmem.cntshort+qh->qhmem.cntquick+qh->qhmem.freeshort;
if (qh->qhmem.IStracing >= 5)
qh_fprintf(qh, qh->qhmem.ferr, 8141, "qh_mem %p n %8d alloc quick: %d bytes (tot %d cnt %d)\n", object, n, outsize, qh->qhmem.totshort, qh->qhmem.cntshort+qh->qhmem.cntquick-qh->qhmem.freeshort);
#endif
return(object);
}else {
qh->qhmem.cntshort++;
if (outsize > qh->qhmem.freesize) {
qh->qhmem.totdropped += qh->qhmem.freesize;
if (!qh->qhmem.curbuffer)
bufsize= qh->qhmem.BUFinit;
else
bufsize= qh->qhmem.BUFsize;
if (!(newbuffer= qh_malloc((size_t)bufsize))) {
qh_fprintf(qh, qh->qhmem.ferr, 6080, "qhull error (qh_memalloc): insufficient memory to allocate short memory buffer (%d bytes)\n", bufsize);
qh_errexit(qh, qhmem_ERRmem, NULL, NULL);
}
*((void **)newbuffer)= qh->qhmem.curbuffer; /* prepend newbuffer to curbuffer
list. newbuffer!=0 by QH6080 */
qh->qhmem.curbuffer= newbuffer;
size= (sizeof(void **) + qh->qhmem.ALIGNmask) & ~qh->qhmem.ALIGNmask;
qh->qhmem.freemem= (void *)((char *)newbuffer+size);
qh->qhmem.freesize= bufsize - size;
qh->qhmem.totbuffer += bufsize - size; /* easier to check */
/* Periodically test totbuffer. It matches at beginning and exit of every call */
n = qh->qhmem.totshort + qh->qhmem.totfree + qh->qhmem.totdropped + qh->qhmem.freesize - outsize;
if (qh->qhmem.totbuffer != n) {
qh_fprintf(qh, qh->qhmem.ferr, 6212, "qh_memalloc internal error: short totbuffer %d != totshort+totfree... %d\n", qh->qhmem.totbuffer, n);
qh_errexit(qh, qhmem_ERRmem, NULL, NULL);
}
}
object= qh->qhmem.freemem;
qh->qhmem.freemem= (void *)((char *)qh->qhmem.freemem + outsize);
qh->qhmem.freesize -= outsize;
qh->qhmem.totunused += outsize - insize;
#ifdef qh_TRACEshort
n= qh->qhmem.cntshort+qh->qhmem.cntquick+qh->qhmem.freeshort;
if (qh->qhmem.IStracing >= 5)
qh_fprintf(qh, qh->qhmem.ferr, 8140, "qh_mem %p n %8d alloc short: %d bytes (tot %d cnt %d)\n", object, n, outsize, qh->qhmem.totshort, qh->qhmem.cntshort+qh->qhmem.cntquick-qh->qhmem.freeshort);
#endif
return object;
}
}else { /* long allocation */
if (!qh->qhmem.indextable) {
qh_fprintf(qh, qh->qhmem.ferr, 6081, "qhull internal error (qh_memalloc): qhmem has not been initialized.\n");
qh_errexit(qh, qhmem_ERRqhull, NULL, NULL);
}
outsize= insize;
qh->qhmem.cntlong++;
qh->qhmem.totlong += outsize;
if (qh->qhmem.maxlong < qh->qhmem.totlong)
qh->qhmem.maxlong= qh->qhmem.totlong;
if (!(object= qh_malloc((size_t)outsize))) {
qh_fprintf(qh, qh->qhmem.ferr, 6082, "qhull error (qh_memalloc): insufficient memory to allocate %d bytes\n", outsize);
qh_errexit(qh, qhmem_ERRmem, NULL, NULL);
}
if (qh->qhmem.IStracing >= 5)
qh_fprintf(qh, qh->qhmem.ferr, 8057, "qh_mem %p n %8d alloc long: %d bytes (tot %d cnt %d)\n", object, qh->qhmem.cntlong+qh->qhmem.freelong, outsize, qh->qhmem.totlong, qh->qhmem.cntlong-qh->qhmem.freelong);
}
return(object);
} /* memalloc */
/*-<a href="qh-mem_r.htm#TOC"
>--------------------------------</a><a name="memcheck">-</a>
qh_memcheck(qh)
*/
void qh_memcheck(qhT *qh) {
int i, count, totfree= 0;
void *object;
if (!qh) {
qh_fprintf_stderr(6243, "qh_memcheck(qh) error: qh is 0. It does not point to a qhT");
qh_exit(qhmem_ERRqhull); /* can not use qh_errexit() */
}
if (qh->qhmem.ferr == 0 || qh->qhmem.IStracing < 0 || qh->qhmem.IStracing > 10 || (((qh->qhmem.ALIGNmask+1) & qh->qhmem.ALIGNmask) != 0)) {
qh_fprintf_stderr(6244, "qh_memcheck error: either qh->qhmem is overwritten or qh->qhmem is not initialized. Call qh_mem_new() or qh_new_qhull() before calling qh_mem routines. ferr 0x%x IsTracing %d ALIGNmask 0x%x", qh->qhmem.ferr, qh->qhmem.IStracing, qh->qhmem.ALIGNmask);
qh_exit(qhmem_ERRqhull); /* can not use qh_errexit() */
}
if (qh->qhmem.IStracing != 0)
qh_fprintf(qh, qh->qhmem.ferr, 8143, "qh_memcheck: check size of freelists on qh->qhmem\nqh_memcheck: A segmentation fault indicates an overwrite of qh->qhmem\n");
for (i=0; i < qh->qhmem.TABLEsize; i++) {
count=0;
for (object= qh->qhmem.freelists[i]; object; object= *((void **)object))
count++;
totfree += qh->qhmem.sizetable[i] * count;
}
if (totfree != qh->qhmem.totfree) {
qh_fprintf(qh, qh->qhmem.ferr, 6211, "Qhull internal error (qh_memcheck): totfree %d not equal to freelist total %d\n", qh->qhmem.totfree, totfree);
qh_errexit(qh, qhmem_ERRqhull, NULL, NULL);
}
if (qh->qhmem.IStracing != 0)
qh_fprintf(qh, qh->qhmem.ferr, 8144, "qh_memcheck: total size of freelists totfree is the same as qh->qhmem.totfree\n", totfree);
} /* memcheck */
/*-<a href="qh-mem_r.htm#TOC"
>--------------------------------</a><a name="memfree">-</a>
qh_memfree(qh, object, insize )
free up an object of size bytes
size is insize from qh_memalloc
notes:
object may be NULL
type checking warns if using (void **)object
use qh_memfree_() for quick free's of small objects
design:
if size <= qh->qhmem.LASTsize
append object to corresponding freelist
else
call qh_free(object)
*/
void qh_memfree(qhT *qh, void *object, int insize) {
void **freelistp;
int idx, outsize;
if (!object)
return;
if (insize <= qh->qhmem.LASTsize) {
qh->qhmem.freeshort++;
idx= qh->qhmem.indextable[insize];
outsize= qh->qhmem.sizetable[idx];
qh->qhmem.totfree += outsize;
qh->qhmem.totshort -= outsize;
freelistp= qh->qhmem.freelists + idx;
*((void **)object)= *freelistp;
*freelistp= object;
#ifdef qh_TRACEshort
idx= qh->qhmem.cntshort+qh->qhmem.cntquick+qh->qhmem.freeshort;
if (qh->qhmem.IStracing >= 5)
qh_fprintf(qh, qh->qhmem.ferr, 8142, "qh_mem %p n %8d free short: %d bytes (tot %d cnt %d)\n", object, idx, outsize, qh->qhmem.totshort, qh->qhmem.cntshort+qh->qhmem.cntquick-qh->qhmem.freeshort);
#endif
}else {
qh->qhmem.freelong++;
qh->qhmem.totlong -= insize;
if (qh->qhmem.IStracing >= 5)
qh_fprintf(qh, qh->qhmem.ferr, 8058, "qh_mem %p n %8d free long: %d bytes (tot %d cnt %d)\n", object, qh->qhmem.cntlong+qh->qhmem.freelong, insize, qh->qhmem.totlong, qh->qhmem.cntlong-qh->qhmem.freelong);
qh_free(object);
}
} /* memfree */
/*-<a href="qh-mem_r.htm#TOC"
>-------------------------------</a><a name="memfreeshort">-</a>
qh_memfreeshort(qh, curlong, totlong )
frees up all short and qhmem memory allocations
returns:
number and size of current long allocations
notes:
if qh_NOmem (qh_malloc() for all allocations),
short objects (e.g., facetT) are not recovered.
use qh_freeqhull(qh, qh_ALL) instead.
see:
qh_freeqhull(qh, allMem)
qh_memtotal(qh, curlong, totlong, curshort, totshort, maxlong, totbuffer);
*/
void qh_memfreeshort(qhT *qh, int *curlong, int *totlong) {
void *buffer, *nextbuffer;
FILE *ferr;
*curlong= qh->qhmem.cntlong - qh->qhmem.freelong;
*totlong= qh->qhmem.totlong;
for (buffer= qh->qhmem.curbuffer; buffer; buffer= nextbuffer) {
nextbuffer= *((void **) buffer);
qh_free(buffer);
}
qh->qhmem.curbuffer= NULL;
if (qh->qhmem.LASTsize) {
qh_free(qh->qhmem.indextable);
qh_free(qh->qhmem.freelists);
qh_free(qh->qhmem.sizetable);
}
ferr= qh->qhmem.ferr;
memset((char *)&qh->qhmem, 0, sizeof(qh->qhmem)); /* every field is 0, FALSE, NULL */
qh->qhmem.ferr= ferr;
} /* memfreeshort */
/*-<a href="qh-mem_r.htm#TOC"
>--------------------------------</a><a name="meminit">-</a>
qh_meminit(qh, ferr )
initialize qhmem and test sizeof( void*)
Does not throw errors. qh_exit on failure
*/
void qh_meminit(qhT *qh, FILE *ferr) {
memset((char *)&qh->qhmem, 0, sizeof(qh->qhmem)); /* every field is 0, FALSE, NULL */
if (ferr)
qh->qhmem.ferr= ferr;
else
qh->qhmem.ferr= stderr;
if (sizeof(void*) < sizeof(int)) {
qh_fprintf(qh, qh->qhmem.ferr, 6083, "qhull internal error (qh_meminit): sizeof(void*) %d < sizeof(int) %d. qset.c will not work\n", (int)sizeof(void*), (int)sizeof(int));
qh_exit(qhmem_ERRqhull); /* can not use qh_errexit() */
}
if (sizeof(void*) > sizeof(ptr_intT)) {
qh_fprintf(qh, qh->qhmem.ferr, 6084, "qhull internal error (qh_meminit): sizeof(void*) %d > sizeof(ptr_intT) %d. Change ptr_intT in mem.h to 'long long'\n", (int)sizeof(void*), (int)sizeof(ptr_intT));
qh_exit(qhmem_ERRqhull); /* can not use qh_errexit() */
}
qh_memcheck(qh);
} /* meminit */
/*-<a href="qh-mem_r.htm#TOC"
>-------------------------------</a><a name="meminitbuffers">-</a>
qh_meminitbuffers(qh, tracelevel, alignment, numsizes, bufsize, bufinit )
initialize qhmem
if tracelevel >= 5, trace memory allocations
alignment= desired address alignment for memory allocations
numsizes= number of freelists
bufsize= size of additional memory buffers for short allocations
bufinit= size of initial memory buffer for short allocations
*/
void qh_meminitbuffers(qhT *qh, int tracelevel, int alignment, int numsizes, int bufsize, int bufinit) {
qh->qhmem.IStracing= tracelevel;
qh->qhmem.NUMsizes= numsizes;
qh->qhmem.BUFsize= bufsize;
qh->qhmem.BUFinit= bufinit;
qh->qhmem.ALIGNmask= alignment-1;
if (qh->qhmem.ALIGNmask & ~qh->qhmem.ALIGNmask) {
qh_fprintf(qh, qh->qhmem.ferr, 6085, "qhull internal error (qh_meminit): memory alignment %d is not a power of 2\n", alignment);
qh_errexit(qh, qhmem_ERRqhull, NULL, NULL);
}
qh->qhmem.sizetable= (int *) calloc((size_t)numsizes, sizeof(int));
qh->qhmem.freelists= (void **) calloc((size_t)numsizes, sizeof(void *));
if (!qh->qhmem.sizetable || !qh->qhmem.freelists) {
qh_fprintf(qh, qh->qhmem.ferr, 6086, "qhull error (qh_meminit): insufficient memory\n");
qh_errexit(qh, qhmem_ERRmem, NULL, NULL);
}
if (qh->qhmem.IStracing >= 1)
qh_fprintf(qh, qh->qhmem.ferr, 8059, "qh_meminitbuffers: memory initialized with alignment %d\n", alignment);
} /* meminitbuffers */
/*-<a href="qh-mem_r.htm#TOC"
>-------------------------------</a><a name="memsetup">-</a>
qh_memsetup(qh)
set up memory after running memsize()
*/
void qh_memsetup(qhT *qh) {
int k,i;
qsort(qh->qhmem.sizetable, (size_t)qh->qhmem.TABLEsize, sizeof(int), qh_intcompare);
qh->qhmem.LASTsize= qh->qhmem.sizetable[qh->qhmem.TABLEsize-1];
if(qh->qhmem.LASTsize >= qh->qhmem.BUFsize || qh->qhmem.LASTsize >= qh->qhmem.BUFinit) {
qh_fprintf(qh, qh->qhmem.ferr, 6087, "qhull error (qh_memsetup): largest mem size %d is >= buffer size %d or initial buffer size %d\n",
qh->qhmem.LASTsize, qh->qhmem.BUFsize, qh->qhmem.BUFinit);
qh_errexit(qh, qhmem_ERRmem, NULL, NULL);
}
if (!(qh->qhmem.indextable= (int *)qh_malloc((qh->qhmem.LASTsize+1) * sizeof(int)))) {
qh_fprintf(qh, qh->qhmem.ferr, 6088, "qhull error (qh_memsetup): insufficient memory\n");
qh_errexit(qh, qhmem_ERRmem, NULL, NULL);
}
for (k=qh->qhmem.LASTsize+1; k--; )
qh->qhmem.indextable[k]= k;
i= 0;
for (k=0; k <= qh->qhmem.LASTsize; k++) {
if (qh->qhmem.indextable[k] <= qh->qhmem.sizetable[i])
qh->qhmem.indextable[k]= i;
else
qh->qhmem.indextable[k]= ++i;
}
} /* memsetup */
/*-<a href="qh-mem_r.htm#TOC"
>-------------------------------</a><a name="memsize">-</a>
qh_memsize(qh, size )
define a free list for this size
*/
void qh_memsize(qhT *qh, int size) {
int k;
if(qh->qhmem.LASTsize) {
qh_fprintf(qh, qh->qhmem.ferr, 6089, "qhull error (qh_memsize): called after qhmem_setup\n");
qh_errexit(qh, qhmem_ERRqhull, NULL, NULL);
}
size= (size + qh->qhmem.ALIGNmask) & ~qh->qhmem.ALIGNmask;
for (k=qh->qhmem.TABLEsize; k--; ) {
if (qh->qhmem.sizetable[k] == size)
return;
}
if (qh->qhmem.TABLEsize < qh->qhmem.NUMsizes)
qh->qhmem.sizetable[qh->qhmem.TABLEsize++]= size;
else
qh_fprintf(qh, qh->qhmem.ferr, 7060, "qhull warning (memsize): free list table has room for only %d sizes\n", qh->qhmem.NUMsizes);
} /* memsize */
/*-<a href="qh-mem_r.htm#TOC"
>-------------------------------</a><a name="memstatistics">-</a>
qh_memstatistics(qh, fp )
print out memory statistics
Verifies that qh->qhmem.totfree == sum of freelists
*/
void qh_memstatistics(qhT *qh, FILE *fp) {
int i;
int count;
void *object;
qh_memcheck(qh);
qh_fprintf(qh, fp, 9278, "\nmemory statistics:\n\
%7d quick allocations\n\
%7d short allocations\n\
%7d long allocations\n\
%7d short frees\n\
%7d long frees\n\
%7d bytes of short memory in use\n\
%7d bytes of short memory in freelists\n\
%7d bytes of dropped short memory\n\
%7d bytes of unused short memory (estimated)\n\
%7d bytes of long memory allocated (max, except for input)\n\
%7d bytes of long memory in use (in %d pieces)\n\
%7d bytes of short memory buffers (minus links)\n\
%7d bytes per short memory buffer (initially %d bytes)\n",
qh->qhmem.cntquick, qh->qhmem.cntshort, qh->qhmem.cntlong,
qh->qhmem.freeshort, qh->qhmem.freelong,
qh->qhmem.totshort, qh->qhmem.totfree,
qh->qhmem.totdropped + qh->qhmem.freesize, qh->qhmem.totunused,
qh->qhmem.maxlong, qh->qhmem.totlong, qh->qhmem.cntlong - qh->qhmem.freelong,
qh->qhmem.totbuffer, qh->qhmem.BUFsize, qh->qhmem.BUFinit);
if (qh->qhmem.cntlarger) {
qh_fprintf(qh, fp, 9279, "%7d calls to qh_setlarger\n%7.2g average copy size\n",
qh->qhmem.cntlarger, ((float)qh->qhmem.totlarger)/(float)qh->qhmem.cntlarger);
qh_fprintf(qh, fp, 9280, " freelists(bytes->count):");
}
for (i=0; i < qh->qhmem.TABLEsize; i++) {
count=0;
for (object= qh->qhmem.freelists[i]; object; object= *((void **)object))
count++;
qh_fprintf(qh, fp, 9281, " %d->%d", qh->qhmem.sizetable[i], count);
}
qh_fprintf(qh, fp, 9282, "\n\n");
} /* memstatistics */
/*-<a href="qh-mem_r.htm#TOC"
>-------------------------------</a><a name="NOmem">-</a>
qh_NOmem
turn off quick-fit memory allocation
notes:
uses qh_malloc() and qh_free() instead
*/
#else /* qh_NOmem */
void *qh_memalloc(qhT *qh, int insize) {
void *object;
if (!(object= qh_malloc((size_t)insize))) {
qh_fprintf(qh, qh->qhmem.ferr, 6090, "qhull error (qh_memalloc): insufficient memory\n");
qh_errexit(qh, qhmem_ERRmem, NULL, NULL);
}
qh->qhmem.cntlong++;
qh->qhmem.totlong += insize;
if (qh->qhmem.maxlong < qh->qhmem.totlong)
qh->qhmem.maxlong= qh->qhmem.totlong;
if (qh->qhmem.IStracing >= 5)
qh_fprintf(qh, qh->qhmem.ferr, 8060, "qh_mem %p n %8d alloc long: %d bytes (tot %d cnt %d)\n", object, qh->qhmem.cntlong+qh->qhmem.freelong, insize, qh->qhmem.totlong, qh->qhmem.cntlong-qh->qhmem.freelong);
return object;
}
void qh_memfree(qhT *qh, void *object, int insize) {
if (!object)
return;
qh_free(object);
qh->qhmem.freelong++;
qh->qhmem.totlong -= insize;
if (qh->qhmem.IStracing >= 5)
qh_fprintf(qh, qh->qhmem.ferr, 8061, "qh_mem %p n %8d free long: %d bytes (tot %d cnt %d)\n", object, qh->qhmem.cntlong+qh->qhmem.freelong, insize, qh->qhmem.totlong, qh->qhmem.cntlong-qh->qhmem.freelong);
}
void qh_memfreeshort(qhT *qh, int *curlong, int *totlong) {
*totlong= qh->qhmem.totlong;
*curlong= qh->qhmem.cntlong - qh->qhmem.freelong;
memset((char *)&qh->qhmem, 0, sizeof(qh->qhmem)); /* every field is 0, FALSE, NULL */
}
void qh_meminit(qhT *qh, FILE *ferr) {
memset((char *)&qh->qhmem, 0, sizeof(qh->qhmem)); /* every field is 0, FALSE, NULL */
if (ferr)
qh->qhmem.ferr= ferr;
else
qh->qhmem.ferr= stderr;
if (sizeof(void*) < sizeof(int)) {
qh_fprintf(qh, qh->qhmem.ferr, 6091, "qhull internal error (qh_meminit): sizeof(void*) %d < sizeof(int) %d. qset.c will not work\n", (int)sizeof(void*), (int)sizeof(int));
qh_errexit(qh, qhmem_ERRqhull, NULL, NULL);
}
}
void qh_meminitbuffers(qhT *qh, int tracelevel, int alignment, int numsizes, int bufsize, int bufinit) {
qh->qhmem.IStracing= tracelevel;
}
void qh_memsetup(qhT *qh) {
}
void qh_memsize(qhT *qh, int size) {
}
void qh_memstatistics(qhT *qh, FILE *fp) {
qh_fprintf(qh, fp, 9409, "\nmemory statistics:\n\
%7d long allocations\n\
%7d long frees\n\
%7d bytes of long memory allocated (max, except for input)\n\
%7d bytes of long memory in use (in %d pieces)\n",
qh->qhmem.cntlong,
qh->qhmem.freelong,
qh->qhmem.maxlong, qh->qhmem.totlong, qh->qhmem.cntlong - qh->qhmem.freelong);
}
#endif /* qh_NOmem */
/*-<a href="qh-mem_r.htm#TOC"
>-------------------------------</a><a name="memtotlong">-</a>
qh_memtotal(qh, totlong, curlong, totshort, curshort, maxlong, totbuffer )
Return the total, allocated long and short memory
returns:
Returns the total current bytes of long and short allocations
Returns the current count of long and short allocations
Returns the maximum long memory and total short buffer (minus one link per buffer)
Does not error (for deprecated UsingLibQhull.cpp (libqhullpcpp))
*/
void qh_memtotal(qhT *qh, int *totlong, int *curlong, int *totshort, int *curshort, int *maxlong, int *totbuffer) {
*totlong= qh->qhmem.totlong;
*curlong= qh->qhmem.cntlong - qh->qhmem.freelong;
*totshort= qh->qhmem.totshort;
*curshort= qh->qhmem.cntshort + qh->qhmem.cntquick - qh->qhmem.freeshort;
*maxlong= qh->qhmem.maxlong;
*totbuffer= qh->qhmem.totbuffer;
} /* memtotlong */

Some files were not shown because too many files have changed in this diff Show More