| 1 | /************************************************************************* |
| 2 | * * |
| 3 | * Vega FEM Simulation Library Version 3.1 * |
| 4 | * * |
| 5 | * "windingNumber" library , Copyright (C) 2016 USC * |
| 6 | * All rights reserved. * |
| 7 | * * |
| 8 | * Code author: Yijing Li * |
| 9 | * http://www.jernejbarbic.com/code * |
| 10 | * * |
| 11 | * Funding: National Science Foundation * |
| 12 | * * |
| 13 | * This library is free software; you can redistribute it and/or * |
| 14 | * modify it under the terms of the BSD-style license that is * |
| 15 | * included with this library in the file LICENSE.txt * |
| 16 | * * |
| 17 | * This library is distributed in the hope that it will be useful, * |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file * |
| 20 | * LICENSE.TXT for more details. * |
| 21 | * * |
| 22 | *************************************************************************/ |
| 23 | |
| 24 | /* |
| 25 | Computes the winding number of a 3D point with respect to a given |
| 26 | closed manifold triangle mesh, as described in: |
| 27 | |
| 28 | Alec Jacobson, Ladislav Kavan, Olga Sorkine-Hornung: |
| 29 | Robust Inside-Outside Segmentation using Generalized Winding Numbers, SIGGRAPH 2013 |
| 30 | |
| 31 | This implementation does not use the hierarchical acceleration presented |
| 32 | in the paper above; instead, it loops over all the triangles. |
| 33 | */ |
| 34 | |
| 35 | #ifndef _WINDINGNUMBER_H_ |
| 36 | #define _WINDINGNUMBER_H_ |
| 37 | |
| 38 | #include "objMesh.h" |
| 39 | #include "minivector.h" |
| 40 | |
| 41 | class WindingNumber |
| 42 | { |
| 43 | public: |
| 44 | |
| 45 | // computes the winding number of point p with respect to the given mesh |
| 46 | static double computeWindingNumber(ObjMesh * objMesh, const Vec3d & p); |
| 47 | }; |
| 48 | |
| 49 | #endif |
| 50 |