コード例 #1
0
ファイル: Program.cs プロジェクト: dipankarbd/SharpPBRT
        static void Main(string[] args)
        {
            Vector v = new Vector(1,2,3);
            Vector v2 = 5.0f * v;
            Vector v3 = v * 5.0f;

            Vector v4 = v3 / 5.0f;
            int x = 0;
            int y = 1;
            Utility.Swap<int>(ref x, ref y);

            Vector v5 = -v2;
            Point p =new Point(1,2,3);
            Ray r = new Ray(p, v, 0.0f);
            ;
            r.DoSomething();

            int[,] m = new int[4,4];
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    m[i, j] = i * j;
                }
            }
            int[,] n = new int[4, 4];
            Array.Copy(m, n,2);

            Utility.Swap<int>(ref m[0, 0], ref  m[3, 3]);
        }
コード例 #2
0
ファイル: Ray.cs プロジェクト: dipankarbd/SharpPBRT
 public Ray(Point origin, Vector direction, Ray parent, float start, float end = float.PositiveInfinity)
 {
     this.o = origin;
     this.d = direction;
     this.mint = start;
     this.maxt = end;
     this.time = parent.time;
     this.depth = parent.depth + 1;
 }
コード例 #3
0
ファイル: Ray.cs プロジェクト: dipankarbd/SharpPBRT
 public Ray Copy()
 {
     Ray _r = new Ray();
     _r.o = this.o;
     _r.d = this.d;
     _r.mint = this.mint;
     _r.maxt = this.maxt;
     _r.time = this.time;
     _r.depth = this.depth;
     return _r;
 }
コード例 #4
0
ファイル: Transform.cs プロジェクト: dipankarbd/SharpPBRT
 public Ray Apply(Ray r)
 {
     Ray ret = r.Copy();
     ret.o = Apply(r.o);
     ret.d = Apply(r.d);
     return ret;
 }
コード例 #5
0
ファイル: BBox.cs プロジェクト: dipankarbd/SharpPBRT
        public bool IntersectP(Ray ray, out float hitt0, out float hitt1)
        {
            hitt0 = hitt1 = float.PositiveInfinity;
            float t0 = ray.mint, t1 = ray.maxt;
            for (int i = 0; i < 3; ++i)
            {
                // Update interval for _i_th bounding box slab
                float invRayDir = 1.0f / ray.d[i];
                float tNear = (pMin[i] - ray.o[i]) * invRayDir;
                float tFar = (pMax[i] - ray.o[i]) * invRayDir;

                // Update parametric interval from slab intersection $t$s
                if (tNear > tFar) Utility.Swap<float>(ref tNear, ref  tFar);
                t0 = tNear > t0 ? tNear : t0;
                t1 = tFar < t1 ? tFar : t1;
                if (t0 > t1) return false;
            }
            hitt0 = t0;
            hitt1 = t1;
            return true;
        }
コード例 #6
0
 public RayDifferential(Ray ray)
     : base(ray.o, ray.d, ray.mint, ray.maxt, ray.time, ray.depth)
 {
     this.hasDifferentials = false;
 }
コード例 #7
0
 public RayDifferential(Point org, Vector dir, Ray parent, float start, float end = float.PositiveInfinity)
     : base(org, dir, start, end, parent.time, parent.depth + 1)
 {
     this.hasDifferentials = false;
 }