Main Page Class List Class Members

- Main Page
- User's Guide
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# sdk/extensions/authoring/source/VHACD/inc/vhacdICHull.h

Go to the documentation of this file.

    00001 /* Copyright (c) 2011 Khaled Mamou (kmamou at gmail dot com)
    00002  All rights reserved.
    00003
    00004
    00005  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
    00006
    00007  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    00008
    00009  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    00010
    00011  3. The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
    00012
    00013  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00014  */
    00015 #pragma once
    00016 #ifndef VHACD_ICHULL_H
    00017 #define VHACD_ICHULL_H
    00018 #include "vhacdManifoldMesh.h"
    00019 #include "vhacdVector.h"
    00020
    00021 namespace VHACD {
    00023 enum ICHullError {
    00024     ICHullErrorOK = 0,
    00025     ICHullErrorCoplanarPoints,
    00026     ICHullErrorNoVolume,
    00027     ICHullErrorInconsistent,
    00028     ICHullErrorNotEnoughPoints
    00029 };
    00030 class ICHull {
    00031 public:
    00032     static const double sc_eps;
    00034     bool IsFlat() { return m_isFlat; }
    00036     TMMesh& GetMesh() { return m_mesh; }
    00038     bool AddPoint(const Vec3<double>& point) { return AddPoints(&point, 1); }
    00040     bool AddPoint(const Vec3<double>& point, int32_t id);
    00042     bool AddPoints(const Vec3<double>* points, size_t nPoints);
    00044     ICHullError Process();
    00046     ICHullError Process(const uint32_t nPointsCH, const double minVolume = 0.0);
    00048     bool IsInside(const Vec3<double>& pt0, const double eps = 0.0);
    00050     const ICHull& operator=(ICHull& rhs);
    00051
    00053     ICHull();
    00055     ~ICHull(void){};
    00056
    00057 private:
    00059     ICHullError DoubleTriangle();
    00061     CircularListElement<TMMTriangle>* MakeFace(CircularListElement<TMMVertex>* v0,
    00062         CircularListElement<TMMVertex>* v1,
    00063         CircularListElement<TMMVertex>* v2,
    00064         CircularListElement<TMMTriangle>* fold);
    00066     CircularListElement<TMMTriangle>* MakeConeFace(CircularListElement<TMMEdge>* e, CircularListElement<TMMVertex>* v);
    00068     bool ProcessPoint();
    00070     bool ComputePointVolume(double& totalVolume, bool markVisibleFaces);
    00072     bool FindMaxVolumePoint(const double minVolume = 0.0);
    00074     bool CleanEdges();
    00076     bool CleanVertices(uint32_t& addedPoints);
    00078     bool CleanTriangles();
    00080     bool CleanUp(uint32_t& addedPoints);
    00082     bool MakeCCW(CircularListElement<TMMTriangle>* f,
    00083         CircularListElement<TMMEdge>* e,
    00084         CircularListElement<TMMVertex>* v);
    00085     void Clear();
    00086
    00087 private:
    00088     static const int32_t sc_dummyIndex;
    00089     TMMesh m_mesh;
    00090     SArray<CircularListElement<TMMEdge>*> m_edgesToDelete;
    00091     SArray<CircularListElement<TMMEdge>*> m_edgesToUpdate;
    00092     SArray<CircularListElement<TMMTriangle>*> m_trianglesToDelete;
    00093     Vec3<double> m_normal;
    00094     bool m_isFlat;
    00095     ICHull(const ICHull& rhs);
    00096 };
    00097 }
    00098 #endif // VHACD_ICHULL_H

Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com