This reference page is linked to from the following overview topics: Picking.
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).
#include <mesh.h>
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. |
|
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 |
SurfacePoint | ( | void | ) |
Void Constructor.
SurfacePoint | ( | class Mesh * | pMesh, |
unsigned int | iVertexIndex, | ||
unsigned int | iFaceIndex | ||
) |
Constructor.
[in] | pMesh | the mesh |
[in] | iVertexIndex | the index of a vertex on the mesh |
[in] | iFaceIndex | the index of a face on the mesh |
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.
[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 | ||
) |
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.
[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 | ||
) |
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.
[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 | ) |
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.
[in] | pGenerator | Address of the tangent generator which should be used for this surface point. |
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).
position of the point in local space
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.)
address of a tangent generator which should be used to calculate tangents for this surface point
Vector
m_vFaceCoordinates [mutable] |