Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: predicates test

on:
workflow_dispatch:
pull_request:
push:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3

- name: Print environment
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}

- name: Install dependencies on unx
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
g++ --version

- name: Build predicates
run: |
cd ${{github.workspace}}
ls
g++ -std=c++17 -pedantic -Wall -O3 -flto -DNDEBUG \
example.cpp -oexample

- name: Check predicates
run: |
./example
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ bisect3d: orientation of point wrt. half-space in E^3.
bisect3w: orientation of point wrt. half-space in E^3 (weighted).
inball3d: point-in-circumball (Delaunay-Voronoi tessellations) in E^3.
inball3w: point-in-ortho-ball (Regular-Laguerre tessellations) in E^3.

orient4d: orientation of 5 points in E^4, or a point wrt. a cell.
bisect4d: orientation of point wrt. half-space in E^4.
bisect4w: orientation of point wrt. half-space in E^4 (weighted).
````
A simplified two-stage variation on <a href=https://doi.org/10.1007/PL00009321>Shewchuk's original arithmetic</a> is employed, adopting standard (fast!) floating-point approximations when results are unambiguous and falling back onto (slower) arbitrary precision evaluations as necessary to guarantee "sign-correctness". Semi-static filters are used to toggle between floating-point and arbitrary precision kernels. An optional third (intermediate) stage based on interval arithmetic is also available.

Expand Down
6 changes: 3 additions & 3 deletions basebase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
*
------------------------------------------------------------
*
* Last updated: 02 March, 2020
* Last updated: 11 May., 2024
*
* Copyright 2013-2020
* Copyright 2020--
* Darren Engwirda
* de2363@columbia.edu
* d.engwirda@gmail.com
* https://github.com/dengwirda/
*
------------------------------------------------------------
Expand Down
56 changes: 56 additions & 0 deletions example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,62 @@ int main () {
std::cout << "inball3w: " << _rr;
std::cout << std::endl;

/*-------------------------------- test prediactes in E^4 */

double _P1[5] = { // (d+1) coord. is weight
+0.0, +0.0, +0.0, +0.0, +0.0
} ;
double _P2[5] = {
+1.0, +0.0, +0.0, +0.0, +0.1
} ;
double _P3[5] = {
+1.0, +1.0, +0.0, +0.0, +0.2
} ;
double _P4[5] = {
+1.0, +1.0, +1.0, +0.0, +0.3
} ;
// double _P5[5] = {
// +1.0, +1.0, +1.0, +1.0, +0.4
// } ;

double _Q4[5] = {
+0.5, +0.5, +0.5, +0.5, +0.0
} ;

// Test the orienation of the point QQ wrt. the cell
// P1, P2, P3, P4 in E^4.

_rr = geompred::orient4d (
_P1, _P2, _P3, _P4, _Q4
) ;

std::cout << "orient4d: " << _rr;
std::cout << std::endl;

// Test the orienation of the point QQ wrt. the half-
// space of P1, P2.

// This is the unweighted case in E^4.

_rr = geompred::bisect4d (
_P1, _P2, _Q4
) ;

std::cout << "bisect4d: " << _rr;
std::cout << std::endl;

// Test the orienation of the point QQ wrt. the half-
// space of P1, P2.

// This is the "weighted" case in E^4.

_rr = geompred::bisect4w (
_P1, _P2, _Q4
) ;

std::cout << "bisect4w: " << _rr;
std::cout << std::endl;

return 0 ;
}

