00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "shape.h"
00024 #include "mc.h"
00025
00026 namespace lux
00027 {
00028
00029
00030 class Disk : public Shape {
00031 public:
00032
00033 Disk(const Transform &o2w, bool ro, float height,
00034 float radius, float innerRadius, float phiMax);
00035 BBox ObjectBound() const;
00036 bool Intersect(const Ray &ray, float *tHit,
00037 DifferentialGeometry *dg) const;
00038 bool IntersectP(const Ray &ray) const;
00039 float Area() const;
00040 Point Sample(float u1, float u2, Normal *Ns) const {
00041 Point p;
00042 ConcentricSampleDisk(u1, u2, &p.x, &p.y);
00043 p.x *= radius;
00044 p.y *= radius;
00045 p.z = height;
00046 *Ns = Normalize(ObjectToWorld(Normal(0,0,1)));
00047 if (reverseOrientation) *Ns *= -1.f;
00048 return ObjectToWorld(p);
00049 }
00050
00051 static Shape* CreateShape(const Transform &o2w, bool reverseOrientation, const ParamSet ¶ms);
00052 private:
00053
00054 float height, radius, innerRadius, phiMax;
00055 };
00056
00057 }
00058