public void AddRayTracedObject(Point3D[] points, GetRayIntersection getRayIntersection) { AddRayTracedObject(GetConvexHullProjBoundaries(points, true), GetConvexHullProjBoundaries(points, false), getRayIntersection); }
public void AddRayTracedObject(double x1, double x2, double y1, double y2, double z1, double z2, GetRayIntersection getRayIntersection) { List<Point3D> points = new List<Point3D>(8); for (int x = 0; x < 2; x++) for (int y = 0; y < 2; y++) for (int z = 0; z < 2; z++) points.Add(new Point3D { X = (x == 0 ? x1 : x2), Y = (y == 0 ? y1 : y2), Z = (z == 0 ? z1 : z2) }); AddRayTracedObject(points.ToArray(), getRayIntersection); }
/// <summary> /// calculate intersections of some figure with rays from eyes through each pixel /// </summary> public void AddRayTracedObject(Rectangle2D<int> leftProjBoundaries, Rectangle2D<int> rightProjBoundaries, GetRayIntersection getRayIntersection) { for (int eye = 0; eye <= 1; eye++) { Rectangle2D<int> projBoundaries = (eye == 0 ? leftProjBoundaries : rightProjBoundaries); double eyeXPos = GetEyeXPos(eye == 0); for (int xProj = projBoundaries.X1; xProj <= projBoundaries.X2; xProj++) for (int yProj = projBoundaries.Y1; yProj <= projBoundaries.Y2; yProj++) { double x, z; if (getRayIntersection(xProj, yProj, eyeXPos, out x, out z)) { if (eye == 0) AdjustNearest(xProj, GetXProj(x, z, false), yProj); else AdjustNearest(GetXProj(x, z, true), xProj, yProj); } } } }
public void AddRayTracedObject(double x1, double x2, double y1, double y2, double z1, double z2, GetRayIntersection getRayIntersection) { List <Point3D> points = new List <Point3D>(8); for (int x = 0; x < 2; x++) { for (int y = 0; y < 2; y++) { for (int z = 0; z < 2; z++) { points.Add(new Point3D { X = (x == 0 ? x1 : x2), Y = (y == 0 ? y1 : y2), Z = (z == 0 ? z1 : z2) }); } } } AddRayTracedObject(points.ToArray(), getRayIntersection); }
/// <summary> /// calculate intersections of some figure with rays from eyes through each pixel /// </summary> public void AddRayTracedObject(Rectangle2D <int> leftProjBoundaries, Rectangle2D <int> rightProjBoundaries, GetRayIntersection getRayIntersection) { for (int eye = 0; eye <= 1; eye++) { Rectangle2D <int> projBoundaries = (eye == 0 ? leftProjBoundaries : rightProjBoundaries); double eyeXPos = GetEyeXPos(eye == 0); for (int xProj = projBoundaries.X1; xProj <= projBoundaries.X2; xProj++) { for (int yProj = projBoundaries.Y1; yProj <= projBoundaries.Y2; yProj++) { double x, z; if (getRayIntersection(xProj, yProj, eyeXPos, out x, out z)) { if (eye == 0) { AdjustNearest(xProj, GetXProj(x, z, false), yProj); } else { AdjustNearest(GetXProj(x, z, true), xProj, yProj); } } } } } }