Expand Down
20 changes: 12 additions & 8 deletions expansion/dd_float.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,24 @@
* how they can obtain it for free, then you are not
* required to make any arrangement with me.)
*
* Disclaimer: Neither I nor: Columbia University, The
* Massachusetts Institute of Technology, The
* University of Sydney, nor The National Aeronautics
* and Space Administration warrant this code in any
* way whatsoever. This code is provided "as-is" to be
* used at your own risk.
* Disclaimer: Neither I nor THE CONTRIBUTORS warrant
* this code in any way whatsoever. This code is
* provided "as-is" to be used at your own risk.
*
* THE CONTRIBUTORS include:
* (a) The University of Sydney
* (b) The Massachusetts Institute of Technology
* (c) Columbia University
* (d) The National Aeronautics & Space Administration
* (e) Los Alamos National Laboratory
*
--------------------------------------------------------
*
* Last updated: 16 April, 2020
* Last updated: 16 Apr., 2020
*
* Copyright 2020--
* Darren Engwirda
* de2363@columbia.edu
* d.engwirda@gmail.com
* https://github.com/dengwirda/
*
--------------------------------------------------------
Expand Down
20 changes: 12 additions & 8 deletions expansion/ia_float.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,24 @@
* how they can obtain it for free, then you are not
* required to make any arrangement with me.)
*
* Disclaimer: Neither I nor: Columbia University, The
* Massachusetts Institute of Technology, The
* University of Sydney, nor The National Aeronautics
* and Space Administration warrant this code in any
* way whatsoever. This code is provided "as-is" to be
* used at your own risk.
* Disclaimer: Neither I nor THE CONTRIBUTORS warrant
* this code in any way whatsoever. This code is
* provided "as-is" to be used at your own risk.
*
* THE CONTRIBUTORS include:
* (a) The University of Sydney
* (b) The Massachusetts Institute of Technology
* (c) Columbia University
* (d) The National Aeronautics & Space Administration
* (e) Los Alamos National Laboratory
*
--------------------------------------------------------
*
* Last updated: 10 April, 2020
* Last updated: 10 Apr., 2020
*
* Copyright 2020--
* Darren Engwirda
* de2363@columbia.edu
* d.engwirda@gmail.com
* https://github.com/dengwirda/
*
--------------------------------------------------------
Expand Down
20 changes: 12 additions & 8 deletions expansion/mp_basic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,24 @@
* how they can obtain it for free, then you are not
* required to make any arrangement with me.)
*
* Disclaimer: Neither I nor: Columbia University, The
* Massachusetts Institute of Technology, The
* University of Sydney, nor The National Aeronautics
* and Space Administration warrant this code in any
* way whatsoever. This code is provided "as-is" to be
* used at your own risk.
* Disclaimer: Neither I nor THE CONTRIBUTORS warrant
* this code in any way whatsoever. This code is
* provided "as-is" to be used at your own risk.
*
* THE CONTRIBUTORS include:
* (a) The University of Sydney
* (b) The Massachusetts Institute of Technology
* (c) Columbia University
* (d) The National Aeronautics & Space Administration
* (e) Los Alamos National Laboratory
*
--------------------------------------------------------
*
* Last updated: 16 April, 2020
* Last updated: 16 Apr., 2020
*
* Copyright 2020--
* Darren Engwirda
* de2363@columbia.edu
* d.engwirda@gmail.com
* https://github.com/dengwirda/
*
--------------------------------------------------------
Expand Down
57 changes: 47 additions & 10 deletions expansion/mp_float.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,24 @@
* how they can obtain it for free, then you are not
* required to make any arrangement with me.)
*
* Disclaimer: Neither I nor: Columbia University, The
* Massachusetts Institute of Technology, The
* University of Sydney, nor The National Aeronautics
* and Space Administration warrant this code in any
* way whatsoever. This code is provided "as-is" to be
* used at your own risk.
* Disclaimer: Neither I nor THE CONTRIBUTORS warrant
* this code in any way whatsoever. This code is
* provided "as-is" to be used at your own risk.
*
* THE CONTRIBUTORS include:
* (a) The University of Sydney
* (b) The Massachusetts Institute of Technology
* (c) Columbia University
* (d) The National Aeronautics & Space Administration
* (e) Los Alamos National Laboratory
*
--------------------------------------------------------
*
* Last updated: 07 April, 2020
* Last updated: 05 Jun., 2022
*
* Copyright 2020--
* Darren Engwirda
* de2363@columbia.edu
* d.engwirda@gmail.com
* https://github.com/dengwirda/
*
--------------------------------------------------------
Expand Down Expand Up @@ -95,7 +99,7 @@

indx_type static constexpr _size = N ;

real_type _xdat [ N ] ;
real_type _xdat [ N ] = { 0. } ;
indx_type _xlen = 0 ;

public :
Expand Down Expand Up @@ -930,7 +934,8 @@

template <
size_t AX, size_t BX, size_t AY,
size_t BY, size_t NP
size_t BY,
size_t NP
>
__inline_call void expansion_dot (
expansion <AX> const& _xa,
Expand Down Expand Up @@ -976,6 +981,38 @@
expansion_add(_xp, _yp, _zp, _dp);
}

template <
size_t AX, size_t BX, size_t AY,
size_t BY, size_t AZ, size_t BZ,
size_t AQ, size_t BQ,
size_t NP
>
__inline_call void expansion_dot (
expansion <AX> const& _xa,
expansion <BX> const& _xb,
expansion <AY> const& _ya,
expansion <BY> const& _yb,
expansion <AZ> const& _za,
expansion <BZ> const& _zb,
expansion <AQ> const& _qa,
expansion <BQ> const& _qb,
expansion <NP> & _dp
) // 4-dim dotproduct
{
expansion<mul_alloc(AX, BX)> _xp ;
expansion_mul(_xa, _xb, _xp);

expansion<mul_alloc(AY, BY)> _yp ;
expansion_mul(_ya, _yb, _yp);

expansion<mul_alloc(AZ, BZ)> _zp ;
expansion_mul(_za, _zb, _zp);

expansion<mul_alloc(AQ, BQ)> _qp ;
expansion_mul(_qa, _qb, _qp);

expansion_add(_xp, _yp, _zp, _qp, _dp) ;
}

# undef REAL_TYPE
# undef INDX_TYPE
Expand Down
Loading