00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef ISOSURFACE_H
00022
#define ISOSURFACE_H
00023
00024
#include "object3d.h"
00025
#include "intersection.h"
00026
#include "function.h"
00027
00033 class Isosurface:
public Object3D {
00034
00035
public:
00036
typedef Function<const Vector3,DBL> IsosurfaceFunction;
00037
00038
public:
00039
00047
Isosurface(
IsosurfaceFunction* func,
Object3D* cont, DBL maxd,
bool doeval);
00048
00049 ~
Isosurface();
00050
00051
private:
00054
Isosurface(
const Isosurface&);
00055
Isosurface& operator=(
const Isosurface&);
00056
00057
public:
00058
00059
00060
Object3D*
duplicate()
const;
00061
bool isInsideAt(
const Vector3& locallocation)
const;
00062
Intersection* intersectLocalLimitedTime(
const Ray& r, DBL maxtime)
const;
00063
00064
private:
00065
static const DBL NORMAL_E;
00066
static const int MAX_STEP_INCREASE = 1024;
00067
#ifdef WRONG_INNER_CLASSES_ACCESS
00068
public:
00069
#endif
00070
static const DBL K_INCREASE_FACT;
00071
00072
private:
00075
static HitStatistics stat;
00076
static int isosurfacecount;
00077
00078
private:
00079
#ifdef WRONG_INNER_CLASSES_ACCESS
00080
public:
00081
#endif
00082
00086
Object3D* container;
00087
00091
IsosurfaceFunction* f;
00092
00093
mutable DBL K;
00094
mutable DBL missstepsize;
00095
bool eval;
00096
00097
00098
mutable MaxStatistics<DBL> maxdstat;
00099
00100
private:
00101
00104
class StackElement {
00105
public:
00106 DBL time;
00107 DBL value;
00108
public:
00109 StackElement() {}
00110 StackElement(DBL t, DBL v): time(t), value(v) {}
00111 };
00112
00116
class IsosurfaceIntersection:
public Intersection {
00117
00118
public:
00119
bool nointersection;
00120
00121
public:
00122 IsosurfaceIntersection(
const Isosurface* object,
const Ray& r, DBL tmax);
00123 ~IsosurfaceIntersection();
00124
00125
public:
00126
void next();
00127 DBL currentTime();
00128
Vector3 normal();
00129
00130
private:
00131
const Isosurface* iso;
00132 StackElement prelast, last;
00133 DBL root;
00134 DBL klocal;
00135 DBL maxtime;
00136 DBL t_container_max;
00137
bool containerhit;
00138
Intersection* i_container;
00139
00140
private:
00141
void findExactRoot();
00142
void findRoot();
00143 DBL calcPolyRoot();
00144
00145 };
00146
00147 };
00148
00149
#endif