Commit b648d6a9 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH: Added MakeObject() method.

parent 1b6b75ac
......@@ -43,9 +43,9 @@ public:
void Initialize(int npts, int *pts, vlPoints *p);
char *GetClassName() {return "vlCell";};
// Because these objects (cells and derived classes) are computational
// objects, and because they are used internally, do not use memory
// reference counting.
// Description:
// Create concrete copy of this cell.
virtual vlCell *MakeObject() = 0;
// Description:
// Return the type of cell.
......
......@@ -24,7 +24,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
// easy interface to external data. However, it is totally inadequate for
// random access. This functionality (when necessary) is accomplished by
// using the vlCellList and vlLinkList objects to extend the definition of
// data structure.
// the data structure.
#ifndef __vlCellArray_h
#define __vlCellArray_h
......@@ -88,7 +88,8 @@ inline void vlCellArray::InsertNextCell(int npts, int* pts)
// Description:
// Create cells by specifying count, and then adding points one at a time using
// method InsertCellPoint()
// method InsertCellPoint(). WARNING: it is the user's responsibility not to
// exceed the maximum allowable points per cell (MAX_CELL_SIZE).
inline void vlCellArray::InsertNextCell(int npts)
{
this->Location = this->Ia.InsertNextValue(npts) + 1;
......
......@@ -27,8 +27,10 @@ class vlHexahedron : public vlCell
{
public:
vlHexahedron() {};
vlHexahedron(const vlHexahedron& h);
char *GetClassName() {return "vlHexahedron";};
vlCell *MakeObject() {return new vlHexahedron(*this);};
int GetCellType() {return vlHEXAHEDRON;};
int GetCellDimension() {return 3;};
int GetNumberOfEdges() {return 12;};
......
......@@ -26,8 +26,10 @@ class vlLine : public vlCell
{
public:
vlLine() {};
vlLine(const vlLine& l);
char *GetClassName() {return "vlLine";};
vlCell *MakeObject() {return new vlLine(*this);};
int GetCellType() {return vlLINE;};
int GetCellDimension() {return 1;};
int GetNumberOfEdges() {return 0;};
......
......@@ -28,8 +28,10 @@ class vlRectangle : public vlCell
{
public:
vlRectangle() {};
vlRectangle(const vlRectangle& r);
char *GetClassName() {return "vlRectangle";};
vlCell *MakeObject() {return new vlRectangle(*this);};
int GetCellType() {return vlRECTANGLE;};
int GetCellDimension() {return 2;};
int GetNumberOfEdges() {return 4;};
......
......@@ -30,10 +30,12 @@ class vlPolyLine : public vlCell
{
public:
vlPolyLine() {};
vlPolyLine(const vlPolyLine& pl);
char *GetClassName() {return "vlPolyLine";};
int GenerateNormals(vlPoints *, vlCellArray *, vlFloatNormals *);
vlCell *MakeObject() {return new vlPolyLine(*this);};
int GetCellType() {return vlPOLY_LINE;};
int GetCellDimension() {return 1;};
int GetNumberOfEdges() {return 0;};
......
......@@ -27,8 +27,10 @@ class vlPolyPoints : public vlCell
{
public:
vlPolyPoints() {};
vlPolyPoints(const vlPolyPoints& pp);
char *GetClassName() {return "vlPolyPoints";};
vlCell *MakeObject() {return new vlPolyPoints(*this);};
int GetCellType() {return vlPOLY_POINTS;};
int GetCellDimension() {return 0;};
int GetNumberOfEdges() {return 0;};
......
......@@ -29,12 +29,14 @@ class vlPolygon : public vlCell
{
public:
vlPolygon() {};
vlPolygon(const vlPolygon& p);
char *GetClassName() {return "vlPolygon";};
void ComputeNormal(vlPoints *p, int numPts, int *pts, float n[3]);
void ComputeNormal(float v1[3], float v2[3], float v3[3], float n[3]);
void ComputeNormal(vlFloatPoints *p, float n[3]);
vlCell *MakeObject() {return new vlPolygon(*this);};
int GetCellType() {return vlPOLYGON;};
int GetCellDimension() {return 2;};
int GetNumberOfEdges() {return this->GetNumberOfPoints();};
......
......@@ -27,8 +27,10 @@ class vlQuad : public vlCell
{
public:
vlQuad() {};
vlQuad(const vlQuad& q);
char *GetClassName() {return "vlQuad";};
vlCell *MakeObject() {return new vlQuad(*this);};
int GetCellType() {return vlQUAD;};
int GetCellDimension() {return 2;};
int GetNumberOfEdges() {return 4;};
......
......@@ -27,8 +27,10 @@ class vlTetra : public vlCell
{
public:
vlTetra() {};
vlTetra(const vlTetra& t);
char *GetClassName() {return "vlTetra";};
vlCell *MakeObject() {return new vlTetra(*this);};
int GetCellType() {return vlTETRA;};
int GetCellDimension() {return 3;};
int GetNumberOfEdges() {return 6;};
......
......@@ -31,8 +31,10 @@ class vlTriangleStrip : public vlCell
{
public:
vlTriangleStrip() {};
vlTriangleStrip(const vlTriangleStrip& ts);
char *GetClassName() {return "vlTriangleStrip";};
vlCell *MakeObject() {return new vlTriangleStrip(*this);};
int GetCellType() {return vlTRIANGLE_STRIP;};
int GetCellDimension() {return 2;};
int GetNumberOfEdges() {return this->GetNumberOfPoints();};
......
......@@ -27,8 +27,10 @@ class vlTriangle : public vlCell
{
public:
vlTriangle() {};
vlTriangle(const vlTriangle& t);
char *GetClassName() {return "vlTriangle";};
vlCell *MakeObject() {return new vlTriangle(*this);};
int GetCellType() {return vlTRIANGLE;};
int GetCellDimension() {return 2;};
int GetNumberOfEdges() {return 3;};
......
......@@ -26,8 +26,10 @@ class vlPoint : public vlCell
{
public:
vlPoint() {};
vlPoint(const vlPoint& p);
char *GetClassName() {return "vlPoint";};
vlCell *MakeObject() {return new vlPoint(*this);};
int GetCellType() {return vlPOINT;};
int GetCellDimension() {return 0;};
int GetNumberOfEdges() {return 0;};
......
......@@ -29,8 +29,10 @@ class vlBrick : public vlCell
{
public:
vlBrick() {};
vlBrick(const vlBrick& b);
char *GetClassName() {return "vlBrick";};
vlCell *MakeObject() {return new vlBrick(*this);};
int GetCellType() {return vlBRICK;};
int GetCellDimension() {return 3;};
int GetNumberOfEdges() {return 12;};
......
......@@ -13,7 +13,6 @@ without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <math.h>
#include "Hexa.hh"
#include "vlMath.hh"
#include "Brick.hh"
......@@ -21,9 +20,13 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "Quad.hh"
#include "CellArr.hh"
//
// Note: the ordering of the Points and PointIds is important. See text.
//
// Description:
// Deep copy of cell.
vlHexahedron::vlHexahedron(const vlHexahedron& h)
{
this->Points = h.Points;
this->PointIds = h.PointIds;
}
//
// Method to calculate parametric coordinates in an eight noded
......
......@@ -17,6 +17,14 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "vlMath.hh"
#include "CellArr.hh"
// Description:
// Deep copy of cell.
vlLine::vlLine(const vlLine& l)
{
this->Points = l.Points;
this->PointIds = l.PointIds;
}
#define NO_INTERSECTION 1
#define INTERSECTION 2
#define ON_LINE 6
......
......@@ -13,7 +13,6 @@ without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <math.h>
#include "Rect.hh"
#include "Quad.hh"
#include "Polygon.hh"
......@@ -22,9 +21,13 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "CellArr.hh"
#include "Line.hh"
//
// Note: the ordering of the Points and PointIds is important. See text.
//
// Description:
// Deep copy of cell.
vlRectangle::vlRectangle(const vlRectangle& r)
{
this->Points = r.Points;
this->PointIds = r.PointIds;
}
int vlRectangle::EvaluatePosition(float x[3], float closestPoint[3],
int& subId, float pcoords[3],
......
......@@ -18,6 +18,14 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "Line.hh"
#include "CellArr.hh"
// Description:
// Deep copy of cell.
vlPolyLine::vlPolyLine(const vlPolyLine& pl)
{
this->Points = pl.Points;
this->PointIds = pl.PointIds;
}
int vlPolyLine::GenerateNormals(vlPoints *pts, vlCellArray *lines, vlFloatNormals *normals)
{
int npts, *linePts;
......
......@@ -17,6 +17,14 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "vlMath.hh"
#include "CellArr.hh"
// Description:
// Deep copy of cell.
vlPolyPoints::vlPolyPoints(const vlPolyPoints& pp)
{
this->Points = pp.Points;
this->PointIds = pp.PointIds;
}
int vlPolyPoints::EvaluatePosition(float x[3], float closestPoint[3],
int& subId, float pcoords[3],
float& minDist2, float weights[MAX_CELL_SIZE])
......
......@@ -13,7 +13,6 @@ without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include <math.h>
#include "Polygon.hh"
#include "vlMath.hh"
#include "Line.hh"
......@@ -22,6 +21,14 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "Triangle.hh"
#include "CellArr.hh"
// Description:
// Deep copy of cell.
vlPolygon::vlPolygon(const vlPolygon& p)
{
this->Points = p.Points;
this->PointIds = p.PointIds;
}
#define FAILURE 0
#define INTERSECTION 2
#define OUTSIDE 3
......
Markdown is supported
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