Commit a066d255 authored by Mathieu Malaterre's avatar Mathieu Malaterre
Browse files

ENH: A couple of cells had wrong parametric center coordinates

parent f29b7e89
......@@ -61,6 +61,10 @@ public:
vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
int insideOut);
// Description:
// Return the center of the triangle in parametric coordinates.
int GetParametricCenter(double pcoords[3]);
// Description:
// Line-line intersection. Intersection has to occur within [0,1] parametric
// coordinates and with specified tolerance.
......@@ -79,8 +83,12 @@ public:
// Description:
// Compute distance to finite line. Returns parametric coordinate t
// and point location on line.
// Compute the distance of a point x to a finite line (p1,p2). The method
// computes the parametric coordinate t and the point location on the
// line. Note that t is unconstrained (i.e., it may lie outside the range
// [0,1]) but the closest point will lie within the finite line
// [p1,p2]. Also, the method returns the distance squared between x and the
// line (p1,p2).
static double DistanceToLine(double x[3], double p1[3], double p2[3],
double &t, double closestPoint[3]);
......@@ -104,6 +112,14 @@ private:
void operator=(const vtkLine&); // Not implemented.
};
//----------------------------------------------------------------------------
inline int vtkLine::GetParametricCenter(double pcoords[3])
{
pcoords[0] = 0.5;
pcoords[1] = pcoords[2] = 0.0;
return 0;
}
#endif
......@@ -57,6 +57,11 @@ public:
double& dist2, double *weights);
void EvaluateLocation(int& subId, double pcoords[3], double x[3],
double *weights);
// Description:
// Return the center of the triangle in parametric coordinates.
int GetParametricCenter(double pcoords[3]);
int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
double x[3], double pcoords[3], int& subId);
int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
......@@ -81,6 +86,14 @@ private:
void operator=(const vtkPixel&); // Not implemented.
};
//----------------------------------------------------------------------------
inline int vtkPixel::GetParametricCenter(double pcoords[3])
{
pcoords[0] = pcoords[1] = 0.5;
pcoords[2] = 0.0;
return 0;
}
#endif
......@@ -102,8 +102,8 @@ private:
//----------------------------------------------------------------------------
inline int vtkPyramid::GetParametricCenter(double pcoords[3])
{
pcoords[0] = pcoords[1] = 0.5;
pcoords[2] = 0.333333;
pcoords[0] = pcoords[1] = 0.4;
pcoords[2] = 0.2;
return 0;
}
......
......@@ -14,19 +14,18 @@
=========================================================================*/
#include "vtkQuad.h"
#include "vtkObjectFactory.h"
#include "vtkCellArray.h"
#include "vtkCellData.h"
#include "vtkLine.h"
#include "vtkTriangle.h"
#include "vtkMath.h"
#include "vtkObjectFactory.h"
#include "vtkPlane.h"
#include "vtkPointData.h"
#include "vtkPointLocator.h"
#include "vtkPoints.h"
#include "vtkTriangle.h"
vtkCxxRevisionMacro(vtkQuad, "1.3");
vtkCxxRevisionMacro(vtkQuad, "1.3.12.1");
vtkStandardNewMacro(vtkQuad);
static const double VTK_DIVERGED = 1.e6;
......
......@@ -60,6 +60,10 @@ public:
int dim, double *derivs);
virtual double *GetParametricCoords();
// Description:
// Return the center of the triangle in parametric coordinates.
int GetParametricCenter(double pcoords[3]);
// Description:
// Clip this quad using scalar value provided. Like contouring, except
// that it cuts the quad to produce other quads and/or triangles.
......@@ -85,6 +89,14 @@ private:
vtkQuad(const vtkQuad&); // Not implemented.
void operator=(const vtkQuad&); // Not implemented.
};
//----------------------------------------------------------------------------
inline int vtkQuad::GetParametricCenter(double pcoords[3])
{
pcoords[0] = pcoords[1] = 0.5;
pcoords[2] = 0.0;
return 0;
}
#endif
......
......@@ -30,7 +30,6 @@
#include "vtkNonLinearCell.h"
class vtkPolyData;
class vtkLine;
class VTK_FILTERING_EXPORT vtkQuadraticEdge : public vtkNonLinearCell
......@@ -81,6 +80,9 @@ public:
int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
double x[3], double pcoords[3], int& subId);
// Description:
// Return the center of the quadratic tetra in parametric coordinates.
int GetParametricCenter(double pcoords[3]);
// Description:
// Quadratic edge specific methods.
......@@ -98,6 +100,13 @@ private:
vtkQuadraticEdge(const vtkQuadraticEdge&); // Not implemented.
void operator=(const vtkQuadraticEdge&); // Not implemented.
};
//----------------------------------------------------------------------------
inline int vtkQuadraticEdge::GetParametricCenter(double pcoords[3])
{
pcoords[0] = 0.5;
pcoords[1] = pcoords[2] = 0.;
return 0;
}
#endif
......
......@@ -25,7 +25,7 @@
#include "vtkQuadraticQuad.h"
#include "vtkQuadraticTriangle.h"
vtkCxxRevisionMacro(vtkQuadraticPyramid, "1.7.8.1");
vtkCxxRevisionMacro(vtkQuadraticPyramid, "1.7.8.2");
vtkStandardNewMacro(vtkQuadraticPyramid);
//----------------------------------------------------------------------------
......@@ -614,15 +614,6 @@ void vtkQuadraticPyramid::Clip(double value, vtkDataArray* cellScalars,
}
}
//----------------------------------------------------------------------------
// Return the center of the quadratic pyramid in parametric coordinates.
//
int vtkQuadraticPyramid::GetParametricCenter(double pcoords[3])
{
pcoords[0] = pcoords[1] = pcoords[2] = 0.5;
return 0;
}
//----------------------------------------------------------------------------
// Compute interpolation functions for the fifteen nodes.
//
......
......@@ -38,13 +38,11 @@
#include "vtkNonLinearCell.h"
class vtkPolyData;
class vtkQuadraticEdge;
class vtkQuadraticQuad;
class vtkQuadraticTriangle;
class vtkTetra;
class vtkPyramid;
class vtkDoubleArray;
class VTK_FILTERING_EXPORT vtkQuadraticPyramid : public vtkNonLinearCell
{
......@@ -131,5 +129,15 @@ private:
vtkQuadraticPyramid(const vtkQuadraticPyramid&); // Not implemented.
void operator=(const vtkQuadraticPyramid&); // Not implemented.
};
//----------------------------------------------------------------------------
// Return the center of the quadratic pyramid in parametric coordinates.
//
inline int vtkQuadraticPyramid::GetParametricCenter(double pcoords[3])
{
pcoords[0] = pcoords[1] = 6./13;
pcoords[2] = 3./13;
return 0;
}
#endif
......@@ -33,13 +33,8 @@
#include "vtkNonLinearCell.h"
class vtkPolyData;
class vtkQuadraticEdge;
class vtkQuad;
class vtkPointData;
class vtkCellData;
class vtkDataArray;
class vtkDoubleArray;
class VTK_FILTERING_EXPORT vtkQuadraticQuad : public vtkNonLinearCell
{
......@@ -90,6 +85,10 @@ public:
double x[3], double pcoords[3], int& subId);
// Description:
// Return the center of the pyramid in parametric coordinates.
int GetParametricCenter(double pcoords[3]);
// Description:
// Quadratic quad specific methods.
static void InterpolationFunctions(double pcoords[3], double weights[8]);
......@@ -102,17 +101,28 @@ protected:
vtkQuadraticEdge *Edge;
vtkQuad *Quad;
vtkPointData *PointData;
vtkCellData *CellData;
vtkDoubleArray *CellScalars;
vtkDoubleArray *Scalars;
// In order to achieve some functionality we introduce a fake center point
// which require to have some extra functionalities compare to other non-linar
// cells
vtkCellData *CellData;
vtkDoubleArray *CellScalars;
void Subdivide(double *weights);
void InterpolateAttributes(vtkPointData *inPd, vtkCellData *inCd, vtkIdType cellId, vtkDataArray *cellScalars);
void InterpolateAttributes(vtkPointData *inPd, vtkCellData *inCd, vtkIdType cellId,
vtkDataArray *cellScalars);
private:
vtkQuadraticQuad(const vtkQuadraticQuad&); // Not implemented.
void operator=(const vtkQuadraticQuad&); // Not implemented.
};
//----------------------------------------------------------------------------
inline int vtkQuadraticQuad::GetParametricCenter(double pcoords[3])
{
pcoords[0] = pcoords[1] = 0.5;
pcoords[2] = 0.;
return 0;
}
#endif
......
......@@ -21,7 +21,7 @@
#include "vtkTriangle.h"
#include "vtkDoubleArray.h"
vtkCxxRevisionMacro(vtkQuadraticTriangle, "1.4.8.1");
vtkCxxRevisionMacro(vtkQuadraticTriangle, "1.4.8.2");
vtkStandardNewMacro(vtkQuadraticTriangle);
//----------------------------------------------------------------------------
......@@ -303,13 +303,6 @@ void vtkQuadraticTriangle::Clip(double value,
}
}
//----------------------------------------------------------------------------
int vtkQuadraticTriangle::GetParametricCenter(double pcoords[3])
{
pcoords[0] = pcoords[1] = 0.333; pcoords[2] = 0.0;
return 0;
}
//----------------------------------------------------------------------------
// Compute maximum parametric distance to cell
double vtkQuadraticTriangle::GetParametricDistance(double pcoords[3])
......
......@@ -32,7 +32,6 @@
#include "vtkNonLinearCell.h"
class vtkPolyData;
class vtkQuadraticEdge;
class vtkTriangle;
class vtkDoubleArray;
......@@ -113,6 +112,14 @@ private:
vtkQuadraticTriangle(const vtkQuadraticTriangle&); // Not implemented.
void operator=(const vtkQuadraticTriangle&); // Not implemented.
};
//----------------------------------------------------------------------------
inline int vtkQuadraticTriangle::GetParametricCenter(double pcoords[3])
{
pcoords[0] = pcoords[1] = 1./3;
pcoords[2] = 0.0;
return 0;
}
#endif
......
......@@ -21,12 +21,11 @@
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkPointLocator.h"
#include "vtkPolyData.h"
#include "vtkQuadraticEdge.h"
#include "vtkQuadraticQuad.h"
#include "vtkQuadraticTriangle.h"
vtkCxxRevisionMacro(vtkQuadraticWedge, "1.6");
vtkCxxRevisionMacro(vtkQuadraticWedge, "1.6.8.1");
vtkStandardNewMacro(vtkQuadraticWedge);
//----------------------------------------------------------------------------
......@@ -570,14 +569,6 @@ void vtkQuadraticWedge::Clip(double value, vtkDataArray* cellScalars,
}
//----------------------------------------------------------------------------
// Return the center of the quadratic wedge in parametric coordinates.
int vtkQuadraticWedge::GetParametricCenter(double pcoords[3])
{
pcoords[0] = pcoords[1] = 0.333; pcoords[2] = 0.5;
return 0;
}
//----------------------------------------------------------------------------
// Compute interpolation functions for the fifteen nodes.
void vtkQuadraticWedge::InterpolationFunctions(double pcoords[3],
......
......@@ -33,7 +33,6 @@
#include "vtkNonLinearCell.h"
class vtkPolyData;
class vtkQuadraticEdge;
class vtkQuadraticQuad;
class vtkQuadraticTriangle;
......@@ -124,6 +123,15 @@ private:
vtkQuadraticWedge(const vtkQuadraticWedge&); // Not implemented.
void operator=(const vtkQuadraticWedge&); // Not implemented.
};
//----------------------------------------------------------------------------
// Return the center of the quadratic wedge in parametric coordinates.
inline int vtkQuadraticWedge::GetParametricCenter(double pcoords[3])
{
pcoords[0] = pcoords[1] = 1./3;
pcoords[2] = 0.5;
return 0;
}
#endif
......
......@@ -70,6 +70,10 @@ public:
vtkPointData *inPd, vtkPointData *outPd,
vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
// Description:
// Return the center of the triangle in parametric coordinates.
int GetParametricCenter(double pcoords[3]);
// Description:
// Intersect with a ray. Return parametric coordinates (both line and cell)
// and global intersection coordinates, given ray definition and tolerance.
......@@ -101,6 +105,13 @@ private:
void operator=(const vtkVertex&); // Not implemented.
};
//----------------------------------------------------------------------------
inline int vtkVertex::GetParametricCenter(double pcoords[3])
{
pcoords[0] = pcoords[1] = pcoords[2] = 0.0;
return 0;
}
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment