Added EdgeBarycentricToFaceBarycentric to convert an edge position into a face barycentric position
This commit is contained in:
parent
5049407069
commit
49d759af2a
|
|
@ -42,6 +42,7 @@ class UpdateTopology
|
|||
|
||||
public:
|
||||
typedef UpdateMeshType MeshType;
|
||||
typedef typename MeshType::ScalarType ScalarType;
|
||||
typedef typename MeshType::VertexType VertexType;
|
||||
typedef typename MeshType::VertexPointer VertexPointer;
|
||||
typedef typename MeshType::VertexIterator VertexIterator;
|
||||
|
|
@ -69,8 +70,8 @@ public:
|
|||
|
||||
PEdge() {}
|
||||
|
||||
void Set( FacePointer pf, const int nz )
|
||||
{
|
||||
void Set( FacePointer pf, const int nz )
|
||||
{
|
||||
assert(pf!=0);
|
||||
assert(nz>=0);
|
||||
assert(nz<pf->VN());
|
||||
|
|
@ -82,20 +83,28 @@ void Set( FacePointer pf, const int nz )
|
|||
if( v[0] > v[1] ) math::Swap(v[0],v[1]);
|
||||
f = pf;
|
||||
z = nz;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool operator < ( const PEdge & pe ) const
|
||||
{
|
||||
inline bool operator < ( const PEdge & pe ) const
|
||||
{
|
||||
if( v[0]<pe.v[0] ) return true;
|
||||
else if( v[0]>pe.v[0] ) return false;
|
||||
else return v[1] < pe.v[1];
|
||||
}
|
||||
}
|
||||
|
||||
inline bool operator == ( const PEdge & pe ) const
|
||||
{
|
||||
inline bool operator == ( const PEdge & pe ) const
|
||||
{
|
||||
return v[0]==pe.v[0] && v[1]==pe.v[1];
|
||||
}
|
||||
|
||||
}
|
||||
/// Convert from edge barycentric coord to the face baricentric coord a point on the current edge.
|
||||
/// Face barycentric coordinates are relative to the edge face.
|
||||
inline Point3<ScalarType> EdgeBarycentricToFaceBarycentric(ScalarType u) const
|
||||
{
|
||||
Point3<ScalarType> interp(0,0,0);
|
||||
interp[ this->z ] = u;
|
||||
interp[(this->z+1)%3] = 1.0f-u;
|
||||
return interp;
|
||||
}
|
||||
};
|
||||
|
||||
// Fill a vector with all the edges of the mesh.
|
||||
|
|
|
|||
Loading…
Reference in New Issue