Utils3d.h
Upload User: hcfgz168
Upload Date: 2011-09-11
Package Size: 116k
Code Size: 4k
Category:

OpenGL program

Development Platform:

WINDOWS

  1. //********************************************
  2. // Utils3d.h
  3. //********************************************
  4. // pierre.alliez@cnet.francetelecom.fr
  5. // Created : 29/01/97
  6. // Modified : 19/02/97
  7. //********************************************
  8. #ifndef _UTILS_3D_
  9. #define _UTILS_3D_
  10. #include "Base3d.h"
  11. // Rounding
  12. int round(double x);
  13. // Angle between faces
  14. double SinAngle(CFace3d *pFace1,CFace3d *pFace2);
  15. double CosAngle(CFace3d *pFace1,CFace3d *pFace2);
  16. double Angle(CFace3d *pFace1,CFace3d *pFace2);
  17. double Angle(CVector3d *pU,CVector3d *pV);
  18. // Distance
  19. double DistanceSquare(CVertex3d *pVertex1,CVertex3d *pVertex2);
  20. double Distance(CVertex3d *pVertex1,CVertex3d *pVertex2);
  21. double SquareDistanceVertexToFaceIfInf(CVertex3d *pVertex,CFace3d *pFace,
  22.  CVertex3d *pVertexProjected,double OldDistance);
  23. double SquareDistanceVertexToFace(CVertex3d *pVertex,CFace3d *pFace,CVertex3d *pVertexProjected);
  24. double SquareDistanceToSetOfFace(CVertex3d *pVertex,CVertex3d *pVertexRef,
  25.  CFace3d **ppFace,CArray3d<CFace3d> &ArrayFace);
  26. double MaxSquareDistanceVertexFace(CArray3d<CVertex3d> *pArrayVertex,CArray3d<CFace3d> *pArrayFace,
  27. CVertex3d **ppVertex=NULL,CFace3d **pFace=NULL);
  28. // Operators on vectors
  29. CVector3d Inner(CVector3d* u,CVector3d* v);
  30. double Scalar(CVector3d *pV1,CVector3d *pV2);
  31. double Scalar(CVector3d &v1,CVector3d &v2);
  32. int OppositePerCoord(CVector3d *pV1,CVector3d *pV2);
  33. // Vertex / faces
  34. int VertexInFace(CVertex3d *pVertex,CFace3d *pFace);
  35. // Faces
  36. int AddFaceNoDuplicate(CArray3d<CFace3d> &array,CFace3d *pFace);
  37. int AddFaceRecursive(CArray3d<CFace3d> &array,CFace3d *pFace,CVertex3d *pVertex);
  38. // Sharp edges
  39. int NbSharpEdge(CArray3d<CFace3d> &array,double threshold);
  40. // Normals 
  41. int NormalSum(CArray3d<CFace3d> &array,double *pSum);
  42. int NormalMax(CArray3d<CFace3d> &array,double *pMax);
  43. int MaxAngleBetweenFaces(CArray3d<CFace3d> &array,double *pMax);
  44. // Plane
  45. int PlaneEquation(CFace3d *pFace,float *a,float *b,float *c,float *d);
  46. // Vertex / segment
  47. int VertexOnSegment(CVertex3d *pVertex,CVertex3d *pV1,CVertex3d *pV2);
  48. // Projection
  49. int ProjectPointOnPlane(CVertex3d *pVertex,CVertex3d *pVertexProjected,float a,float b,float c,float d);
  50. int ProjectPointOnFace(CVertex3d *pVertex,CFace3d *pFace,CVertex3d *pVertexProjected);
  51. int ProjectVertexOnLine(CVertex3d *pVertex,CVertex3d *pVa,CVertex3d *pVb,CVertex3d *pVertexProjected);
  52. // Spring
  53. float Spring(CVertex3d *pVertex,float k);
  54. // Area
  55. double Area(CVertex3d *pV0,CVertex3d *pV1,CVertex3d *pV2);
  56. double FormFunction(CVertex3d *pV0,CVertex3d *pV1,CVertex3d *pV2,CVertex3d *pV3);
  57. double GetMeanArea(CArray3d<CFace3d> *pArrayFace);
  58. double GetMinArea(CArray3d<CFace3d> *pArrayFace);
  59. // Intersections
  60. int IntersectionLineFace(CVertex3d *pV0,CVertex3d *pV1,CFace3d *pFace,CVertex3d *pVertexResult);
  61. int IntersectionLineFaceRecursive(CVertex3d *pV0,CVertex3d *pV1,CFace3d *pFaceStart,CVertex3d *pVertexResult,
  62. CFace3d **ppFaceResult,CArray3d<CFace3d> *pArrayFace,int MaxNbFace);
  63. int NearestIntersectionWithLine(CVertex3d *pV0,CVertex3d *pV1,CFace3d *pFaceStart,
  64. CVertex3d *pVertexResult,CFace3d **ppFaceResult,int MaxNbFace);
  65. int NearestIntersectionWithLine(CArray3d<CFace3d> *pArrayFace,CVertex3d *pV0,CVertex3d *pV1,
  66. CVertex3d *pVertexResult,CFace3d **ppFaceResult,int *pNbVisitedFace);
  67. int NearestIntersectionWithLineFromFaceAndNeighbors(CFace3d *pFace,CVertex3d *pV0,CVertex3d *pV1,
  68. CVertex3d *pVertexResult,CFace3d **ppFaceResult);
  69. int GravityCenter(CArray3d<CVertex3d> *pArray,CVertex3d *pVertexCenter);
  70. #endif // _UTILS_3D_