00001 /*
00002 File: Haar.h
00003
00004 Function: Implements haar wavelet basis over an element
00005
00006 Author: Andrew Willmott
00007
00008 Copyright: (c) 1996-2000, Andrew Willmott
00009 */
00010
00011 #ifndef __Haar__
00012 #define __Haar__
00013
00014 #include "HRMesh.h"
00015
00016 class HaarElem;
00017
00018 class HaarLink : public HRLink
00019 {
00020 public:
00021 HRLink *New() { return new HaarLink; };
00022
00023 HaarElem *To() { return((HaarElem*) to); };
00024 HaarElem *From() { return((HaarElem*) from); };
00025
00026 Void Gather();
00027 Bool CalcTransport();
00028 Bool CalcVisibility(HRLink *parent, Bool reuse);
00029 GCLReal Error();
00030 GCLReal BFAError();
00031
00032 Void Print(ostream &s);
00033 Void DrawLink(Renderer &r,
00034 GCLReal left, GCLReal top,
00035 GCLReal right, GCLReal bottom,
00036 GCLReal weight
00037 );
00038
00039 GCLReal Strength() { return(transport); };
00040
00041 GCLReal transport;
00042 GCLReal error;
00043 };
00044
00045 class HaarElem : public HRMeshElem
00046 {
00047 public:
00048 Void SetParent(HierElem &parent);
00049 StrConst Name() { return("haar"); };
00050 HierElem *New() { return(new HaarElem); };
00051
00052 Colour SampleLeaf(Coord c);
00053 Void Print(ostream &s);
00054 Void PrintSelf(ostream &s);
00055 Void ParseSelf(istream &s);
00056
00057 Void DistributeColours();
00058 Void DistributeColoursBest(ShadeInfo &shadeInfo);
00059
00060 Void Add();
00061 Void Push();
00062 Void Pull();
00063 Void CalcLeafRadiosity();
00064 GCLReal Error();
00065 Void ClearB();
00066 Void ClearR();
00067
00068 HaarElem *Child(Int i)
00069 { return((HaarElem*) child[i]); };
00070
00071 // gen wave stuff
00072 Void EltSampleTransport(Int numSamples, Point p[], Vector n[],
00073 Matd &coeffs);
00074 GCLReal EltCalcTransport(HRElem *from, Matd &coeffs);
00075
00076 Void AddIrradiance(const Colour &E, const Vector &m);
00077 Colour GetPower(const Vector &m);
00078
00079 Int NumCoeffs() { return(1); };
00080 Colour *B_Coeffs() { return(&B); };
00081 Colour *R_Coeffs() { return(&R); };
00082
00083 // Fields
00084 Colour B;
00085 Colour R;
00086 static Colour lastB;
00087
00088 };
00089
00090 #endif