DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
/* Stan Melax Convex Hull Computation Copyright (c) 2008 Stan Melax http://www.melax.com/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ ///includes modifications/improvements by John Ratcliff, see BringOutYourDead below. #ifndef CD_HULL_H #define CD_HULL_H #include "LinearMath/btVector3.h" class HullResult { public: HullResult(void) { mPolygons = true; mNumOutputVertices = 0; mOutputVertices = 0; mNumFaces = 0; mNumIndices = 0; mIndices = 0; } bool mPolygons; // true if indices represents polygons, false indices are triangles unsigned int mNumOutputVertices; // number of vertices in the output hull btVector3 *mOutputVertices; // array of vertices unsigned int mNumFaces; // the number of faces produced unsigned int mNumIndices; // the total number of indices unsigned int *mIndices; // pointer to indices. // If triangles, then indices are array indexes into the vertex list. // If polygons, indices are in the form (number of points in face) (p1, p2, p3, ..) etc.. }; enum HullFlag { QF_TRIANGLES = (1<<0), // report results as triangles, not polygons. QF_REVERSE_ORDER = (1<<1), // reverse order of the triangle indices. QF_DEFAULT = QF_TRIANGLES }; class HullDesc { public: HullDesc(void) { mFlags = QF_DEFAULT; mVcount = 0; mVertices = 0; mVertexStride = sizeof(btVector3); mNormalEpsilon = 0.001f; mMaxVertices = 4096; // maximum number of points to be considered for a convex hull. mMaxFaces = 4096; }; HullDesc(HullFlag flag, unsigned int vcount, const btVector3 *vertices, unsigned int stride = sizeof(btVector3)) { mFlags = flag; mVcount = vcount; mVertices = vertices; mVertexStride = stride; mNormalEpsilon = btScalar(0.001); mMaxVertices = 4096; } bool HasHullFlag(HullFlag flag) const { if ( mFlags & flag ) return true; return false; } void SetHullFlag(HullFlag flag) { mFlags|=flag; } void ClearHullFlag(HullFlag flag) { mFlags&=~flag; } unsigned int mFlags; // flags to use when generating the convex hull. unsigned int mVcount; // number of vertices in the input point cloud const btVector3 *mVertices; // the array of vertices. unsigned int mVertexStride; // the stride of each vertex, in bytes. btScalar mNormalEpsilon; // the epsilon for removing duplicates. This is a normalized value, if normalized bit is on. unsigned int mMaxVertices; // maximum number of vertices to be considered for the hull! unsigned int mMaxFaces; }; enum HullError { QE_OK, // success! QE_FAIL // failed. }; class HullLibrary { public: HullError CreateConvexHull(const HullDesc& desc, // describes the input request HullResult& result); // contains the resulst HullError ReleaseResult(HullResult &result); // release memory allocated for this result, we are done with it. private: //BringOutYourDead (John Ratcliff): When you create a convex hull you hand it a large input set of vertices forming a 'point cloud'. //After the hull is generated it give you back a set of polygon faces which index the *original* point cloud. //The thing is, often times, there are many 'dead vertices' in the point cloud that are on longer referenced by the hull. //The routine 'BringOutYourDead' find only the referenced vertices, copies them to an new buffer, and re-indexes the hull so that it is a minimal representation. void BringOutYourDead(const btVector3* verts,unsigned int vcount, btVector3* overts,unsigned int &ocount,unsigned int* indices,unsigned indexcount); bool CleanupVertices(unsigned int svcount, const btVector3* svertices, unsigned int stride, unsigned int &vcount, // output number of vertices btVector3* vertices, // location to store the results. btScalar normalepsilon, btVector3& scale); }; #endif
btConvexHull.h
Page URL
File URL
Prev
2/6
Next
Download
( 4 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.