00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef PATCHOBJECT_H
00022
#define PATCHOBJECT_H
00023
00024
#include <vector>
00025
00026
#include <map>
00027
00028
#include "objectcontainer.h"
00029
00030
class PatchObject:
public ObjectContainer {
00031
00032
public:
00033 PatchObject():
ObjectContainer(), insidevector(-PI,-2,4.1) {};
00034 PatchObject(
const Vector3& insidetestvector):
ObjectContainer(), insidevector(insidetestvector) {};
00035
virtual ~PatchObject() {}
00036
00037
protected:
00038 PatchObject(
const PatchObject& o):
ObjectContainer(o), insidevector(o.insidevector) {};
00039
00040
public:
00041
00042
00043
Object3D*
duplicate() const;
00044
Intersection* intersectLocalLimitedTime(const
Ray &r, DBL maxtime) const;
00045
bool isInsideAt(const
Vector3 &locallocation) const;
00046
00049
void addPatch(
SurfacePatch3D* o);
00050
00051 protected:
00052
00053
ObjectContainer* getEmptyContainer();
00054
00055 private:
00056
00059
Vector3 insidevector;
00060
00063 static HitStatistics stat;
00064
00065 };
00066
00067
00068 class SharedPointsPatchObject: public PatchObject {
00069
00070
public:
00071
class Connectivity;
00072
typedef std::vector<Vector3> plist_t;
00073
typedef std::vector<Connectivity*> clist_t;
00074
typedef CNTREF pindex_t;
00075
00076
class Connectivity {
00077
public:
00078
virtual SurfacePatch3D* makePatch(
Vector3* pointlist)
const = 0;
00079 };
00080
00081
class TriangleConnectivity:
public Connectivity {
00082
public:
00083 TriangleConnectivity(pindex_t A, pindex_t B, pindex_t C);
00084
SurfacePatch3D* makePatch(
Vector3* pointlist)
const;
00085
private:
00086 pindex_t edge[3];
00087 };
00088
00089
class PatchList {
00090
friend class SharedPointsPatchObject;
00091
public:
00092 ~PatchList();
00093
void addTriangle(
const Vector3& A,
const Vector3& B,
const Vector3& C);
00094
private:
00095
typedef std::map<Vector3,pindex_t> pmap_t;
00096 pmap_t pmap;
00097 clist_t clist;
00098 pindex_t insertPoint(
const Vector3&);
00099 };
00100
00101
public:
00102 SharedPointsPatchObject(
const PatchList&);
00103 ~SharedPointsPatchObject();
00104
00105
private:
00106 SharedPointsPatchObject(
const SharedPointsPatchObject&);
00107
00108
public:
00109
00110
00111
Object3D*
duplicate() const;
00112
00113 private:
00114
Vector3* pointlist;
00115 CNTREF *pointlistcount;
00116
00117 };
00118
00119 #endif
00120