NanoShaper
0.3.1
NanoShaper is a tool able to triangulate and inspect an arbitray triangulated surface or several types of molecular surfaces such as the Gaussian, Skin and the SES
|
This class represents a converter from an arbitray triangulated mesh surface to a DelPhi compatible representation. Vertex normals are computed by averaging among surrounding plane normals. More...
#include <MeshSurface.h>
Public Member Functions | |
MeshSurface () | |
MeshSurface (DelPhiShared *ds) | |
virtual bool | build () |
virtual void | postRayCasting () |
virtual bool | preBoundaryProjection () |
virtual bool | save (char *fileName) |
virtual bool | load (char *fileName) |
bool | loadMSMS (char *fileName, int numFiles=1) |
virtual void | printSummary () |
virtual bool | getProjection (double p[3], double *proj1, double *proj2, double *proj3, double *normal1, double *normal2, double *normal3) |
virtual void | getRayIntersection (double p1[3], double p2[3], vector< pair< double, double * > > &intersections, int thdID) |
void | setAuxGrid (unsigned int dim, unsigned int max) |
void | setAuxGrid2D (unsigned int dim, unsigned int max) |
Protected Member Functions | |
virtual void | preProcessPanel () |
void | preProcessTriangles () |
bool | buildAuxiliaryGrid () |
int | intersect_triangle (double orig[3], double dir[3], double vert0[3], double vert1[3], double vert2[3], double *t, double *u, double *v) |
bool | point2triangle (double P[3], double A[3], double B[3], double C[3], double w[4], double *proj, double *dist, double *normal, int planeID, int va, int vb, int vc) |
void | point2plane (double p[3], double w[4], double *dist, double proj[3]) |
bool | inTriangle (double P[3], double A[3], double B[3], double C[3]) |
bool | checkDuplicates () |
bool | loadOFF (char *fileName) |
bool | loadPLY (char *fileName) |
Protected Attributes | |
unsigned int | MAX_TRIANGLES |
unsigned int | AUX_GRID_DIM |
unsigned int | MAX_TRIANGLES_2D |
unsigned int | AUX_GRID_DIM_2D |
int | numVertexes |
int | numTriangles |
int ** | faceMatrix |
double ** | vertMatrix |
int * | gridTriangleMap |
int * | gridTriangleMap2D |
int | nx |
int | ny |
int | nz |
double | scale |
double | side |
double * | x |
double * | y |
double * | z |
double | xmin |
double | xmax |
double | ymin |
double | ymax |
double | zmin |
double | zmax |
unsigned short *** | ind |
double ** | planes |
int | nx_2d |
int | ny_2d |
int | nz_2d |
double | scale_2d |
double | side_2d |
double | xmin_2d |
double | xmax_2d |
double | ymin_2d |
double | ymax_2d |
double | zmin_2d |
double | zmax_2d |
unsigned int ** | ind_2d |
vector< int > ** | vertexTrianglesList |
double ** | vertNormals |
bool | computeNormals |
This class represents a converter from an arbitray triangulated mesh surface to a DelPhi compatible representation. Vertex normals are computed by averaging among surrounding plane normals.
MeshSurface::MeshSurface | ( | ) |
Default constructor
MeshSurface::MeshSurface | ( | DelPhiShared * | ds | ) |
set DelPhi environment
virtual bool MeshSurface::build | ( | ) | [inline, virtual] |
bool MeshSurface::buildAuxiliaryGrid | ( | ) | [protected] |
build 3d auxiliary grid
bool MeshSurface::checkDuplicates | ( | ) | [protected] |
check if a duplicated triangle or vertex is present
bool MeshSurface::getProjection | ( | double | p[3], |
double * | proj1, | ||
double * | proj2, | ||
double * | proj3, | ||
double * | normal1, | ||
double * | normal2, | ||
double * | normal3 | ||
) | [virtual] |
Get a projection of a point on the surface. Return projection and normal
Implements Surface.
void MeshSurface::getRayIntersection | ( | double | p1[3], |
double | p2[3], | ||
vector< pair< double, double * > > & | intersections, | ||
int | thdID | ||
) | [inline, virtual] |
Get all the intersections of a ray that goes from P1 to P2 over the surface. The interesctions are returned with increasing distance order. the first double in the vector is the t parameter for the intersection of the parametric line and the surface, the double pointer is the normal vector. During ray triangle intersection the previously built auxiliary grid is used to speed up computations
Implements Surface.
int MeshSurface::intersect_triangle | ( | double | orig[3], |
double | dir[3], | ||
double | vert0[3], | ||
double | vert1[3], | ||
double | vert2[3], | ||
double * | t, | ||
double * | u, | ||
double * | v | ||
) | [protected] |
intersect a ray into a triangle
bool MeshSurface::load | ( | char * | fileName | ) | [virtual] |
Load the surface from an OFF/PLY file
Implements Surface.
bool MeshSurface::loadMSMS | ( | char * | fileName, |
int | numFiles = 1 |
||
) |
Load MSMS mesh surface
bool MeshSurface::loadOFF | ( | char * | fileName | ) | [protected] |
load a mesh in off format
bool MeshSurface::loadPLY | ( | char * | fileName | ) | [protected] |
load a mesh in ply format
void MeshSurface::point2plane | ( | double | p[3], |
double | w[4], | ||
double * | dist, | ||
double | proj[3] | ||
) | [protected] |
project a point in R3 to a plane
bool MeshSurface::point2triangle | ( | double | P[3], |
double | A[3], | ||
double | B[3], | ||
double | C[3], | ||
double | w[4], | ||
double * | proj, | ||
double * | dist, | ||
double * | normal, | ||
int | planeID, | ||
int | va, | ||
int | vb, | ||
int | vc | ||
) | [protected] |
project a point in R3 to a triangle. If the projected point is outside the triangle the nearest point-segment projection is returned where the segment is the nearest edge of the triangle to the point. The distance and the normal are returned. The plane ID (triangle number) and the vertex indexes must be passed.
virtual void MeshSurface::postRayCasting | ( | ) | [inline, virtual] |
this function is called after ray casting to perform any post processing, such as memory clean-up, after ray casting
Reimplemented from Surface.
virtual bool MeshSurface::preBoundaryProjection | ( | ) | [inline, virtual] |
this function is called before boundary grid projection to perform any pre-processing, such as memory setup-up.
Reimplemented from Surface.
void MeshSurface::preProcessPanel | ( | ) | [protected, virtual] |
pre process ray casting panel
Reimplemented from Surface.
void MeshSurface::preProcessTriangles | ( | ) | [protected] |
pre process triangle normals
void MeshSurface::printSummary | ( | ) | [virtual] |
bool MeshSurface::save | ( | char * | fileName | ) | [virtual] |
void MeshSurface::setAuxGrid | ( | unsigned int | dim, |
unsigned int | max | ||
) | [inline] |
for the 3d grid set the max grid size and the maximal number of patches inside a grid cube
void MeshSurface::setAuxGrid2D | ( | unsigned int | dim, |
unsigned int | max | ||
) | [inline] |
for the 2d grid set the max grid size and the maximal number of patches inside a grid cube. The grid cube itself does not exist just a reference, indeed the real quantity is MAX_TRIANGLES_2D that is the number of patches along the grid tube
bool MeshSurface::computeNormals [protected] |
if enabled vertex normals are computed. This is true for a usual mesh; false for MSMS files that provide analytical vertex normals.
int* MeshSurface::gridTriangleMap [protected] |
link each auxuliary grid box to the respective triangles list in a 3d grid
int* MeshSurface::gridTriangleMap2D [protected] |
link each auxuliary grid box to the respective triangles list in a 2d grid
int MeshSurface::nx [protected] |
auxiliary grid sizes
int MeshSurface::nx_2d [protected] |
auxiliary grid sizes for the 2d map
vector<int>** MeshSurface::vertexTrianglesList [protected] |
for each vertex the list of connected triangles
double** MeshSurface::vertNormals [protected] |
vertexes normals