SurfacePoint Struct Reference

#include <mesh.h>

Class Description

Describes a location somewhere on the surface of a Mesh.

SurfacePoint objects are generally returned by Picker objects, who have interpreted a user action that involves selecting a point on the mesh. Meshs are defined as having an inside (back face) and an outside (front face).

+ Examples:

Definition at line 340 of file mesh.h.

+ Inheritance diagram for SurfacePoint:

Public Member Functions

 SurfacePoint (void)
 Void Constructor. More...
 
 SurfacePoint (class Mesh *pMesh, unsigned int iVertexIndex, unsigned int iFaceIndex)
 Constructor. More...
 
class MeshMesh (void) const
 Returns the mesh on which the point is. More...
 
unsigned int FaceIndex (void) const
 Returns the index of the face which contains the surface point. More...
 
Vector LocalPosition (void) const
 Returns the position of the SurfacePoint in local space. More...
 
Vector WorldPosition (void) const
 Returns the position of the SurfacePoint in world space. More...
 
Vector LocalNormal (void) const
 Returns the normal of the selected face in local space. More...
 
Vector WorldNormal (void) const
 Returns the normal of the selected face in world space. More...
 
TC TextureCoordinate (void) const
 Returns the texture coordinate of the surface point. More...
 
Base TangentBase (void) const
 Returns the tangent base at the surface point in local space. More...
 
Vector FaceCoordinates (void) const
 Returns a 2d vector indicating the position of the selected point within its face. More...
 
bool Fill (class Mesh *pMesh, unsigned int iFaceIndex, const Vector &vStart, const Vector &vEnd, bool bTwoSide=false, bool bOriginalPosition=false)
 Set the SurfacePoint values based on a line in local space. More...
 
void Fill (class Mesh *pMesh, unsigned int iFaceIndex, float fFaceU, float fFaceV)
 Set the SurfacePoint values based on a given point inside a face. More...
 
void Fill (class Mesh *pMesh, unsigned int iFaceIndex, const Vector &vLocalPosition, bool bRecalculatePosition)
 Set the SurfacePoint values based on the 3D position of a point in a face. More...
 
void SetTangentGenerator (TangentGenerator *pGenerator)
 This function overrides the default tangent generator for the surface point. More...
 
void Align (void)
 The following function aligns the face coordinates to be in the range 0-1. More...
 
void Mirror (void)
 This function mirrors the surface point to the other side of the mesh using topological symmetry (if initialized) More...
 
void Serialize (Stream &s)
 Serialize the SurfacePoint to the given stream. More...
 

Public Attributes

class Meshm_pMesh
 the mesh that has been picked More...
 
unsigned int m_iFaceIndex
 the index of the face that has been picked More...
 
float m_fRelativeRange
 position of a mesh-line intersection relative to the line. Ranges from 0.0 (at the beginning of the line) to 1.0 (at the end). More...
 
Vector m_vLocalPosition
 position of the point in local space More...
 
Vector m_vLocalNormal
 the normal vector of the mesh at the picked point, in local space More...
 
bool m_bSide
 if true, the backside of the face was selected. (This is not supported; use at your own risk.) More...
 
class TangentGeneratorm_pTG
 address of a tangent generator which should be used to calculate tangents for this surface point More...
 
Vector m_vFaceCoordinates
 

Constructor & Destructor Documentation

SurfacePoint ( void  )
inline

Void Constructor.

Definition at line 351 of file mesh.h.

