NanoShaper  0.7.2
NanoShaper is a tool able to triangulate and inspect an arbitray triangulated surface or several types of molecular surfaces
MeshSurface Class Reference

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>

Inheritance diagram for MeshSurface:
Surface BlobbySurface CoulombicSurface

List of all members.

Public Member Functions

 MeshSurface ()
 MeshSurface (DelPhiShared *ds)
 MeshSurface (ConfigFile *cf, 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, bool computeNormals)
virtual void init ()
virtual void init (ConfigFile *cf)
virtual void clear ()
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

Detailed Description

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.

Author:
Sergio Decherchi
Date:
14/10/2011

Constructor & Destructor Documentation

MeshSurface::MeshSurface ( )

Default constructor

MeshSurface::MeshSurface ( DelPhiShared ds)

set DelPhi environment

MeshSurface::MeshSurface ( ConfigFile *  cf,
DelPhiShared ds 
)

set configuration and DelPhi environment


Member Function Documentation

virtual bool MeshSurface::build ( ) [inline, virtual]

Nothing to do in this case

Implements Surface.

Reimplemented in CoulombicSurface, and BlobbySurface.

bool MeshSurface::buildAuxiliaryGrid ( ) [protected]

build 3d auxiliary grid

bool MeshSurface::checkDuplicates ( ) [protected]

check if a duplicated triangle or vertex is present

void MeshSurface::clear ( ) [virtual]

function for the denstructor

Implements Surface.

Reimplemented in CoulombicSurface, and BlobbySurface.

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,
bool  computeNormals 
) [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.

void MeshSurface::init ( ) [virtual]

function for the constructor without arguments

Implements Surface.

Reimplemented in CoulombicSurface, and BlobbySurface.

void MeshSurface::init ( ConfigFile *  cf) [virtual]

functions for the constructor with config file argument

Implements Surface.

Reimplemented in CoulombicSurface, and BlobbySurface.

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]

Print number of vertices and faces

Implements Surface.

Reimplemented in CoulombicSurface, and BlobbySurface.

bool MeshSurface::save ( char *  fileName) [virtual]

Save in off format

save in OFF format

Implements Surface.

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


Member Data Documentation

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.

Reimplemented from Surface.

int* MeshSurface::gridTriangleMap [protected]

link each auxuliary grid box to the respective triangles list in a 3d grid

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


The documentation for this class was generated from the following files: