- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes

# SurfacePoint Struct Reference

This reference page is linked to from the following overview topics: Picking.

Search for all occurrences

## Detailed 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:

  CurveBrush/CurveCreator.h.

Definition at line 881 of file mesh.h.

`#include <mesh.h>`

Inheritance diagram for SurfacePoint:
[legend]

List of all members.

## Public Member Functions
| SurfacePoint (void)
| Void Constructor.
| SurfacePoint (class Mesh *pMesh, unsigned int iVertexIndex, unsigned int iFaceIndex)
| Constructor.
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.
void | Fill (class Mesh *pMesh, unsigned int iFaceIndex, float fFaceU, float fFaceV)
| Set the SurfacePoint values based on a given point inside a 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.
void | SetTangentGenerator (TangentGenerator *pGenerator)
| This function overrides the default tangent generator for the surface point.
void | Align (void)
| The following function aligns the face coordinates to be in the range 0-1.
## Public Attributes
class Mesh * | m_pMesh
| the mesh that has been picked
unsigned int | m_iFaceIndex
| the index of the face that has been picked
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).
Vector | m_vLocalPosition
| position of the point in local space
Vector | m_vLocalNormal
| the normal vector of the mesh at the picked point, in local space
bool | m_bSide
| if true, the backside of the face was selected. (This is not supported; use at your own risk.)
TangentGenerator * | m_pTG
| address of a tangent generator which should be used to calculate tangents for this surface point
Vector | m_vFaceCoordinates

## Constructor & Destructor Documentation

SurfacePoint | ( | void |  | ) |

Void Constructor.

SurfacePoint | ( | class Mesh * | pMesh,
|  | unsigned int | iVertexIndex,
|  | unsigned int | iFaceIndex
| ) |  |

Constructor.

Parameters:

  [in] | pMesh | the mesh
  [in] | iVertexIndex | the index of a vertex on the mesh
  [in] | iFaceIndex | the index of a face on the mesh

## Member Function Documentation

class Mesh* Mesh | ( | void |  | ) | const

Search for all occurrences

Returns the mesh on which the point is.

unsigned int FaceIndex | ( | void |  | ) | const

Search for all occurrences

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

Vector LocalPosition | ( | void |  | ) | const

Search for all occurrences

Returns the position of the SurfacePoint in local space.

Vector WorldPosition | ( | void |  | ) | const

Search for all occurrences

Returns the position of the SurfacePoint in world space.

Vector LocalNormal | ( | void |  | ) | const

Search for all occurrences

Returns the normal of the selected face in local space.

Vector WorldNormal | ( | void |  | ) | const

Search for all occurrences

Returns the normal of the selected face in world space.

TC TextureCoordinate | ( | void |  | ) | const

Search for all occurrences

Returns the texture coordinate of the surface point.

Base TangentBase | ( | void |  | ) | const

Search for all occurrences

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

Reimplemented in TargetLocation.

Vector FaceCoordinates | ( | void |  | ) | const

Search for all occurrences

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`
| ) |  |

Search for all occurrences

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] | pMesh | the mesh
  [in] | iFaceIndex | the index of a face
  [in] | vStart | start point of a line defined in local space
  [in] | vEnd | end point of a line defined in local space
  [in] | bTwoSide | if true, allow both sides of the face to be considered
  [in] | bOriginalPosition | if 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
| ) |  |

Search for all occurrences

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] | pMesh | the mesh
  [in] | iFaceIndex | the index of a face
  | fFaceU | U coordinate of the point inside the face
  | fFaceV | V coordinate of the point inside the face

void Fill | ( | class Mesh * | pMesh,
|  | unsigned int | iFaceIndex,
|  | const Vector & | vLocalPosition,
|  | bool | bRecalculatePosition
| ) |  |

Search for all occurrences

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] | pMesh | the mesh
  [in] | iFaceIndex | the index of a face
  | vLocalPosition | 3D position of the point
  [in] | bRecalculatePosition | if true the position will be recalculated using the plane of the face

void SetTangentGenerator | ( | TangentGenerator * | pGenerator | ) |

Search for all occurrences

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] | pGenerator | Address of the tangent generator which should be used for this surface point.

void Align | ( | void |  | ) |

Search for all occurrences

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

The function also modifies the face index, if necessary.

## Member Data Documentation

class Mesh* m_pMesh

Search for all occurrences

the mesh that has been picked

Definition at line 883 of file mesh.h.

unsigned int m_iFaceIndex

Search for all occurrences

the index of the face that has been picked

Definition at line 884 of file mesh.h.

float m_fRelativeRange

Search for all occurrences

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 885 of file mesh.h.

Vector m_vLocalPosition

Search for all occurrences

position of the point in local space

Definition at line 886 of file mesh.h.

Vector m_vLocalNormal

Search for all occurrences

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

Definition at line 887 of file mesh.h.

bool m_bSide

Search for all occurrences

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

Definition at line 888 of file mesh.h.

TangentGenerator* m_pTG

Search for all occurrences

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

Definition at line 889 of file mesh.h.

Vector m_vFaceCoordinates `[mutable]`

Search for all occurrences

Definition at line 978 of file mesh.h.

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

- Mudbox/mesh.h