351 : m_pMesh(0), m_iFaceIndex(0xffffffff), m_fRelativeRange(0), m_bSide(false), m_pTG( NULL ) {}
bool m_bSide
if true, the backside of the face was selected. (This is not supported; use at your own risk...
Definition: mesh.h:347
class Mesh * m_pMesh
the mesh that has been picked
Definition: mesh.h:342
float m_fRelativeRange
position of a mesh-line intersection relative to the line. Ranges from 0.0 (at the beginning of the l...
Definition: mesh.h:344
unsigned int m_iFaceIndex
the index of the face that has been picked
Definition: mesh.h:343
class TangentGenerator * m_pTG
address of a tangent generator which should be used to calculate tangents for this surface point ...
Definition: mesh.h:348
SurfacePoint ( class Mesh pMesh,
unsigned int  iVertexIndex,
unsigned int  iFaceIndex 
)

Constructor.

Parameters
[in]pMeshthe mesh
[in]iVertexIndexthe index of a vertex on the mesh
[in]iFaceIndexthe index of a face on the mesh

Member Function Documentation

class Mesh* Mesh ( void  ) const

Returns the mesh on which the point is.

unsigned int FaceIndex ( void  ) const

Returns the index of the face which contains the surface point.

Vector LocalPosition ( void  ) const

Returns the position of the SurfacePoint in local space.

Vector WorldPosition ( void  ) const

Returns the position of the SurfacePoint in world space.

Vector LocalNormal ( void  ) const

Returns the normal of the selected face in local space.

Vector WorldNormal ( void  ) const

Returns the normal of the selected face in world space.

TC TextureCoordinate ( void  ) const

Returns the texture coordinate of the surface point.

Base TangentBase ( void  ) const

Returns the tangent base at the surface point in local space.

Vector FaceCoordinates ( void  ) const

Returns a 2d vector indicating the position of the selected point within its face.

bool Fill ( class Mesh pMesh,
unsigned int  iFaceIndex,
const Vector vStart,
const Vector vEnd,
bool  bTwoSide = false,
bool  bOriginalPosition = false 
)

Set the SurfacePoint values based on a line in local space.

This method looks at the line defined by vStart and vEnd and sees if it intersects the specified mesh and face. If it does, the remainder of the SurfacePoint values are filled in. The line in local space might represent the vector defined by the user clicking a point on the screen.

Parameters
[in]pMeshthe mesh
[in]iFaceIndexthe index of a face
[in]vStartstart point of a line defined in local space
[in]vEndend point of a line defined in local space
[in]bTwoSideif true, allow both sides of the face to be considered
[in]bOriginalPositionif true, the position in the structure will be calculated using the original position of vertices
void Fill ( class Mesh pMesh,
unsigned int  iFaceIndex,
float  fFaceU,
float  fFaceV 
)

Set the SurfacePoint values based on a given point inside a face.

This function is useful when the caller wants to specify a point inside a known face using baricentric coordinates. The position and normal of the surface point is also filled based on the given face coordinates.

Parameters
[in]pMeshthe mesh
[in]iFaceIndexthe index of a face
fFaceUU coordinate of the point inside the face
fFaceVV coordinate of the point inside the face
void Fill ( class Mesh pMesh,
unsigned int  iFaceIndex,
const Vector vLocalPosition,
bool  bRecalculatePosition 
)

Set the SurfacePoint values based on the 3D position of a point in a face.

This function is useful when the caller knows the 3D position and the faceindex of the point. The face coordinates and normal of the current point are calculated.

Parameters
[in]pMeshthe mesh
[in]iFaceIndexthe index of a face
vLocalPosition3D position of the point
[in]bRecalculatePositionif true the position will be recalculated using the plane of the face
void SetTangentGenerator ( TangentGenerator pGenerator)

This function overrides the default tangent generator for the surface point.

If the tangent generator is not specified using this function, the surface point will automatically obtain the address of the current tangent generator for the mesh. Since this is not a very fast process, this function can be used to avoid this process if it is called before the tangents are retrieved using the TangentBase function.

Parameters
[in]pGeneratorAddress of the tangent generator which should be used for this surface point.
void Align ( void  )

The following function aligns the face coordinates to be in the range 0-1.

The function also modifies the face index, if necessary.

void Mirror ( void  )

This function mirrors the surface point to the other side of the mesh using topological symmetry (if initialized)

void Serialize ( Stream s)

Serialize the SurfacePoint to the given stream.

Member Data Documentation

class Mesh* m_pMesh

the mesh that has been picked

Definition at line 342 of file mesh.h.

unsigned int m_iFaceIndex

the index of the face that has been picked

Definition at line 343 of file mesh.h.

float m_fRelativeRange

position of a mesh-line intersection relative to the line. Ranges from 0.0 (at the beginning of the line) to 1.0 (at the end).

Definition at line 344 of file mesh.h.

Vector m_vLocalPosition

position of the point in local space

Definition at line 345 of file mesh.h.

Vector m_vLocalNormal

the normal vector of the mesh at the picked point, in local space

Definition at line 346 of file mesh.h.

bool m_bSide

if true, the backside of the face was selected. (This is not supported; use at your own risk.)

Definition at line 347 of file mesh.h.

class TangentGenerator* m_pTG

address of a tangent generator which should be used to calculate tangents for this surface point

Definition at line 348 of file mesh.h.

Vector m_vFaceCoordinates
mutable

Definition at line 443 of file mesh.h.


The documentation for this struct was generated from the following file: